aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/skyframe/PackageFunction.java
diff options
context:
space:
mode:
authorGravatar Googler <noreply@google.com>2015-02-09 14:42:21 +0000
committerGravatar Han-Wen Nienhuys <hanwen@google.com>2015-02-09 14:42:21 +0000
commit9f212f7efffddf81a261be9bcd4e43cc1749a515 (patch)
tree256ce0139a220e2847a8fd4b683888496d5c42f6 /src/main/java/com/google/devtools/build/lib/skyframe/PackageFunction.java
parent4fdd776a8177efd52fbdfc4e3a03ee498e4891ad (diff)
Skylark: enable relative paths in load statements. Only paths with 1 segment are treated as relative paths.
Obsolete tests are removed from ASTFileLookupFunctionTest. -- MOS_MIGRATED_REVID=85885578
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/skyframe/PackageFunction.java')
-rw-r--r--src/main/java/com/google/devtools/build/lib/skyframe/PackageFunction.java13
1 files changed, 8 insertions, 5 deletions
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 2404b99436..c10608166c 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
@@ -386,8 +386,9 @@ public class PackageFunction implements SkyFunction {
return getExternalPackage(env, packageLookupValue.getRoot());
}
+ PathFragment buildFileFragment = packageNameFragment.getChild("BUILD");
RootedPath buildFileRootedPath = RootedPath.toRootedPath(packageLookupValue.getRoot(),
- packageNameFragment.getChild("BUILD"));
+ buildFileFragment);
FileValue buildFileValue;
try {
buildFileValue = (FileValue) env.getValueOrThrow(FileValue.key(buildFileRootedPath),
@@ -455,8 +456,8 @@ public class PackageFunction implements SkyFunction {
throw new PackageFunctionException(new BuildFileContainsErrorsException(
packageName, e.getMessage()), Transience.TRANSIENT);
}
- SkylarkImportResult importResult = fetchImportsFromBuildFile(
- buildFilePath, packageId.getRepository(), preludeStatements, inputSource, packageName, env);
+ SkylarkImportResult importResult = fetchImportsFromBuildFile(buildFilePath, buildFileFragment,
+ packageId.getRepository(), preludeStatements, inputSource, packageName, env);
if (importResult == null) {
return null;
}
@@ -506,7 +507,8 @@ public class PackageFunction implements SkyFunction {
return new PackageValue(pkg);
}
- private SkylarkImportResult fetchImportsFromBuildFile(Path buildFilePath, RepositoryName repo,
+ private SkylarkImportResult fetchImportsFromBuildFile(Path buildFilePath,
+ PathFragment buildFileFragment, RepositoryName repo,
List<Statement> preludeStatements, ParserInputSource inputSource,
String packageName, Environment env) throws PackageFunctionException {
StoredEventHandler eventHandler = new StoredEventHandler();
@@ -527,7 +529,8 @@ public class PackageFunction implements SkyFunction {
ImmutableList.Builder<SkylarkFileDependency> fileDependencies = ImmutableList.builder();
try {
for (PathFragment importFile : imports) {
- SkyKey importsLookupKey = SkylarkImportLookupValue.key(repo, importFile);
+ SkyKey importsLookupKey =
+ SkylarkImportLookupValue.key(repo, buildFileFragment, importFile);
SkylarkImportLookupValue importLookupValue = (SkylarkImportLookupValue)
env.getValueOrThrow(importsLookupKey, SkylarkImportFailedException.class,
InconsistentFilesystemException.class, ASTLookupInputException.class,