aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar tomlu <tomlu@google.com>2018-01-11 14:20:28 -0800
committerGravatar Copybara-Service <copybara-piper@google.com>2018-01-11 14:22:22 -0800
commit3328197af12f18a9d51059ef5d54e6c11c13d4f9 (patch)
tree2d509be6045dd37b2bfb46e560a85c080289a8ad
parent573807d4e9d1b7a8b6956278773dfc53b544093f (diff)
Simplify SkylarkRuleContext#getBuildFileRelativePath.
We don't need to construct roots to relativize a path. PiperOrigin-RevId: 181661592
-rw-r--r--src/main/java/com/google/devtools/build/lib/analysis/skylark/SkylarkRuleContext.java4
1 files changed, 1 insertions, 3 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/analysis/skylark/SkylarkRuleContext.java b/src/main/java/com/google/devtools/build/lib/analysis/skylark/SkylarkRuleContext.java
index 8ce345fc7b..3dbb8d9f42 100644
--- a/src/main/java/com/google/devtools/build/lib/analysis/skylark/SkylarkRuleContext.java
+++ b/src/main/java/com/google/devtools/build/lib/analysis/skylark/SkylarkRuleContext.java
@@ -1001,8 +1001,6 @@ public final class SkylarkRuleContext implements SkylarkValue {
public String getBuildFileRelativePath() throws EvalException {
checkMutable("build_file_path");
Package pkg = ruleContext.getRule().getPackage();
- Root root = Root.asSourceRoot(pkg.getSourceRoot(),
- pkg.getPackageIdentifier().getRepository().isMain());
- return pkg.getBuildFile().getPath().relativeTo(root.getPath()).getPathString();
+ return pkg.getBuildFile().getPath().relativeTo(pkg.getSourceRoot()).getPathString();
}
}