From 2af0b6edd70d2c92e10fc862ced000fe8068a804 Mon Sep 17 00:00:00 2001 From: yangbill Date: Fri, 15 Mar 2024 09:29:29 +0000 Subject: 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 --- java/java_test.go | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) (limited to 'java/java_test.go') 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") + } +} -- cgit v1.2.3-59-g8ed1b