コード例 #1
0
        protected override IDisposable LinkExternalInput(ITargetBlock <RestoreInfo> targetBlock)
        {
            // At a high-level, we want to combine all implicitly active configurations (ie the active config of each TFM) restore data
            // (via ProjectRestoreUpdate) and combine it into a single IVsProjectRestoreInfo2 instance and publish that. When a change is
            // made to a configuration, such as adding a PackageReference, we should react to it and push a new version of our output. If the
            // active configuration changes, we should react to it, and publish data from the new set of implicitly active configurations.

            var joinBlock = new ConfiguredProjectDataSourceJoinBlock <PackageRestoreConfiguredInput>(
                project => project.Services.ExportProvider.GetExportedValueOrDefault <IPackageRestoreConfiguredInputDataSource>(),
                JoinableFactory,
                _project);

            // Transform all restore data -> combined restore data
            DisposableValue <ISourceBlock <RestoreInfo> > mergeBlock = joinBlock.TransformWithNoDelta(update => update.Derive(MergeRestoreInputs));

            JoinUpstreamDataSources(_activeConfigurationGroupService.ActiveConfiguredProjectGroupSource);

            // Set the link up so that we publish changes to target block
            mergeBlock.Value.LinkTo(targetBlock, DataflowOption.PropagateCompletion);

            return(new DisposableBag
            {
                joinBlock,

                // Link the active configured projects to our join block
                _activeConfigurationGroupService.ActiveConfiguredProjectGroupSource.SourceBlock.LinkTo(joinBlock, DataflowOption.PropagateCompletion),
            });
        }
        protected override IDisposable LinkExternalInput(ITargetBlock <IProjectVersionedValue <UpToDateCheckConfiguredInput> > targetBlock)
        {
            // Aggregates implicitly active UpToDateCheckImplicitConfiguredInput inputs from their sources
            var joinBlock = new ConfiguredProjectDataSourceJoinBlock <UpToDateCheckImplicitConfiguredInput>(
                project => project.Services.ExportProvider.GetExportedValueOrDefault <IUpToDateCheckImplicitConfiguredInputDataSource>(),
                JoinableFactory,
                _configuredProject.UnconfiguredProject);

            // Merges UpToDateCheckImplicitConfiguredInputs into a UpToDateCheckConfiguredInput
            DisposableValue <ISourceBlock <IProjectVersionedValue <UpToDateCheckConfiguredInput> > >
            mergeBlock = joinBlock.TransformWithNoDelta(update => update.Derive(MergeInputs));

            JoinUpstreamDataSources(_activeConfigurationGroupService.ActiveConfiguredProjectGroupSource);

            // Set the link up so that we publish changes to target block
            mergeBlock.Value.LinkTo(targetBlock, DataflowOption.PropagateCompletion);

            return(new DisposableBag
            {
                joinBlock,

                // Link the active configured projects to our join block
                _activeConfigurationGroupService.ActiveConfiguredProjectGroupSource.SourceBlock.LinkTo(joinBlock, DataflowOption.PropagateCompletion),
            });