diff options
author | Lukacs Berki <lberki@google.com> | 2015-08-27 14:20:57 +0000 |
---|---|---|
committer | Philipp Wollermann <philwo@google.com> | 2015-08-27 14:45:40 +0000 |
commit | 145b701977726094f8ae44f6532b9fb3e2057e5e (patch) | |
tree | d51a60ee98e72e1f577552a59bbab7ebf248e903 /src/main/java/com/google/devtools/build/lib/skyframe/SkylarkImportLookupValue.java | |
parent | 2ccd056fd911f821520c97dc8d064a42672a6056 (diff) |
Make load() work in remote repositories too.
Previously, load() always looked up .bzl files in the main repository. Ideally, it would just take a label and then it would work by default, but for the time being, this quick fix will do.
I had to put in an evil hack to make load() statements work in the prelude, because we currently have no way to distinguish load() statements from the prelude and from the BUILD file. Again, a proper label-based load() would solve this.
--
MOS_MIGRATED_REVID=101677502
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/skyframe/SkylarkImportLookupValue.java')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/skyframe/SkylarkImportLookupValue.java | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/SkylarkImportLookupValue.java b/src/main/java/com/google/devtools/build/lib/skyframe/SkylarkImportLookupValue.java index 20579cce0d..9b307be7b8 100644 --- a/src/main/java/com/google/devtools/build/lib/skyframe/SkylarkImportLookupValue.java +++ b/src/main/java/com/google/devtools/build/lib/skyframe/SkylarkImportLookupValue.java @@ -58,6 +58,14 @@ public class SkylarkImportLookupValue implements SkyValue { return dependency; } + private static void checkInputArgument(PathFragment astFilePathFragment) + throws ASTLookupInputException { + if (astFilePathFragment.isAbsolute()) { + throw new ASTLookupInputException(String.format( + "Input file '%s' cannot be an absolute path.", astFilePathFragment)); + } + } + @VisibleForTesting static SkyKey key(PackageIdentifier pkgIdentifier) throws ASTLookupInputException { return key(pkgIdentifier.getRepository(), pkgIdentifier.getPackageFragment()); @@ -79,7 +87,7 @@ public class SkylarkImportLookupValue implements SkyValue { private static SkyKey key(RepositoryName repo, PathFragment fileToImport) throws ASTLookupInputException { // Skylark import lookup keys need to be valid AST file lookup keys. - ASTFileLookupValue.checkInputArgument(fileToImport); + checkInputArgument(fileToImport); return new SkyKey( SkyFunctions.SKYLARK_IMPORTS_LOOKUP, new PackageIdentifier(repo, fileToImport)); |