Search in sources :

Example 46 with ConfiguredTarget

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));
}
Also used : ConfiguredTarget(com.google.devtools.build.lib.analysis.ConfiguredTarget) FileConfiguredTarget(com.google.devtools.build.lib.analysis.FileConfiguredTarget) Test(org.junit.Test)

Example 47 with ConfiguredTarget

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();
}
Also used : ConfiguredTarget(com.google.devtools.build.lib.analysis.ConfiguredTarget) Test(org.junit.Test)

Example 48 with ConfiguredTarget

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");
}
Also used : ConfiguredTarget(com.google.devtools.build.lib.analysis.ConfiguredTarget) Test(org.junit.Test)

Example 49 with ConfiguredTarget

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");
}
Also used : ConfiguredTarget(com.google.devtools.build.lib.analysis.ConfiguredTarget) Test(org.junit.Test)

Example 50 with ConfiguredTarget

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);
}
Also used : ConfiguredTarget(com.google.devtools.build.lib.analysis.ConfiguredTarget) List(java.util.List) Map(java.util.Map) Test(org.junit.Test)

Aggregations

ConfiguredTarget (com.google.devtools.build.lib.analysis.ConfiguredTarget)222 Test (org.junit.Test)178 Artifact (com.google.devtools.build.lib.actions.Artifact)51 FileConfiguredTarget (com.google.devtools.build.lib.analysis.FileConfiguredTarget)41 RuleConfiguredTarget (com.google.devtools.build.lib.analysis.RuleConfiguredTarget)25 Label (com.google.devtools.build.lib.cmdline.Label)17 SkylarkProviders (com.google.devtools.build.lib.analysis.SkylarkProviders)15 BuildConfiguration (com.google.devtools.build.lib.analysis.config.BuildConfiguration)13 AnalysisResult (com.google.devtools.build.lib.analysis.BuildView.AnalysisResult)12 Nullable (javax.annotation.Nullable)10 SkylarkClassObject (com.google.devtools.build.lib.packages.SkylarkClassObject)9 Variables (com.google.devtools.build.lib.rules.cpp.CcToolchainFeatures.Variables)9 MergedConfiguredTarget (com.google.devtools.build.lib.analysis.MergedConfiguredTarget)7 Map (java.util.Map)7 OutputGroupProvider (com.google.devtools.build.lib.analysis.OutputGroupProvider)6 TestAspects (com.google.devtools.build.lib.analysis.util.TestAspects)6 Attribute (com.google.devtools.build.lib.packages.Attribute)6 RunfilesProvider (com.google.devtools.build.lib.analysis.RunfilesProvider)5 ConfigMatchingProvider (com.google.devtools.build.lib.analysis.config.ConfigMatchingProvider)5 TestFilteringCompleteEvent (com.google.devtools.build.lib.buildtool.buildevent.TestFilteringCompleteEvent)5