Avoid materializing the nested set for filegroup srcs
and then wrapping it in another nested set.
MOS_MIGRATED_REVID=144398091
@@ -22,6 +22,7 @@ import com.google.devtools.build.lib.analysis.CompilationHelper;
import com.google.devtools.build.lib.analysis.ConfiguredTarget;
import com.google.devtools.build.lib.analysis.MiddlemanProvider;
import com.google.devtools.build.lib.analysis.OutputGroupProvider;
+import com.google.devtools.build.lib.analysis.PrerequisiteArtifacts;
import com.google.devtools.build.lib.analysis.RuleConfiguredTarget.Mode;
import com.google.devtools.build.lib.analysis.RuleConfiguredTargetBuilder;
import com.google.devtools.build.lib.analysis.RuleContext;
@@ -30,7 +31,6 @@ import com.google.devtools.build.lib.analysis.RunfilesProvider;
import com.google.devtools.build.lib.analysis.TransitiveInfoCollection;
import com.google.devtools.build.lib.collect.nestedset.NestedSet;
import com.google.devtools.build.lib.collect.nestedset.NestedSetBuilder;
-import com.google.devtools.build.lib.collect.nestedset.Order;
import com.google.devtools.build.lib.rules.RuleConfiguredTargetFactory;
import com.google.devtools.build.lib.rules.test.InstrumentedFilesCollector;
import com.google.devtools.build.lib.rules.test.InstrumentedFilesCollector.InstrumentationSpec;
@@ -38,7 +38,6 @@ import com.google.devtools.build.lib.rules.test.InstrumentedFilesProvider;
import com.google.devtools.build.lib.syntax.Type;
import com.google.devtools.build.lib.util.FileTypeSet;
import com.google.devtools.build.lib.vfs.PathFragment;
-
import java.util.Iterator;
import java.util.List;
@@ -62,9 +61,7 @@ public class Filegroup implements RuleConfiguredTargetFactory {
NestedSet<Artifact> filesToBuild =
outputGroupName.isEmpty()
- ? NestedSetBuilder.wrap(
- Order.STABLE_ORDER,
- ruleContext.getPrerequisiteArtifacts("srcs", Mode.TARGET).list())
+ ? PrerequisiteArtifacts.nestedSet(ruleContext, "srcs", Mode.TARGET)
: getArtifactsForOutputGroup(
outputGroupName, ruleContext.getPrerequisites("srcs", Mode.TARGET));
