summaryrefslogtreecommitdiff
path: root/java/java_test.go
diff options
context:
space:
mode:
author yangbill <yangbill@google.com> 2024-03-15 09:29:29 +0000
committer yangbill <yangbill@google.com> 2024-03-19 09:11:59 +0000
commit2af0b6edd70d2c92e10fc862ced000fe8068a804 (patch)
tree7a5964994cdcb426adb7866055b6191f74b2c201 /java/java_test.go
parent08bef285d826625bc73e67a0d40bdf3479aeb034 (diff)
Change java stem attribute for both device and host
Bug: 329762127 Test: cd build/soong/java ; go test -run TestJavaLibHostWithStem Test: cd build/soong/java ; go test -run TestAppStem Test: cd build/soong/java ; go test -run TestAndroidAppImport_ArchVariants Test: cd build/soong/java ; go test -run TestOverrideAndroidAppStem Test: cd build/soong/java ; go test -run TestOverrideAndroidApp Test: cd build/soong/java ; go test -run TestPackageNameOverride Change-Id: I8fbdc82116f9a0c68121fbbeb1ef4f78f2b6fea3
Diffstat (limited to 'java/java_test.go')
-rw-r--r--java/java_test.go35
1 files changed, 35 insertions, 0 deletions
diff --git a/java/java_test.go b/java/java_test.go
index 2f3ccb98d..05c715cd7 100644
--- a/java/java_test.go
+++ b/java/java_test.go
@@ -2693,3 +2693,38 @@ func TestApiLibraryAconfigDeclarations(t *testing.T) {
cmdline := String(android.RuleBuilderSboxProtoForTests(t, result.TestContext, manifest).Commands[0].Command)
android.AssertStringDoesContain(t, "flagged api hide command not included", cmdline, "revert-annotations-exportable.txt")
}
+
+func TestJavaLibHostWithStem(t *testing.T) {
+ ctx, _ := testJava(t, `
+ java_library_host {
+ name: "foo",
+ srcs: ["a.java"],
+ stem: "foo-new",
+ }
+ `)
+
+ buildOS := ctx.Config().BuildOS.String()
+ foo := ctx.ModuleForTests("foo", buildOS+"_common")
+
+ outputs := fmt.Sprint(foo.AllOutputs())
+ if !strings.Contains(outputs, "foo-new.jar") {
+ t.Errorf("Module output does not contain expected jar %s", "foo-new.jar")
+ }
+}
+
+func TestJavaLibWithStem(t *testing.T) {
+ ctx, _ := testJava(t, `
+ java_library {
+ name: "foo",
+ srcs: ["a.java"],
+ stem: "foo-new",
+ }
+ `)
+
+ foo := ctx.ModuleForTests("foo", "android_common")
+
+ outputs := fmt.Sprint(foo.AllOutputs())
+ if !strings.Contains(outputs, "foo-new.jar") {
+ t.Errorf("Module output does not contain expected jar %s", "foo-new.jar")
+ }
+}