aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/skyframe/ActionExecutionFunction.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/skyframe/ActionExecutionFunction.java')
-rw-r--r--src/main/java/com/google/devtools/build/lib/skyframe/ActionExecutionFunction.java24
1 files changed, 16 insertions, 8 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/ActionExecutionFunction.java b/src/main/java/com/google/devtools/build/lib/skyframe/ActionExecutionFunction.java
index fc7db60296..538ef90008 100644
--- a/src/main/java/com/google/devtools/build/lib/skyframe/ActionExecutionFunction.java
+++ b/src/main/java/com/google/devtools/build/lib/skyframe/ActionExecutionFunction.java
@@ -33,6 +33,7 @@ import com.google.devtools.build.lib.actions.PackageRootResolver;
import com.google.devtools.build.lib.actions.Root;
import com.google.devtools.build.lib.causes.Cause;
import com.google.devtools.build.lib.causes.LabelCause;
+import com.google.devtools.build.lib.cmdline.LabelSyntaxException;
import com.google.devtools.build.lib.cmdline.PackageIdentifier;
import com.google.devtools.build.lib.collect.nestedset.NestedSetBuilder;
import com.google.devtools.build.lib.events.Event;
@@ -296,10 +297,15 @@ public class ActionExecutionFunction implements SkyFunction, CompletionReceiver
PathFragment parent = Preconditions.checkNotNull(
path.getParentDirectory(), "Must pass in files, not root directory");
Preconditions.checkArgument(!parent.isAbsolute(), path);
- SkyKey depKey =
- ContainingPackageLookupValue.key(PackageIdentifier.createInMainRepo(parent));
- depKeys.put(path, depKey);
- keysRequested.add(depKey);
+ try {
+ SkyKey depKey =
+ ContainingPackageLookupValue.key(PackageIdentifier.discoverFromExecPath(path, true));
+ depKeys.put(path, depKey);
+ keysRequested.add(depKey);
+ } catch (LabelSyntaxException e) {
+ throw new PackageRootResolutionException(
+ String.format("Could not find the external repository for %s", path), e);
+ }
}
Map<SkyKey,
@@ -315,8 +321,8 @@ public class ActionExecutionFunction implements SkyFunction, CompletionReceiver
try {
value = (ContainingPackageLookupValue) values.get(depKeys.get(path)).get();
} catch (NoSuchPackageException | InconsistentFilesystemException e) {
- throw new PackageRootResolutionException("Could not determine containing package for "
- + path, e);
+ throw new PackageRootResolutionException(
+ String.format("Could not determine containing package for %s", path), e);
}
if (value == null) {
@@ -325,8 +331,10 @@ public class ActionExecutionFunction implements SkyFunction, CompletionReceiver
}
if (value.hasContainingPackage()) {
// We have found corresponding root for current execPath.
- result.put(path, Root.asSourceRoot(value.getContainingPackageRoot(),
- value.getContainingPackageName().getRepository().isMain()));
+ result.put(path,
+ Root.computeSourceRoot(
+ value.getContainingPackageRoot(),
+ value.getContainingPackageName().getRepository()));
} else {
// We haven't found corresponding root for current execPath.
result.put(path, null);