aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/skyframe/LocalRepositoryLookupValue.java
diff options
context:
space:
mode:
authorGravatar John Cater <jcater@google.com>2017-09-05 18:31:10 +0200
committerGravatar Yun Peng <pcloudy@google.com>2017-09-06 10:10:09 +0200
commite0dfb3c3d70efc49c703be7e4c8e93c8a6b38d6b (patch)
treede98ba794d396262407e19b2bb6a08580b9a4dd0 /src/main/java/com/google/devtools/build/lib/skyframe/LocalRepositoryLookupValue.java
parent268c0bcbf79f9f3f72d95fa51af0f1b18c5ce29e (diff)
Update LocalRepositoryLookupFunction to also return the path of the
repository. Part of #3553. Change-Id: Id8b4958844b2ad7b5ce4b2ea00a91b6b22acc025 PiperOrigin-RevId: 167589110
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/skyframe/LocalRepositoryLookupValue.java')
-rw-r--r--src/main/java/com/google/devtools/build/lib/skyframe/LocalRepositoryLookupValue.java31
1 files changed, 28 insertions, 3 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/LocalRepositoryLookupValue.java b/src/main/java/com/google/devtools/build/lib/skyframe/LocalRepositoryLookupValue.java
index b2a0c548e1..0bdf7ab2b6 100644
--- a/src/main/java/com/google/devtools/build/lib/skyframe/LocalRepositoryLookupValue.java
+++ b/src/main/java/com/google/devtools/build/lib/skyframe/LocalRepositoryLookupValue.java
@@ -14,6 +14,7 @@
package com.google.devtools.build.lib.skyframe;
import com.google.devtools.build.lib.cmdline.RepositoryName;
+import com.google.devtools.build.lib.vfs.PathFragment;
import com.google.devtools.build.lib.vfs.RootedPath;
import com.google.devtools.build.skyframe.LegacySkyKey;
import com.google.devtools.build.skyframe.SkyKey;
@@ -39,8 +40,9 @@ public abstract class LocalRepositoryLookupValue implements SkyValue {
return MAIN_REPO_VALUE;
}
- public static LocalRepositoryLookupValue success(RepositoryName repositoryName) {
- return new SuccessfulLocalRepositoryLookupValue(repositoryName);
+ public static LocalRepositoryLookupValue success(
+ RepositoryName repositoryName, PathFragment path) {
+ return new SuccessfulLocalRepositoryLookupValue(repositoryName, path);
}
public static LocalRepositoryLookupValue notFound() {
@@ -60,6 +62,12 @@ public abstract class LocalRepositoryLookupValue implements SkyValue {
*/
public abstract RepositoryName getRepository();
+ /**
+ * Returns the path to the local repository, or throws a {@link IllegalStateException} if there
+ * was no repository found.
+ */
+ public abstract PathFragment getPath();
+
/** Represents a successful lookup of the main repository. */
public static final class MainRepositoryLookupValue extends LocalRepositoryLookupValue {
@@ -77,6 +85,11 @@ public abstract class LocalRepositoryLookupValue implements SkyValue {
}
@Override
+ public PathFragment getPath() {
+ return PathFragment.EMPTY_FRAGMENT;
+ }
+
+ @Override
public String toString() {
return "MainRepositoryLookupValue";
}
@@ -97,9 +110,11 @@ public abstract class LocalRepositoryLookupValue implements SkyValue {
public static final class SuccessfulLocalRepositoryLookupValue
extends LocalRepositoryLookupValue {
private final RepositoryName repositoryName;
+ private final PathFragment path;
- public SuccessfulLocalRepositoryLookupValue(RepositoryName repositoryName) {
+ public SuccessfulLocalRepositoryLookupValue(RepositoryName repositoryName, PathFragment path) {
this.repositoryName = repositoryName;
+ this.path = path;
}
@Override
@@ -113,6 +128,11 @@ public abstract class LocalRepositoryLookupValue implements SkyValue {
}
@Override
+ public PathFragment getPath() {
+ return path;
+ }
+
+ @Override
public String toString() {
return "SuccessfulLocalRepositoryLookupValue(" + repositoryName + ")";
}
@@ -149,6 +169,11 @@ public abstract class LocalRepositoryLookupValue implements SkyValue {
}
@Override
+ public PathFragment getPath() {
+ throw new IllegalStateException("Repository was not found");
+ }
+
+ @Override
public String toString() {
return "NotFoundLocalRepositoryLookupValue";
}