diff options
author | dannark <dannark@google.com> | 2018-06-21 17:46:06 -0700 |
---|---|---|
committer | Copybara-Service <copybara-piper@google.com> | 2018-06-21 17:48:01 -0700 |
commit | a8d7357b7dc66e0531c298e4d369e6342fcf94b7 (patch) | |
tree | a2ed8c5ee313d2113ac562a1ed57b5580683b108 /src/main/java/com/google/devtools/build/lib/syntax | |
parent | db461d0e8a15aff0c4af219fd4a7a5b668ab1289 (diff) |
Audit usages of Label.getRelative and update to Label.getRelativeWithRemapping
RELNOTES: None
PiperOrigin-RevId: 201617188
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/syntax')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/syntax/SkylarkImports.java | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/syntax/SkylarkImports.java b/src/main/java/com/google/devtools/build/lib/syntax/SkylarkImports.java index 6cedeed40a..36c5ae4166 100644 --- a/src/main/java/com/google/devtools/build/lib/syntax/SkylarkImports.java +++ b/src/main/java/com/google/devtools/build/lib/syntax/SkylarkImports.java @@ -142,7 +142,9 @@ public class SkylarkImports { PathFragment.create(containingFileLabel.getName()).getParentDirectory(); String targetNameForImport = containingDirInPkg.getRelative(importFile).toString(); try { - return containingFileLabel.getRelative(targetNameForImport); + // This is for imports relative to the current repository, so repositoryMapping can be + // empty + return containingFileLabel.getRelativeWithRemapping(targetNameForImport, ImmutableMap.of()); } catch (LabelSyntaxException e) { // Shouldn't happen because the parent label is assumed to be valid and the target string is // validated on construction. @@ -198,7 +200,9 @@ public class SkylarkImports { // Unlike a relative path import, the import target is relative to the containing package, // not the containing directory within the package. try { - return containingFileLabel.getRelative(importTarget); + // This is for imports relative to the current repository, so repositoryMapping can be + // empty + return containingFileLabel.getRelativeWithRemapping(importTarget, ImmutableMap.of()); } catch (LabelSyntaxException e) { // shouldn't happen because the parent label is assumed validated and the target string is // validated on construction |