use of com.google.devtools.build.lib.analysis.RunfilesSupplierImpl in project bazel by bazelbuild.
the class LTOBackendActionTest method testComputeKey.
@Test
public void testComputeKey() throws Exception {
final Artifact artifactA = getSourceArtifact("a");
final Artifact artifactB = getSourceArtifact("b");
final Artifact artifactAimports = getSourceArtifact("a.imports");
final Artifact artifactBimports = getSourceArtifact("b.imports");
ActionTester.runTest(64, new ActionCombinationFactory() {
@Override
public Action generate(int i) {
LTOBackendAction.Builder builder = new LTOBackendAction.Builder();
builder.addOutput(destinationArtifact);
PathFragment executable = (i & 1) == 0 ? artifactA.getExecPath() : artifactB.getExecPath();
builder.setExecutable(executable);
if ((i & 2) == 0) {
builder.addImportsInfo(new HashMap<PathFragment, Artifact>(), artifactAimports);
} else {
builder.addImportsInfo(new HashMap<PathFragment, Artifact>(), artifactBimports);
}
builder.setMnemonic((i & 4) == 0 ? "a" : "b");
if ((i & 8) == 0) {
builder.addRunfilesSupplier(new RunfilesSupplierImpl(new PathFragment("a"), Runfiles.EMPTY, artifactA));
} else {
builder.addRunfilesSupplier(new RunfilesSupplierImpl(new PathFragment("a"), Runfiles.EMPTY, artifactB));
}
if ((i & 16) == 0) {
builder.addInput(artifactA);
} else {
builder.addInput(artifactB);
}
Map<String, String> env = new HashMap<>();
if ((i & 32) == 0) {
env.put("foo", "bar");
}
builder.setEnvironment(env);
Action[] actions = builder.build(ActionsTestUtil.NULL_ACTION_OWNER, collectingAnalysisEnvironment, targetConfig);
collectingAnalysisEnvironment.registerAction(actions);
return actions[0];
}
});
}
use of com.google.devtools.build.lib.analysis.RunfilesSupplierImpl in project bazel by bazelbuild.
the class SpawnActionTest method testInputManifestsRemovedIfSupplied.
@Test
public void testInputManifestsRemovedIfSupplied() throws Exception {
Artifact manifest = getSourceArtifact("MANIFEST");
Action[] actions = builder().addInput(manifest).addRunfilesSupplier(new RunfilesSupplierImpl(new PathFragment("/destination/"), Runfiles.EMPTY, manifest)).addOutput(getBinArtifactWithNoOwner("output")).setExecutable(scratch.file("/bin/xxx").asFragment()).setProgressMessage("Test").build(ActionsTestUtil.NULL_ACTION_OWNER, collectingAnalysisEnvironment, targetConfig);
collectingAnalysisEnvironment.registerAction(actions);
SpawnAction action = (SpawnAction) actions[0];
List<String> inputFiles = actionInputsToPaths(action.getSpawn().getInputFiles());
assertThat(inputFiles).isEmpty();
}
Aggregations