On-the-fly target pattern resolution in SkyQueryEnvironment
Moves pattern resolving logic from TargetPatternFunction.Resolver to
a top level class. Adds a layer of abstraction to the Resolver
implementation enabling it to be backed by either an Environment or
a Graph, for use in SkyFunction evaluation or on-the-fly evaluation,
respectively. Finally, SkyQueryEnvironment#preloadOrThrow now checks
to see if each target pattern exists in the graph, and any that
don't will be resolved on-the-fly.
--
MOS_MIGRATED_REVID=88861201
diff --git a/src/main/java/com/google/devtools/build/lib/cmdline/TargetPattern.java b/src/main/java/com/google/devtools/build/lib/cmdline/TargetPattern.java
index caca634..2c9d4ad 100644
--- a/src/main/java/com/google/devtools/build/lib/cmdline/TargetPattern.java
+++ b/src/main/java/com/google/devtools/build/lib/cmdline/TargetPattern.java
@@ -117,8 +117,7 @@
* Evaluates the current target pattern and returns the result.
*/
public abstract <T> ResolvedTargets<T> eval(TargetPatternResolver<T> resolver)
- throws TargetParsingException, InterruptedException,
- TargetPatternResolver.MissingDepException;
+ throws TargetParsingException, InterruptedException;
private static final class SingleTarget extends TargetPattern {
@@ -131,8 +130,7 @@
@Override
public <T> ResolvedTargets<T> eval(TargetPatternResolver<T> resolver)
- throws TargetParsingException, InterruptedException,
- TargetPatternResolver.MissingDepException {
+ throws TargetParsingException, InterruptedException {
return resolver.getExplicitTarget(targetName);
}
}
@@ -148,8 +146,7 @@
@Override
public <T> ResolvedTargets<T> eval(TargetPatternResolver<T> resolver)
- throws TargetParsingException, InterruptedException,
- TargetPatternResolver.MissingDepException {
+ throws TargetParsingException, InterruptedException {
if (resolver.isPackage(path)) {
// User has specified a package name. lookout for default target.
return resolver.getExplicitTarget("//" + path);
@@ -194,8 +191,7 @@
@Override
public <T> ResolvedTargets<T> eval(TargetPatternResolver<T> resolver)
- throws TargetParsingException, InterruptedException,
- TargetPatternResolver.MissingDepException {
+ throws TargetParsingException, InterruptedException {
if (checkWildcardConflict) {
ResolvedTargets<T> targets = getWildcardConflict(resolver);
if (targets != null) {
@@ -214,7 +210,7 @@
* is such a target. Otherwise, return null.
*/
private <T> ResolvedTargets<T> getWildcardConflict(TargetPatternResolver<T> resolver)
- throws InterruptedException, TargetPatternResolver.MissingDepException {
+ throws InterruptedException {
if (!isAbsolute) {
return null;
}
@@ -255,8 +251,7 @@
@Override
public <T> ResolvedTargets<T> eval(TargetPatternResolver<T> resolver)
- throws TargetParsingException, InterruptedException,
- TargetPatternResolver.MissingDepException {
+ throws TargetParsingException, InterruptedException {
return resolver.findTargetsBeneathDirectory(originalPattern, pathPrefix, rulesOnly);
}
}