Stream results of targets below directory to a callback rather than returning a ResolvedTargets set.
This is the first step in a series to allow processing large sets of targets in query target patterns via streaming batches rather than all at once. This should be a functional no-op.
--
MOS_MIGRATED_REVID=111609309
diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/PrepareDepsOfPatternFunction.java b/src/main/java/com/google/devtools/build/lib/skyframe/PrepareDepsOfPatternFunction.java
index 889cbbb..5b02ecc 100644
--- a/src/main/java/com/google/devtools/build/lib/skyframe/PrepareDepsOfPatternFunction.java
+++ b/src/main/java/com/google/devtools/build/lib/skyframe/PrepareDepsOfPatternFunction.java
@@ -33,6 +33,7 @@
import com.google.devtools.build.lib.pkgcache.PathPackageLocator;
import com.google.devtools.build.lib.pkgcache.TargetPatternResolverUtil;
import com.google.devtools.build.lib.skyframe.EnvironmentBackedRecursivePackageProvider.MissingDepException;
+import com.google.devtools.build.lib.util.BatchCallback;
import com.google.devtools.build.lib.util.Preconditions;
import com.google.devtools.build.lib.vfs.Path;
import com.google.devtools.build.lib.vfs.PathFragment;
@@ -207,10 +208,14 @@
}
@Override
- public ResolvedTargets<Void> findTargetsBeneathDirectory(RepositoryName repository,
- String originalPattern, String directory, boolean rulesOnly,
- ImmutableSet<String> excludedSubdirectories)
- throws TargetParsingException, InterruptedException {
+ public <E extends Exception> void findTargetsBeneathDirectory(
+ RepositoryName repository,
+ String originalPattern,
+ String directory,
+ boolean rulesOnly,
+ ImmutableSet<String> excludedSubdirectories,
+ BatchCallback<Void, E> callback)
+ throws TargetParsingException, E, InterruptedException {
FilteringPolicy policy =
rulesOnly ? FilteringPolicies.RULES_ONLY : FilteringPolicies.NO_FILTER;
ImmutableSet<PathFragment> excludedPathFragments =
@@ -239,7 +244,6 @@
throw new MissingDepException();
}
}
- return ResolvedTargets.empty();
}
}
}