use of com.google.copybara.transform.ExplicitReversal in project copybara by google.
the class BuildozerModifyTest method testKeepGoing.
/**
* Here we test that if we join buildozer transformations, we use buildozer -k, so that it
* keeps going if one of them fails to find a target. Otherwise the effect of bundling many
* buildozer transformations will be visible to our users when using --ignore-noop
*/
@Test
public void testKeepGoing() throws Exception {
// Explicit just in case default changes
options.workflowOptions.noTransformationJoin = false;
options.workflowOptions.ignoreNoop = true;
ExplicitReversal modify = skylark.eval("m", "m = " + "core.transform([\n" + " buildozer.modify(\n" + " target = ['foo/bar:idontexist'],\n" + " commands = [ buildozer.cmd('set config \"test\"')],\n" + " ),\n" + " buildozer.modify(\n" + " target = ['foo/bar:*'],\n" + " commands = [ buildozer.cmd('set other \"test\"')],\n" + " ),\n" + " ], reversal = [])");
Files.createDirectories(checkoutDir.resolve("foo/bar"));
String original = "proto_library(name = 'baz')\n";
Files.write(checkoutDir.resolve("foo/bar/BUILD"), original.getBytes(UTF_8));
transform(modify);
assertThatPath(checkoutDir).containsFile("foo/bar/BUILD", "" + "proto_library(\n" + " name = \"baz\",\n" + " other = \"test\",\n" + ")\n");
}
Aggregations