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
This commit is contained in:
yangbill
2024-03-15 09:29:29 +00:00
parent 08bef285d8
commit 2af0b6edd7
6 changed files with 63 additions and 11 deletions

View File

@@ -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")
}
}