aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/skyframe/PackageLookupFunction.java
diff options
context:
space:
mode:
authorGravatar John Cater <jcater@google.com>2016-10-12 17:23:30 +0000
committerGravatar Yue Gan <yueg@google.com>2016-10-13 08:52:42 +0000
commit5e9ce943bf24fef5e95231f2507344ea24f5c732 (patch)
tree0aea4233ab143e52682bdf029d5ca24c6282e2b4 /src/main/java/com/google/devtools/build/lib/skyframe/PackageLookupFunction.java
parentfac9be905f0f82f793eb1cc61afab42698769dcf (diff)
Adds an enum to describe how PackageLookupFunction should handle package labels
which cross into a sub-repository. Part of #1592. -- MOS_MIGRATED_REVID=135931868
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/skyframe/PackageLookupFunction.java')
-rw-r--r--src/main/java/com/google/devtools/build/lib/skyframe/PackageLookupFunction.java22
1 files changed, 19 insertions, 3 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/PackageLookupFunction.java b/src/main/java/com/google/devtools/build/lib/skyframe/PackageLookupFunction.java
index 6e425e8dd7..8654501138 100644
--- a/src/main/java/com/google/devtools/build/lib/skyframe/PackageLookupFunction.java
+++ b/src/main/java/com/google/devtools/build/lib/skyframe/PackageLookupFunction.java
@@ -39,11 +39,22 @@ import javax.annotation.Nullable;
* SkyFunction for {@link PackageLookupValue}s.
*/
public class PackageLookupFunction implements SkyFunction {
+ /** Lists possible ways to handle a package label which crosses into a new repository. */
+ public enum CrossRepositoryLabelViolationStrategy {
+ /** Ignore the violation. */
+ IGNORE,
+ /** Generate an error. */
+ ERROR;
+ }
private final AtomicReference<ImmutableSet<PackageIdentifier>> deletedPackages;
+ private final CrossRepositoryLabelViolationStrategy crossRepositoryLabelViolationStrategy;
- public PackageLookupFunction(AtomicReference<ImmutableSet<PackageIdentifier>> deletedPackages) {
+ public PackageLookupFunction(
+ AtomicReference<ImmutableSet<PackageIdentifier>> deletedPackages,
+ CrossRepositoryLabelViolationStrategy crossRepositoryLabelViolationStrategy) {
this.deletedPackages = deletedPackages;
+ this.crossRepositoryLabelViolationStrategy = crossRepositoryLabelViolationStrategy;
}
@Override
@@ -123,7 +134,7 @@ public class PackageLookupFunction implements SkyFunction {
return fileValue;
}
- private static PackageLookupValue getPackageLookupValue(
+ private PackageLookupValue getPackageLookupValue(
Environment env,
ImmutableList<Path> packagePathEntries,
PackageIdentifier packageIdentifier,
@@ -137,6 +148,11 @@ public class PackageLookupFunction implements SkyFunction {
PathFragment buildFileFragment = buildFileName.getBuildFileFragment(packageIdentifier);
RootedPath buildFileRootedPath = RootedPath.toRootedPath(packagePathEntry,
buildFileFragment);
+
+ if (crossRepositoryLabelViolationStrategy != CrossRepositoryLabelViolationStrategy.IGNORE) {
+ // TODO(jcater): Check for cross repository package label violations.
+ }
+
FileValue fileValue = getFileValue(buildFileRootedPath, env, packageIdentifier);
if (fileValue == null) {
return null;
@@ -148,7 +164,7 @@ public class PackageLookupFunction implements SkyFunction {
return PackageLookupValue.NO_BUILD_FILE_VALUE;
}
- private static PackageLookupValue computeWorkspacePackageLookupValue(
+ private PackageLookupValue computeWorkspacePackageLookupValue(
Environment env, ImmutableList<Path> packagePathEntries)
throws PackageLookupFunctionException, InterruptedException {
PackageLookupValue result =