diff options
author | Klaus Aehlig <aehlig@google.com> | 2018-05-03 03:20:24 -0700 |
---|---|---|
committer | Copybara-Service <copybara-piper@google.com> | 2018-05-03 03:21:50 -0700 |
commit | 8ac2fb1ff86a8a08d1a53888ae5adf901becd2b9 (patch) | |
tree | a3c836465a23ebcbb0263b5fb440e9197dcece78 /src/main | |
parent | dfa8dcde7388d0f57c2e2f21d96f388a566a4fb6 (diff) |
In PackageLookupValue also track the repository
...to distinguish files with the same name that go through a repository
symlink that has changed.
Change-Id: I611c15ea5a48f4b797a725785165bf5a3aba387f
PiperOrigin-RevId: 195226865
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/skyframe/PackageLookupFunction.java | 3 | ||||
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/skyframe/PackageLookupValue.java | 33 |
2 files changed, 32 insertions, 4 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 780b4d8733..4b26017315 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 @@ -333,7 +333,8 @@ public class PackageLookupFunction implements SkyFunction { } if (fileValue.isFile()) { - return PackageLookupValue.success(Root.fromPath(repositoryValue.getPath()), buildFileName); + return PackageLookupValue.success( + repositoryValue, Root.fromPath(repositoryValue.getPath()), buildFileName); } } diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/PackageLookupValue.java b/src/main/java/com/google/devtools/build/lib/skyframe/PackageLookupValue.java index 2b7c49af53..6cb35be790 100644 --- a/src/main/java/com/google/devtools/build/lib/skyframe/PackageLookupValue.java +++ b/src/main/java/com/google/devtools/build/lib/skyframe/PackageLookupValue.java @@ -27,6 +27,7 @@ import com.google.devtools.build.skyframe.AbstractSkyKey; import com.google.devtools.build.skyframe.SkyFunctionName; import com.google.devtools.build.skyframe.SkyKey; import com.google.devtools.build.skyframe.SkyValue; +import javax.annotation.Nullable; /** * A value that represents a package lookup result. @@ -70,8 +71,13 @@ public abstract class PackageLookupValue implements SkyValue { protected PackageLookupValue() { } + public static PackageLookupValue success( + RepositoryValue repository, Root root, BuildFileName buildFileName) { + return new SuccessfulPackageLookupValue(repository, root, buildFileName); + } + public static PackageLookupValue success(Root root, BuildFileName buildFileName) { - return new SuccessfulPackageLookupValue(root, buildFileName); + return new SuccessfulPackageLookupValue(null, root, buildFileName); } public static PackageLookupValue invalidPackageName(String errorMsg) { @@ -151,16 +157,35 @@ public abstract class PackageLookupValue implements SkyValue { @AutoCodec public static class SuccessfulPackageLookupValue extends PackageLookupValue { + /** + * The repository value the meaning of the path depends on (e.g., an external repository + * controlling a symbolic link the path goes trough). Can be {@code null}, if does not depend + * on such a repository; will always be {@code null} for packages in the main repository. + */ + @Nullable private final RepositoryValue repository; private final Root root; private final BuildFileName buildFileName; @AutoCodec.Instantiator @AutoCodec.VisibleForSerialization + SuccessfulPackageLookupValue( + @Nullable RepositoryValue repository, Root root, BuildFileName buildFileName) { + this.repository = repository; + this.root = root; + this.buildFileName = buildFileName; + } + SuccessfulPackageLookupValue(Root root, BuildFileName buildFileName) { + this.repository = null; this.root = root; this.buildFileName = buildFileName; } + @Nullable + public RepositoryValue repository() { + return repository; + } + @Override public boolean packageExists() { return true; @@ -192,12 +217,14 @@ public abstract class PackageLookupValue implements SkyValue { return false; } SuccessfulPackageLookupValue other = (SuccessfulPackageLookupValue) obj; - return root.equals(other.root) && buildFileName == other.buildFileName; + return root.equals(other.root) + && buildFileName == other.buildFileName + && Objects.equal(repository, other.repository); } @Override public int hashCode() { - return Objects.hashCode(root.hashCode(), buildFileName.hashCode()); + return Objects.hashCode(root.hashCode(), buildFileName.hashCode(), repository); } } |