Esempio n. 1
0
        /// <inheritdoc/>
        public override IReadOnlySet <FileOrDirectoryArtifact> FilterOutputsCore(IPipFilterContext context, bool negate = false, IList <PipId> constrainingPips = null)
        {
            var outputs = Inner.FilterOutputs(context, negate: false);

            HashSet <PipId> innerPipProducers = new HashSet <PipId>();

            foreach (var innerOutput in outputs)
            {
                innerPipProducers.Add(context.GetProducer(innerOutput));
            }

            var producersAndNeighbors = GetClosureWithOutputs(context, innerPipProducers, GetNeighborPips, ClosureMode);

            if (IncludesInnerMatches)
            {
                // Add producers
                producersAndNeighbors.UnionWith(innerPipProducers);
            }
            else
            {
                // Exclude inner matchs
                producersAndNeighbors.ExceptWith(innerPipProducers);
            }

            // When not negated the set of pips to process is
            // the intersection of the constraining pips and the producers and
            // neighbors set.
            if (!negate)
            {
                if (constrainingPips == null)
                {
                    // No constraining pips, so only consider the producers and neighbors
                    constrainingPips = producersAndNeighbors.ToList();
                }
                else
                {
                    // Has constraining pips, so intersect with the producers and neighbors
                    producersAndNeighbors.IntersectWith(constrainingPips);
                    constrainingPips = producersAndNeighbors.ToList();
                }
            }

            return(ParallelProcessAllOutputs <FileOrDirectoryArtifact>(
                       context,
                       action: (pipId, localOutputs) =>
            {
                if (producersAndNeighbors.Contains(pipId) ^ negate)
                {
                    ForEachOutput(
                        localOutputs,
                        context,
                        pipId,
                        (localOutputs2, output) => localOutputs2.Add(output));
                }
            },
                       pips: constrainingPips));
        }
Esempio n. 2
0
 /// <inheritdoc/>
 public override IReadOnlySet <FileOrDirectoryArtifact> FilterOutputsCore(IPipFilterContext context, bool negate = false, IList <PipId> constrainingPips = null)
 {
     return(Inner.FilterOutputs(context, !negate, constrainingPips));
 }