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());
}
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();
}
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");
}
Aggregations