aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/test/java/com/google/devtools/build/lib/analysis
diff options
context:
space:
mode:
authorGravatar ajmichael <ajmichael@google.com>2017-05-31 22:34:34 +0200
committerGravatar László Csomor <laszlocsomor@google.com>2017-06-01 14:08:29 +0200
commit22d05ebc9f4ce3194233e7dfd12bf079ce88ee07 (patch)
treeeb75d09cc0662bfd744bd76d25b533c57df0e5d5 /src/test/java/com/google/devtools/build/lib/analysis
parent7fa955b83d86d8f03d339c58446806b6e0e51bf1 (diff)
Add //external:has_androidsdk config_setting.
This will be used to add some tests and targets to the Bazel codebase that build and run successfully when android_sdk_repository is in the WORKSPACE and silently skip if it is not. Example deps of a library that links against dx.jar: ``` deps = select({ "//external:has_androidsdk": ["//external:android/dx_jar_import"], "//conditions:default": [], }), ``` Also adds tests that config_setting works as expected when propagated through an alias or bind rule. RELNOTES: None PiperOrigin-RevId: 157627472
Diffstat (limited to 'src/test/java/com/google/devtools/build/lib/analysis')
-rw-r--r--src/test/java/com/google/devtools/build/lib/analysis/ConfiguredAttributeMapperTest.java22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/test/java/com/google/devtools/build/lib/analysis/ConfiguredAttributeMapperTest.java b/src/test/java/com/google/devtools/build/lib/analysis/ConfiguredAttributeMapperTest.java
index bff9d57b0e..72bef74866 100644
--- a/src/test/java/com/google/devtools/build/lib/analysis/ConfiguredAttributeMapperTest.java
+++ b/src/test/java/com/google/devtools/build/lib/analysis/ConfiguredAttributeMapperTest.java
@@ -265,4 +265,26 @@ public class ConfiguredAttributeMapperTest extends BuildViewTestCase {
assertThat(getMapper("//a:lib").isAttributeValueExplicitlySpecified("linkstamp")).isFalse();
assertThat(getMapper("//a:lib").get("linkstamp", BuildType.LABEL)).isNull();
}
+
+ @Test
+ public void testAliasedConfigSetting() throws Exception {
+ writeConfigRules();
+ scratch.file(
+ "a/BUILD",
+ "alias(",
+ " name = 'aliased_a',",
+ " actual = '//conditions:a',",
+ ")",
+ "genrule(",
+ " name = 'gen',",
+ " srcs = [],",
+ " outs = ['out'],",
+ " cmd = '',",
+ " message = select({",
+ " ':aliased_a': 'defined message',",
+ " '//conditions:default': None,",
+ " }))");
+ useConfiguration("--define", "mode=a");
+ assertThat(getMapper("//a:gen").get("message", Type.STRING)).isEqualTo("defined message");
+ }
}