Migrate the `testResourceStripPrefix` test to Starlark The test is removed from Bazel and added to rules_java (ignore-relnotes) PiperOrigin-RevId: 906200503 Change-Id: I2feea71ecbe4b2741a00a32503d10dc63d181eb9
diff --git a/test/java/bazel/rules/java_binary_tests.bzl b/test/java/bazel/rules/java_binary_tests.bzl index 737acea..8c38504 100644 --- a/test/java/bazel/rules/java_binary_tests.bzl +++ b/test/java/bazel/rules/java_binary_tests.bzl
@@ -97,6 +97,27 @@ "-XepOpt:foo={package}/A.java", ) +def _test_java_binary_resource_strip_prefix(name): + util.helper_target( + java_binary, + name = name + "/bin", + srcs = ["Foo.java"], + main_class = "Foo", + resource_strip_prefix = native.package_name() + "/path/to/strip", + resources = ["path/to/strip/bar.props"], + ) + + analysis_test( + name = name, + impl = _test_java_binary_resource_strip_prefix_impl, + target = name + "/bin", + ) + +def _test_java_binary_resource_strip_prefix_impl(env, target): + env.expect.that_target(target).action_generating("{package}/{name}.jar").contains_flag_values([ + ("--resources", "{package}/path/to/strip/bar.props:bar.props"), + ]) + def java_binary_tests(name): test_suite( name = name, @@ -104,5 +125,6 @@ _test_java_binary_cross_compilation_to_unix, _test_java_binary_javacopts_make_variable_expansion, _test_java_binary_javacopts_location_expansion, + _test_java_binary_resource_strip_prefix, ], )