summaryrefslogtreecommitdiff
path: root/java/java_test.go
diff options
context:
space:
mode:
author Jihoon Kang <jihoonkang@google.com> 2023-03-14 01:09:34 +0000
committer Jihoon Kang <jihoonkang@google.com> 2023-04-03 17:53:40 +0000
commit01e522cac580f0cbbaf046a8afec70df8de44fce (patch)
treeeed702e44b028ed0e6fd9a00b04a9d30729e5ede /java/java_test.go
parent53424820436db086374458e994a10a3b3d2ce772 (diff)
Add dep_api_srcs property to java_api_library module
Users can pass the jar-file creating module via dep_api_srcs property in java_api_library to create the jar file not by compiling the stubs generated from metalava but by extracting and zipping the class files from the jar file of the input module. Test: m android-non-updatable.stubs.from-text Bug: 273381329 Change-Id: Id1b75179111cc7ff45faaff58388db1347bb18e5
Diffstat (limited to 'java/java_test.go')
-rw-r--r--java/java_test.go44
1 files changed, 44 insertions, 0 deletions
diff --git a/java/java_test.go b/java/java_test.go
index 68b749b6d..553b762ee 100644
--- a/java/java_test.go
+++ b/java/java_test.go
@@ -2209,6 +2209,50 @@ func TestJavaApiLibraryStaticLibsLink(t *testing.T) {
}
}
+func TestJavaApiLibraryDepApiSrcs(t *testing.T) {
+ provider_bp_a := `
+ java_api_contribution {
+ name: "foo1",
+ api_file: "foo1.txt",
+ }
+ `
+ provider_bp_b := `
+ java_api_contribution {
+ name: "foo2",
+ api_file: "foo2.txt",
+ }
+ `
+ lib_bp_a := `
+ java_api_library {
+ name: "lib1",
+ api_surface: "public",
+ api_contributions: ["foo1", "foo2"],
+ }
+ `
+
+ ctx, _ := testJavaWithFS(t, `
+ java_api_library {
+ name: "bar1",
+ api_surface: "public",
+ api_contributions: ["foo1"],
+ dep_api_srcs: "lib1",
+ }
+ `,
+ map[string][]byte{
+ "a/Android.bp": []byte(provider_bp_a),
+ "b/Android.bp": []byte(provider_bp_b),
+ "c/Android.bp": []byte(lib_bp_a),
+ })
+
+ m := ctx.ModuleForTests("bar1", "android_common")
+ manifest := m.Output("metalava.sbox.textproto")
+ sboxProto := android.RuleBuilderSboxProtoForTests(t, manifest)
+ manifestCommand := sboxProto.Commands[0].GetCommand()
+
+ android.AssertStringDoesContain(t, "Command expected to contain module srcjar file", manifestCommand, "bar1-stubs.srcjar")
+ android.AssertStringDoesContain(t, "Command expected to contain output files list text file flag", manifestCommand, "--out __SBOX_SANDBOX_DIR__/out/sources.txt")
+}
+
func TestTradefedOptions(t *testing.T) {
result := PrepareForTestWithJavaBuildComponents.RunTestWithBp(t, `
java_test_host {