summaryrefslogtreecommitdiff
path: root/java/java_test.go
diff options
context:
space:
mode:
author Treehugger Robot <android-test-infra-autosubmit@system.gserviceaccount.com> 2024-03-20 01:05:50 +0000
committer Gerrit Code Review <noreply-gerritcodereview@google.com> 2024-03-20 01:05:50 +0000
commit064b1453658a76b9bd63a9a7f1918723bd6f467a (patch)
tree14726e276524e4732fd7a0aae69ac498ad6ec49c /java/java_test.go
parentac45b4bc6377b9082b11507020be903345e59f5a (diff)
parent2af0b6edd70d2c92e10fc862ced000fe8068a804 (diff)
Merge "Change java stem attribute for both device and host" into main
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 9a4f085a3..194f9d974 100644
--- a/java/java_test.go
+++ b/java/java_test.go
@@ -2757,3 +2757,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")
+ }
+}