diff options
author | 2017-11-03 09:27:53 -0400 | |
---|---|---|
committer | 2017-11-03 09:53:35 -0400 | |
commit | cff0dc94f6a8e16492adf54c88d0b26abe903d4c (patch) | |
tree | f213d88608b5887b52ad937a3e95a4fbe11b6e4c /src/test/java/com/google/devtools/build/lib/analysis/LocationExpanderTest.java | |
parent | f75eadeadc98f5b4cea6fd36f149bf96e2240996 (diff) |
Add rootpath(s) and execpath(s) functions to template expansion
In addition to the $(location) function, we now also support $(rootpath) and
$(execpath) functions.
Unfortunately, we have to do this in two places since the Skylark API for expand_location has to continue calling into LocationExpander in order to preserve its semantic contract.
Progress on #2475.
RELNOTES[NEW]:
In addition to $(location), Bazel now also supports $(rootpath) to obtain
the root-relative path (i.e., for runfiles locations), and $(execpath) to
obtain the exec path (i.e., for build-time locations)
PiperOrigin-RevId: 174454119
Diffstat (limited to 'src/test/java/com/google/devtools/build/lib/analysis/LocationExpanderTest.java')
-rw-r--r-- | src/test/java/com/google/devtools/build/lib/analysis/LocationExpanderTest.java | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/test/java/com/google/devtools/build/lib/analysis/LocationExpanderTest.java b/src/test/java/com/google/devtools/build/lib/analysis/LocationExpanderTest.java index 7fe406660d..f49cf5901a 100644 --- a/src/test/java/com/google/devtools/build/lib/analysis/LocationExpanderTest.java +++ b/src/test/java/com/google/devtools/build/lib/analysis/LocationExpanderTest.java @@ -16,10 +16,12 @@ package com.google.devtools.build.lib.analysis; import static com.google.common.truth.Truth.assertThat; +import com.google.common.collect.ImmutableMap; import com.google.devtools.build.lib.packages.AbstractRuleErrorConsumer; import com.google.devtools.build.lib.packages.RuleErrorConsumer; import java.util.ArrayList; import java.util.List; +import java.util.function.Function; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.JUnit4; @@ -60,8 +62,9 @@ public class LocationExpanderTest { private LocationExpander makeExpander(RuleErrorConsumer ruleErrorConsumer) throws Exception { return new LocationExpander( ruleErrorConsumer, - (String s) -> "one(" + s + ")", - (String s) -> "more(" + s + ")"); + ImmutableMap.<String, Function<String, String>>of( + "location", (String s) -> "one(" + s + ")", + "locations", (String s) -> "more(" + s + ")")); } private String expand(String input) throws Exception { |