From c93ef7ba6443d7546294eacfe9d21573a11aad70 Mon Sep 17 00:00:00 2001 From: Kevin Gessner Date: Tue, 19 Dec 2017 08:28:12 -0800 Subject: look for the prelude in each repository (fixes #1673) Instead of every package using the root repository's prelude, it is resolved in each repository for the packages in that repository. There weren't any tests using the prelude at all, so these are better than nothing. I wrote them as bash integration tests instead of Java tests because I couldn't get the prelude to work at all with `BuildViewTestCase` -- I'd be happy to share the busted test I wrote if someone would like to help debug it. Closes #3991. PiperOrigin-RevId: 179557018 --- .../com/google/devtools/build/lib/skyframe/PackageFunction.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src/main/java') diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/PackageFunction.java b/src/main/java/com/google/devtools/build/lib/skyframe/PackageFunction.java index f873feac50..fbd9646a8e 100644 --- a/src/main/java/com/google/devtools/build/lib/skyframe/PackageFunction.java +++ b/src/main/java/com/google/devtools/build/lib/skyframe/PackageFunction.java @@ -541,7 +541,14 @@ public class PackageFunction implements SkyFunction { return null; } - SkyKey astLookupKey = ASTFileLookupValue.key(preludeLabel); + // Load the prelude from the same repository as the package being loaded. Can't use + // Label.resolveRepositoryRelative because preludeLabel is in the main repository, not the + // default one, so it is resolved to itself. + Label pkgPreludeLabel = + Label.createUnvalidated( + PackageIdentifier.create(packageId.getRepository(), preludeLabel.getPackageFragment()), + preludeLabel.getName()); + SkyKey astLookupKey = ASTFileLookupValue.key(pkgPreludeLabel); ASTFileLookupValue astLookupValue = null; try { astLookupValue = (ASTFileLookupValue) env.getValueOrThrow(astLookupKey, -- cgit v1.2.3