Search in sources :

Example 26 with CustomCommandLine

use of com.google.devtools.build.lib.analysis.actions.CustomCommandLine in project bazel by bazelbuild.

the class CustomCommandLineTest method testJoinPathArgs.

@Test
public void testJoinPathArgs() {
    CustomCommandLine cl = CustomCommandLine.builder().addJoinPaths(":", ImmutableList.of(artifact1.getExecPath(), artifact2.getExecPath())).build();
    assertEquals(ImmutableList.of("dir/file1.txt:dir/file2.txt"), cl.arguments());
}
Also used : CustomCommandLine(com.google.devtools.build.lib.analysis.actions.CustomCommandLine) Test(org.junit.Test)

Example 27 with CustomCommandLine

use of com.google.devtools.build.lib.analysis.actions.CustomCommandLine in project bazel by bazelbuild.

the class CustomCommandLineTest method testTreeFileArtifactExecPathArgs.

@Test
public void testTreeFileArtifactExecPathArgs() {
    Artifact treeArtifactOne = createTreeArtifact("myArtifact/treeArtifact1");
    Artifact treeArtifactTwo = createTreeArtifact("myArtifact/treeArtifact2");
    CustomCommandLine commandLineTemplate = CustomCommandLine.builder().addPlaceholderTreeArtifactExecPath("--argOne", treeArtifactOne).addPlaceholderTreeArtifactExecPath("--argTwo", treeArtifactTwo).build();
    TreeFileArtifact treeFileArtifactOne = createTreeFileArtifact(treeArtifactOne, "children/child1");
    TreeFileArtifact treeFileArtifactTwo = createTreeFileArtifact(treeArtifactTwo, "children/child2");
    CustomCommandLine commandLine = commandLineTemplate.evaluateTreeFileArtifacts(ImmutableList.of(treeFileArtifactOne, treeFileArtifactTwo));
    assertThat(commandLine.arguments()).containsExactly("--argOne", "myArtifact/treeArtifact1/children/child1", "--argTwo", "myArtifact/treeArtifact2/children/child2").inOrder();
}
Also used : TreeFileArtifact(com.google.devtools.build.lib.actions.Artifact.TreeFileArtifact) CustomCommandLine(com.google.devtools.build.lib.analysis.actions.CustomCommandLine) SpecialArtifact(com.google.devtools.build.lib.actions.Artifact.SpecialArtifact) TreeFileArtifact(com.google.devtools.build.lib.actions.Artifact.TreeFileArtifact) Test(org.junit.Test)

Example 28 with CustomCommandLine

use of com.google.devtools.build.lib.analysis.actions.CustomCommandLine in project bazel by bazelbuild.

the class ProtoCompileActionBuilderTest method otherParameters.

@Test
public void otherParameters() throws Exception {
    SupportData supportData = SupportData.create(Predicates.<TransitiveInfoCollection>alwaysFalse(), ImmutableList.<Artifact>of(), NestedSetBuilder.<Artifact>emptySet(STABLE_ORDER), /* protosInDirectDeps */
    NestedSetBuilder.<Artifact>emptySet(STABLE_ORDER), true);
    CustomCommandLine cmdLine = createCommandLineFromToolchains(ImmutableList.<ToolchainInvocation>of(), supportData.getDirectProtoSources(), supportData.getTransitiveImports(), supportData.getProtosInDirectDeps(), "//foo:bar", false, /* allowServices */
    ImmutableList.of("--foo", "--bar"));
    assertThat(cmdLine.arguments()).containsAllOf("--disallow_services", "--foo", "--bar");
}
Also used : CustomCommandLine(com.google.devtools.build.lib.analysis.actions.CustomCommandLine) Test(org.junit.Test)

Aggregations

CustomCommandLine (com.google.devtools.build.lib.analysis.actions.CustomCommandLine)28 Test (org.junit.Test)22 Artifact (com.google.devtools.build.lib.actions.Artifact)6 TreeFileArtifact (com.google.devtools.build.lib.actions.Artifact.TreeFileArtifact)5 SpecialArtifact (com.google.devtools.build.lib.actions.Artifact.SpecialArtifact)3 TransitiveInfoCollection (com.google.devtools.build.lib.analysis.TransitiveInfoCollection)3 ParameterFileWriteAction (com.google.devtools.build.lib.analysis.actions.ParameterFileWriteAction)3 ToolchainInvocation (com.google.devtools.build.lib.rules.proto.ProtoCompileActionBuilder.ToolchainInvocation)3 SpawnAction (com.google.devtools.build.lib.analysis.actions.SpawnAction)2 LazyString (com.google.devtools.build.lib.util.LazyString)2 VisibleForTesting (com.google.common.annotations.VisibleForTesting)1 FilesToRunProvider (com.google.devtools.build.lib.analysis.FilesToRunProvider)1 CustomArgv (com.google.devtools.build.lib.analysis.actions.CustomCommandLine.CustomArgv)1 CustomMultiArgv (com.google.devtools.build.lib.analysis.actions.CustomCommandLine.CustomMultiArgv)1 NestedSetBuilder (com.google.devtools.build.lib.collect.nestedset.NestedSetBuilder)1 AppleConfiguration (com.google.devtools.build.lib.rules.apple.AppleConfiguration)1 Platform (com.google.devtools.build.lib.rules.apple.Platform)1 DotdFile (com.google.devtools.build.lib.rules.cpp.CppCompileAction.DotdFile)1 PathFragment (com.google.devtools.build.lib.vfs.PathFragment)1 HashSet (java.util.HashSet)1