public ProjectDebuggerProvider(ConfiguredProject configuredProject, ILaunchSettingsProvider launchSettingsProvider,
                                OrderPrecedenceImportCollection <IDebugProfileLaunchTargetsProvider> providers)
     : base(configuredProject)
 {
     ProfileLaunchTargetsProviders = providers;
     LaunchSettingsProvider        = launchSettingsProvider;
 }
 public DependenciesViewModelFactory(UnconfiguredProject unconfiguredProject)
 {
     Project          = unconfiguredProject;
     SubTreeProviders = new OrderPrecedenceImportCollection <IProjectDependenciesSubTreeProvider>(
         ImportOrderPrecedenceComparer.PreferenceOrder.PreferredComesLast,
         projectCapabilityCheckProvider: unconfiguredProject);
 }
        public DependenciesProjectTreeProvider(
            IProjectThreadingService threadingService,
            IProjectAccessor projectAccessor,
            UnconfiguredProject unconfiguredProject,
            IDependenciesSnapshotProvider dependenciesSnapshotProvider,
            [Import(DependenciesSnapshotProvider.DependencySubscriptionsHostContract)] ICrossTargetSubscriptionsHost dependenciesHost,
            [Import(ExportContractNames.Scopes.UnconfiguredProject)] IProjectAsynchronousTasksService tasksService,
            IDependencyTreeTelemetryService treeTelemetryService)
            : base(threadingService, unconfiguredProject)
        {
            _projectTreePropertiesProviders = new OrderPrecedenceImportCollection <IProjectTreePropertiesProvider>(
                ImportOrderPrecedenceComparer.PreferenceOrder.PreferredComesLast,
                projectCapabilityCheckProvider: unconfiguredProject);

            _viewProviders = new OrderPrecedenceImportCollection <IDependenciesTreeViewProvider>(
                ImportOrderPrecedenceComparer.PreferenceOrder.PreferredComesFirst,
                projectCapabilityCheckProvider: unconfiguredProject);

            _dependenciesSnapshotProvider = dependenciesSnapshotProvider;
            _dependenciesHost             = dependenciesHost;
            _tasksService         = tasksService;
            _projectAccessor      = projectAccessor;
            _treeTelemetryService = treeTelemetryService;

            // Hook this so we can unregister the snapshot change event when the project unloads
            unconfiguredProject.ProjectUnloading += OnUnconfiguredProjectUnloading;

            Task OnUnconfiguredProjectUnloading(object sender, EventArgs args)
            {
                UnconfiguredProject.ProjectUnloading -= OnUnconfiguredProjectUnloading;
                _snapshotEventListener?.Dispose();

                return(Task.CompletedTask);
            }
        }
        public void ImportsAndEventsAsNonNull()
        {
            var imports     = Mock.Of <Imports>();
            var importsImpl = new OrderPrecedenceImportCollection <Imports>(ImportOrderPrecedenceComparer.PreferenceOrder.PreferredComesFirst, (UnconfiguredProject)null)
            {
                new Lazy <Imports, IOrderPrecedenceMetadataView>(() => imports, IOrderPrecedenceMetadataViewFactory.Create("VisualBasic"))
            };
            var events = Mock.Of <VSProjectEvents>();
            var vsProjectEventsImpl = new OrderPrecedenceImportCollection <VSProjectEvents>(ImportOrderPrecedenceComparer.PreferenceOrder.PreferredComesFirst, (UnconfiguredProject)null)
            {
                new Lazy <VSProjectEvents, IOrderPrecedenceMetadataView>(() => events, IOrderPrecedenceMetadataViewFactory.Create("VisualBasic"))
            };

            var innerVSProjectMock = new Mock <VSLangProj.VSProject>();

            var unconfiguredProjectMock = new Mock <UnconfiguredProject>();

            unconfiguredProjectMock.Setup(p => p.Capabilities)
            .Returns((IProjectCapabilitiesScope)null);

            var vsproject = new VSProjectTestImpl(
                innerVSProjectMock.Object,
                threadingService: Mock.Of <IProjectThreadingService>(),
                projectProperties: Mock.Of <ActiveConfiguredProject <ProjectProperties> >(),
                project: unconfiguredProjectMock.Object);

            vsproject.SetImportsImpl(importsImpl);
            vsproject.SetVSProjectEventsImpl(vsProjectEventsImpl);

            Assert.NotNull(vsproject);
            Assert.True(imports.Equals(vsproject.Imports));
            Assert.Equal(events, vsproject.Events);
        }
 public VisualBasicVSProjectEvents(
     [Import(ExportContractNames.VsTypes.CpsVSProject)] VSLangProj.VSProject vsProject,
     UnconfiguredProject project)
 {
     _vsProject        = vsProject;
     ImportsEventsImpl = new OrderPrecedenceImportCollection <ImportsEvents>(projectCapabilityCheckProvider: project);
 }
Exemplo n.º 6
0
 public RoslynServices(
     IProjectThreadingService threadingService,
     UnconfiguredProject project)
 {
     _threadingService       = threadingService;
     SyntaxFactsServicesImpl = new OrderPrecedenceImportCollection <ISyntaxFactsService>(projectCapabilityCheckProvider: project);
 }
 internal VSBuildManager(IProjectThreadingService threadingService, IUnconfiguredProjectCommonServices unconfiguredProjectServices)
 {
     AddEventSource(this);
     _threadingService            = threadingService;
     _unconfiguredProjectServices = unconfiguredProjectServices;
     Project = new OrderPrecedenceImportCollection <VSLangProj.VSProject>(projectCapabilityCheckProvider: unconfiguredProjectServices.Project);
 }
Exemplo n.º 8
0
        public DependenciesProjectTreeProvider(
            IProjectThreadingService threadingService,
            UnconfiguredProject project,
            IDependenciesSnapshotProvider dependenciesSnapshotProvider,
            [Import(DependencySubscriptionsHost.DependencySubscriptionsHostContract)]
            ICrossTargetSubscriptionsHost dependenciesHost,
            [Import(ExportContractNames.Scopes.UnconfiguredProject)] IProjectAsynchronousTasksService tasksService,
            IDependencyTreeTelemetryService treeTelemetryService)
            : base(threadingService, project)
        {
            ProjectTreePropertiesProviders = new OrderPrecedenceImportCollection <IProjectTreePropertiesProvider>(
                ImportOrderPrecedenceComparer.PreferenceOrder.PreferredComesLast,
                projectCapabilityCheckProvider: project);

            ViewProviders = new OrderPrecedenceImportCollection <IDependenciesTreeViewProvider>(
                ImportOrderPrecedenceComparer.PreferenceOrder.PreferredComesFirst,
                projectCapabilityCheckProvider: project);

            DependenciesSnapshotProvider = dependenciesSnapshotProvider;
            DependenciesHost             = dependenciesHost;
            TasksService          = tasksService;
            _treeTelemetryService = treeTelemetryService;

            project.ProjectUnloading += OnUnconfiguredProjectUnloading;
        }
Exemplo n.º 9
0
        public void VSProjectEvents_Properties()
        {
            var referenceEvents = Mock.Of<ReferencesEvents>();
            var buildManagerEvents = Mock.Of<BuildManagerEvents>();

            var projectEventsMock = new Mock<VSProjectEvents>();
            projectEventsMock.Setup(e => e.ReferencesEvents)
                             .Returns(referenceEvents);
            projectEventsMock.Setup(e => e.BuildManagerEvents)
                             .Returns(buildManagerEvents);

            var innerVSProjectMock = new Mock<VSLangProj.VSProject>();
            innerVSProjectMock.Setup(p => p.Events)
                              .Returns(projectEventsMock.Object);

            var unconfiguredProjectMock = new Mock<UnconfiguredProject>();
            unconfiguredProjectMock.Setup(p => p.Capabilities)
                                   .Returns((IProjectCapabilitiesScope)null);

            var importEvents = Mock.Of<ImportsEvents>();
            var importsEventsImpl = new OrderPrecedenceImportCollection<ImportsEvents>(ImportOrderPrecedenceComparer.PreferenceOrder.PreferredComesFirst, (UnconfiguredProject)null)
            {
                new Lazy<ImportsEvents, IOrderPrecedenceMetadataView>(() => importEvents, IOrderPrecedenceMetadataViewFactory.Create("VisualBasic"))
            };
            var vsProjectEvents = GetVSProjectEvents(innerVSProjectMock.Object, unconfiguredProjectMock.Object);

            vsProjectEvents.SetImportsEventsImpl(importsEventsImpl);

            Assert.NotNull(vsProjectEvents);
            Assert.Equal(referenceEvents, vsProjectEvents.ReferencesEvents);
            Assert.Equal(buildManagerEvents, vsProjectEvents.BuildManagerEvents);
            Assert.Equal(importEvents, vsProjectEvents.ImportsEvents);
        }
        public CommandLineItemHandler(UnconfiguredProject project, ICommandLineParserService commandLineParser)
        {
            Requires.NotNull(commandLineParser, nameof(commandLineParser));

            _commandLineParser = commandLineParser;
            Handlers           = new OrderPrecedenceImportCollection <ILanguageServiceCommandLineHandler>(projectCapabilityCheckProvider: project);
        }
Exemplo n.º 11
0
        public DependencySubscriptionsHost(
            IUnconfiguredProjectCommonServices commonServices,
            Lazy <IAggregateCrossTargetProjectContextProvider> contextProvider,
            [Import(ExportContractNames.Scopes.UnconfiguredProject)] IProjectAsynchronousTasksService tasksService,
            IActiveConfiguredProjectSubscriptionService activeConfiguredProjectSubscriptionService,
            IActiveProjectConfigurationRefreshService activeProjectConfigurationRefreshService,
            ITargetFrameworkProvider targetFrameworkProvider,
            IAggregateDependenciesSnapshotProvider aggregateSnapshotProvider)
            : base(commonServices,
                   contextProvider,
                   tasksService,
                   activeConfiguredProjectSubscriptionService,
                   activeProjectConfigurationRefreshService)
        {
            CommonServices        = commonServices;
            DependencySubscribers = new OrderPrecedenceImportCollection <IDependencyCrossTargetSubscriber>(
                projectCapabilityCheckProvider: commonServices.Project);

            SnapshotFilters = new OrderPrecedenceImportCollection <IDependenciesSnapshotFilter>(
                projectCapabilityCheckProvider: commonServices.Project,
                orderingStyle: ImportOrderPrecedenceComparer.PreferenceOrder.PreferredComesLast);

            SubTreeProviders = new OrderPrecedenceImportCollection <IProjectDependenciesSubTreeProvider>(
                ImportOrderPrecedenceComparer.PreferenceOrder.PreferredComesLast,
                projectCapabilityCheckProvider: commonServices.Project);

            DependenciesUpdateScheduler = new TaskDelayScheduler(
                _dependenciesUpdateThrottleInterval,
                commonServices.ThreadingService,
                tasksService.UnloadCancellationToken);

            TargetFrameworkProvider   = targetFrameworkProvider;
            AggregateSnapshotProvider = aggregateSnapshotProvider;
            ProjectFilePath           = CommonServices.Project.FullPath;
        }
Exemplo n.º 12
0
        protected GraphActionHandlerBase(IAggregateDependenciesSnapshotProvider aggregateSnapshotProvider)
        {
            AggregateSnapshotProvider = aggregateSnapshotProvider;

            _viewProviders = new OrderPrecedenceImportCollection <IDependenciesGraphViewProvider>(
                ImportOrderPrecedenceComparer.PreferenceOrder.PreferredComesFirst);
        }
        public DependencyRulesSubscriber(
            IUnconfiguredProjectCommonServices commonServices,
            IUnconfiguredProjectTasksService tasksService,
            IDependencyTreeTelemetryService treeTelemetryService)
            : base(commonServices.ThreadingService, tasksService)
        {
            _handlers = new OrderPrecedenceImportCollection <IDependenciesRuleHandler>(
                projectCapabilityCheckProvider: commonServices.Project);

            _treeTelemetryService = treeTelemetryService;

            _watchedJointRules      = new Lazy <string[]>(() => GetRuleNames(RuleSource.Joint));
            _watchedEvaluationRules = new Lazy <string[]>(() => GetRuleNames(RuleSource.Evaluation));

            string[] GetRuleNames(RuleSource source)
            {
                var rules = new HashSet <string>(StringComparers.RuleNames);

                foreach (Lazy <IDependenciesRuleHandler, IOrderPrecedenceMetadataView> item in _handlers)
                {
                    rules.Add(item.Value.EvaluatedRuleName);

                    if (source == RuleSource.Joint)
                    {
                        rules.Add(item.Value.ResolvedRuleName);
                    }
                }

                return(rules.ToArray());
            }
        }
        /// <summary>
        /// Produces the sequence of imports within a <see cref="OrderPrecedenceImportCollection{T}"/>,
        /// omitting any that throw MEF exceptions.
        /// </summary>
        /// <typeparam name="T">The type of import.</typeparam>
        /// <param name="extensions">The collection of imports.</param>
        /// <param name="onlyCreatedValues">
        /// <c>true</c> to only enumerate imports whose values have previously been created.
        /// This is useful in <see cref="IDisposable.Dispose"/> methods to avoid MEF
        /// <see cref="ObjectDisposedException"/> from accidentally creating values during a container disposal.
        /// </param>
        /// <returns>The safely constructed sequence of extensions.</returns>
        internal static IEnumerable <T> ExtensionValues <T>(this OrderPrecedenceImportCollection <T> extensions, bool onlyCreatedValues = false)
        {
            Requires.NotNull(extensions, nameof(extensions));
            string traceErrorMessage = "Roslyn project system extension rejected due to exception: {0}";

            foreach (Lazy <T> extension in extensions)
            {
                T value;
                try
                {
                    if (onlyCreatedValues && !extension.IsValueCreated)
                    {
                        continue;
                    }

                    value = extension.Value;
                }
                catch (CompositionContractMismatchException ex)
                {
                    TraceUtilities.TraceError(traceErrorMessage, ex);
                    continue;
                }
                catch (CompositionException ex)
                {
                    TraceUtilities.TraceError(traceErrorMessage, ex);
                    continue;
                }

                yield return(value);
            }
        }
        public ActiveConfiguredProjectsProvider(IUnconfiguredProjectServices services, UnconfiguredProject project)
        {
            _services = services;
            _project  = project;

            DimensionProviders = new OrderPrecedenceImportCollection <IActiveConfiguredProjectsDimensionProvider>(projectCapabilityCheckProvider: project);
        }
        public WindowsFormsEditorProvider(UnconfiguredProject unconfiguredProject, Lazy <IPhysicalProjectTree> projectTree, Lazy <IProjectSystemOptions> options)
        {
            _projectTree = projectTree;
            _options     = options;

            ProjectSpecificEditorProviders = new OrderPrecedenceImportCollection <IProjectSpecificEditorProvider, INamedExportMetadataView>(projectCapabilityCheckProvider: unconfiguredProject);
        }
Exemplo n.º 17
0
        public CommandLineParserService(UnconfiguredProject project)
        {
            Requires.NotNull(project, nameof(project));

            _project           = project;
            CommandLineParsers = new OrderPrecedenceImportCollection <IParseBuildOptions>(projectCapabilityCheckProvider: project);
        }
Exemplo n.º 18
0
        public DependenciesSnapshotProvider(
            IUnconfiguredProjectCommonServices commonServices,
            Lazy <AggregateCrossTargetProjectContextProvider> contextProvider,
            IUnconfiguredProjectTasksService tasksService,
            IActiveConfiguredProjectSubscriptionService activeConfiguredProjectSubscriptionService,
            IActiveProjectConfigurationRefreshService activeProjectConfigurationRefreshService,
            ITargetFrameworkProvider targetFrameworkProvider,
            IAggregateDependenciesSnapshotProvider aggregateSnapshotProvider)
            : base(commonServices.ThreadingService.JoinableTaskContext)
        {
            _commonServices = commonServices;
            _tasksService   = tasksService;
            _activeConfiguredProjectSubscriptionService = activeConfiguredProjectSubscriptionService;
            _targetFrameworkProvider   = targetFrameworkProvider;
            _aggregateSnapshotProvider = aggregateSnapshotProvider;

            _dependencySubscribers = new OrderPrecedenceImportCollection <IDependencyCrossTargetSubscriber>(
                projectCapabilityCheckProvider: commonServices.Project);

            _snapshotFilters = new OrderPrecedenceImportCollection <IDependenciesSnapshotFilter>(
                ImportOrderPrecedenceComparer.PreferenceOrder.PreferredComesLast,
                projectCapabilityCheckProvider: commonServices.Project);

            _subTreeProviders = new OrderPrecedenceImportCollection <IProjectDependenciesSubTreeProvider>(
                ImportOrderPrecedenceComparer.PreferenceOrder.PreferredComesLast,
                projectCapabilityCheckProvider: commonServices.Project);

            _context = new ContextTracker(targetFrameworkProvider, commonServices, contextProvider, activeProjectConfigurationRefreshService);

            _snapshot = new SnapshotUpdater(commonServices, tasksService.UnloadCancellationToken);

            _disposables = new DisposableBag {
                _snapshot, _contextUpdateGate
            };
        }
Exemplo n.º 19
0
 public GraphActionHandlerBase(IDependenciesGraphBuilder builder,
                               IAggregateDependenciesSnapshotProvider aggregateSnapshotProvider)
 {
     Builder = builder;
     AggregateSnapshotProvider = aggregateSnapshotProvider;
     ViewProviders             = new OrderPrecedenceImportCollection <IDependenciesGraphViewProvider>(
         ImportOrderPrecedenceComparer.PreferenceOrder.PreferredComesFirst);
 }
        public ReloadableProject(IUnconfiguredProjectVsServices projectVsServices, IProjectReloadManager reloadManager)
            : base(projectVsServices.ThreadingService.JoinableTaskContext)
        {
            _projectVsServices = projectVsServices;
            _reloadManager     = reloadManager;

            ProjectReloadInterceptors = new OrderPrecedenceImportCollection <IProjectReloadInterceptor>(projectCapabilityCheckProvider: projectVsServices.Project);
        }
 public LanguageServiceHandlerManager(UnconfiguredProject project, ICommandLineParserService commandLineParser, IContextHandlerProvider handlerProvider, IProjectLogger logger)
 {
     _project                 = project;
     _commandLineParser       = commandLineParser;
     _handlerProvider         = handlerProvider;
     _logger                  = logger;
     CommandLineNotifications = new OrderPrecedenceImportCollection <Action <string, BuildOptions, BuildOptions> >(projectCapabilityCheckProvider: project);
 }
 public DependencyRulesSubscriber(
     IUnconfiguredProjectCommonServices commonServices,
     [Import(ExportContractNames.Scopes.UnconfiguredProject)] IProjectAsynchronousTasksService tasksService)
     : base(commonServices, tasksService)
 {
     DependencyRuleHandlers = new OrderPrecedenceImportCollection <ICrossTargetRuleHandler <DependenciesRuleChangeContext> >(
         projectCapabilityCheckProvider: commonServices.Project);
 }
Exemplo n.º 23
0
        public TizenLaunchSettingsProvider(UnconfiguredProject unconfiguredProject, IUnconfiguredProjectCommonServices commonProjectServices)
        {
            CommonProjectServices     = commonProjectServices;
            SourceControlIntegrations = new OrderPrecedenceImportCollection <ISourceCodeControlIntegration>(projectCapabilityCheckProvider: unconfiguredProject);
            FileManager = new Win32FileSystem();

            ProjectSubscriptionService = CommonProjectServices.ActiveConfiguredProject.Services.ProjectSubscription;
        }
Exemplo n.º 24
0
        public VsSafeProjectGuidService(UnconfiguredProject project, IUnconfiguredProjectTasksService tasksService)
        {
            _tasksService = tasksService;

#pragma warning disable RS0030 // IProjectGuidService is banned
            ProjectGuidServices = new OrderPrecedenceImportCollection <IProjectGuidService>(projectCapabilityCheckProvider: project);
#pragma warning restore RS0030
        }
Exemplo n.º 25
0
        public ApplyChangesToWorkspaceContext(ConfiguredProject project, IProjectLogger logger, [ImportMany] ExportFactory <IWorkspaceContextHandler>[] workspaceContextHandlerFactories)
        {
            _project = project;
            _logger  = logger;
            _workspaceContextHandlerFactories = workspaceContextHandlerFactories;

            CommandLineParsers = new OrderPrecedenceImportCollection <ICommandLineParserService>(projectCapabilityCheckProvider: project);
        }
Exemplo n.º 26
0
        public PasteOrdering(UnconfiguredProject unconfiguredProject, IProjectAccessor accessor)
        {
            _configuredProject = unconfiguredProject.Services.ActiveConfiguredProjectProvider.ActiveConfiguredProject;
            _accessor          = accessor;

            PasteHandlers   = new OrderPrecedenceImportCollection <IPasteHandler>(projectCapabilityCheckProvider: unconfiguredProject);
            PasteProcessors = new OrderPrecedenceImportCollection <IPasteDataObjectProcessor>(projectCapabilityCheckProvider: unconfiguredProject);
        }
        public DependenciesGraphChangeTracker(IAggregateDependenciesSnapshotProvider aggregateSnapshotProvider)
        {
            _aggregateSnapshotProvider = aggregateSnapshotProvider;
            _aggregateSnapshotProvider.SnapshotChanged += OnSnapshotChanged;

            _viewProviders = new OrderPrecedenceImportCollection <IDependenciesGraphViewProvider>(
                ImportOrderPrecedenceComparer.PreferenceOrder.PreferredComesFirst);
        }
        public static void Add <T>(this OrderPrecedenceImportCollection <T> collection, T value, string appliesTo = null, int orderPrecedence = 0)
        {
            var metadata = IOrderPrecedenceMetadataViewFactory.Create(appliesTo, orderPrecedence);

            var export = new Lazy <T, IOrderPrecedenceMetadataView>(() => value, metadata);

            collection.Add(export);
        }
        public ConfiguredProjectImplicitActivationTracking(ConfiguredProject project, IActiveConfigurationGroupService activeConfigurationGroupService, [Import(ExportContractNames.Scopes.ConfiguredProject)] IProjectAsynchronousTasksService tasksService)
        {
            _project = project;
            _activeConfigurationGroupService = activeConfigurationGroupService;
            _tasksService = tasksService;
            _targetBlock  = DataflowBlockFactory.CreateActionBlock <IProjectVersionedValue <IConfigurationGroup <ProjectConfiguration> > >(OnActiveConfigurationsChanged, project.UnconfiguredProject, ProjectFaultSeverity.LimitedFunctionality);

            ImplicitlyActiveServices = new OrderPrecedenceImportCollection <IImplicitlyActiveService>(projectCapabilityCheckProvider: project);
        }
Exemplo n.º 30
0
 public ProjectDebuggerProvider(ConfiguredProject configuredProject, ILaunchSettingsProvider launchSettingsProvider,
                                OrderPrecedenceImportCollection <IDebugProfileLaunchTargetsProvider> providers,
                                IVsService <SVsShellDebugger, IVsDebugger4> vsDebuggerService)
     : base(configuredProject)
 {
     ProfileLaunchTargetsProviders = providers;
     _vsDebuggerService            = vsDebuggerService;
     LaunchSettingsProvider        = launchSettingsProvider;
 }
        private CommandGroupHandler(UnconfiguredProject project, IThreadHandling threadHandler, IProjectLockService lockService, 
            [ImportMany] IEnumerable<IDeployTargetUI> targetUIs, [Import(typeof(SVsServiceProvider))] IServiceProvider serviceProvider)
        {
            this.threadHandler = threadHandler;
            threadHandler.VerifyOnUIThread();
            this.project = project;
            uiShell = (IVsUIShell)serviceProvider.GetService(typeof(IVsUIShell));
            docTable = (IVsRunningDocumentTable)serviceProvider.GetService(typeof(IVsRunningDocumentTable));

            ProjectHierarchies = new OrderPrecedenceImportCollection<IVsHierarchy>(projectCapabilityCheckProvider: project);
            this.lockService = lockService;
            this.targetUIs = targetUIs;
        }
Exemplo n.º 32
0
 public PropertyPageProvider(UnconfiguredProject unconfiguredProject) {
     PropertyPages = new OrderPrecedenceImportCollection<IPageMetadata>(projectCapabilityCheckProvider: unconfiguredProject);
 }