use of com.google.devtools.build.lib.analysis.ConfiguredTarget in project bazel by bazelbuild.
the class GenRuleConfiguredTargetTest method testGetExecutableForNonExecutableOut.
@Test
public void testGetExecutableForNonExecutableOut() throws Exception {
ConfiguredTarget turtle = scratchConfiguredTarget("java/com/google/turtle", "turtle_bootstrap", "genrule(name = 'turtle_bootstrap',", " srcs = ['Turtle.java'],", " outs = ['debugdata.txt'],", " cmd = 'touch $(OUTS)')");
assertNull(getExecutable(turtle));
}
use of com.google.devtools.build.lib.analysis.ConfiguredTarget in project bazel by bazelbuild.
the class AliasTest method smoke.
@Test
public void smoke() throws Exception {
scratch.file("a/BUILD", "cc_library(name='a', srcs=['a.cc'])", "alias(name='b', actual='a')");
ConfiguredTarget b = getConfiguredTarget("//a:b");
assertThat(b.getProvider(CppCompilationContext.class)).isNotNull();
}
use of com.google.devtools.build.lib.analysis.ConfiguredTarget in project bazel by bazelbuild.
the class AliasTest method aliasedFile.
@Test
public void aliasedFile() throws Exception {
scratch.file("a/BUILD", "exports_files(['a'])", "alias(name='b', actual='a')", "filegroup(name='c', srcs=[':b'])");
ConfiguredTarget c = getConfiguredTarget("//a:c");
assertThat(ActionsTestUtil.baseArtifactNames(c.getProvider(FileProvider.class).getFilesToBuild())).containsExactly("a");
}
use of com.google.devtools.build.lib.analysis.ConfiguredTarget in project bazel by bazelbuild.
the class ToolchainLookupTest method testSmoke.
@Test
public void testSmoke() throws Exception {
ConfiguredTarget cc = getConfiguredTarget(getRuleClassProvider().getToolsRepository() + "//tools/cpp:lookup");
assertThat(cc.getProvider(ToolchainProvider.class).getMakeVariables()).containsKey("TARGET_CPU");
}
use of com.google.devtools.build.lib.analysis.ConfiguredTarget in project bazel by bazelbuild.
the class AndroidSkylarkSplitTransitionTest method testAndroidSplitTransitionWithAndroidCpu.
@Test
public void testAndroidSplitTransitionWithAndroidCpu() throws Exception {
writeAndroidSplitTransitionTestFiles();
BazelMockAndroidSupport.setupNdk(mockToolsConfig);
// --android_cpu with --android_crosstool_top also triggers the split transition.
useConfiguration("--android_cpu=armeabi-v7a", "--android_crosstool_top=//android/crosstool:everything");
ConfiguredTarget target = getConfiguredTarget("//test/skylark:test");
@SuppressWarnings("unchecked") Map<Object, List<ConfiguredTarget>> splitDeps = (Map<Object, List<ConfiguredTarget>>) target.get("split_attr_deps");
String cpu = "armeabi-v7a";
assertThat(splitDeps.get(cpu)).hasSize(2);
assertThat(splitDeps.get(cpu).get(0).getConfiguration().getCpu()).isEqualTo(cpu);
assertThat(splitDeps.get(cpu).get(1).getConfiguration().getCpu()).isEqualTo(cpu);
}
Aggregations