summaryrefslogtreecommitdiff
path: root/java/java_test.go
diff options
context:
space:
mode:
author Jihoon Kang <jihoonkang@google.com> 2023-07-01 00:13:47 +0000
committer Jihoon Kang <jihoonkang@google.com> 2023-07-14 21:41:46 +0000
commit1bfb6f231ea98d9ec59a759cf5bb85b250133bc1 (patch)
treeee8a8bfcb6226079d6af53104958c569359812c2 /java/java_test.go
parentc38523cd3320cca41f82d664f79a1ae149902465 (diff)
Fix stem to be propagated to output jar name in java_library
Currently, java_library.stem property is not correctly reflected in the output jar name in java_library when the module specifies java_resource_dirs property. This change fixes the unexpected behavior so that setting the stem property behaves as expected. Test: go test ./java && m Bug: 285843207 Change-Id: I0941fcea83c92f4c42ae415aa6ad9125da5cf57b
Diffstat (limited to 'java/java_test.go')
-rw-r--r--java/java_test.go19
1 files changed, 19 insertions, 0 deletions
diff --git a/java/java_test.go b/java/java_test.go
index 473830464..dd9867704 100644
--- a/java/java_test.go
+++ b/java/java_test.go
@@ -2351,3 +2351,22 @@ func TestJavaExcludeStaticLib(t *testing.T) {
`stable.core.platform.api.stubs`,
})
}
+
+func TestJavaLibraryWithResourcesStem(t *testing.T) {
+ ctx, _ := testJavaWithFS(t, `
+ java_library {
+ name: "foo",
+ java_resource_dirs: ["test-jar"],
+ stem: "test",
+ }
+ `,
+ map[string][]byte{
+ "test-jar/test/resource.txt": nil,
+ })
+
+ m := ctx.ModuleForTests("foo", "android_common")
+ outputs := fmt.Sprint(m.AllOutputs())
+ if !strings.Contains(outputs, "test.jar") {
+ t.Errorf("Module output does not contain expected jar %s", "test.jar")
+ }
+}