summaryrefslogtreecommitdiff
path: root/sdk/java_sdk_test.go
diff options
context:
space:
mode:
authorPaul Duffin <paulduffin@google.com>2020-09-11 11:55:00 +0100
committerPaul Duffin <paulduffin@google.com>2020-09-28 18:35:57 +0100
commita2ae7e03587147be192d1e88f9dcdce894e5baa7 (patch)
tree82c5abb99d77f0c03354913cfcdc5c07ffa25c3c /sdk/java_sdk_test.go
parentd124b6b4e8a3b113cb1b5a994f35ada6641f26a2 (diff)
Allow java_sdk_library to specify doctags_files
When generating Javadoc the processor needs to be given information about the doctags that are present in the source. This change allows that information to be managed with the java_sdk_library that generates the stubs source from which the Javadoc is generated. Bug: 168301990 Test: Built offline-sdk-docs with and without the change and diffed them. The only difference was the timestamp.js file. Change-Id: I4adbeb0781bc2191461fec856ffa90ea185e7434
Diffstat (limited to 'sdk/java_sdk_test.go')
-rw-r--r--sdk/java_sdk_test.go70
1 files changed, 70 insertions, 0 deletions
diff --git a/sdk/java_sdk_test.go b/sdk/java_sdk_test.go
index a7ee8d12f..23ecb6d06 100644
--- a/sdk/java_sdk_test.go
+++ b/sdk/java_sdk_test.go
@@ -43,6 +43,7 @@ func testSdkWithJava(t *testing.T, bp string) *testSdkResult {
"api/system-server-current.txt": nil,
"api/system-server-removed.txt": nil,
"build/soong/scripts/gen-java-current-api-files.sh": nil,
+ "docs/known_doctags": nil,
}
// for java_sdk_library tests
@@ -1590,3 +1591,72 @@ sdk_snapshot {
),
)
}
+
+func TestSnapshotWithJavaSdkLibrary_DoctagFiles(t *testing.T) {
+ result := testSdkWithJava(t, `
+ sdk {
+ name: "mysdk",
+ java_sdk_libs: ["myjavalib"],
+ }
+
+ java_sdk_library {
+ name: "myjavalib",
+ srcs: ["Test.java"],
+ sdk_version: "current",
+ public: {
+ enabled: true,
+ },
+ doctag_files: ["docs/known_doctags"],
+ }
+
+ filegroup {
+ name: "mygroup",
+ srcs: [":myjavalib{.doctags}"],
+ }
+ `)
+
+ result.CheckSnapshot("mysdk", "",
+ checkAndroidBpContents(`
+// This is auto-generated. DO NOT EDIT.
+
+java_sdk_library_import {
+ name: "mysdk_myjavalib@current",
+ sdk_member_name: "myjavalib",
+ shared_library: true,
+ doctag_files: ["doctags/docs/known_doctags"],
+ public: {
+ jars: ["sdk_library/public/myjavalib-stubs.jar"],
+ stub_srcs: ["sdk_library/public/myjavalib_stub_sources"],
+ current_api: "sdk_library/public/myjavalib.txt",
+ removed_api: "sdk_library/public/myjavalib-removed.txt",
+ sdk_version: "current",
+ },
+}
+
+java_sdk_library_import {
+ name: "myjavalib",
+ prefer: false,
+ shared_library: true,
+ doctag_files: ["doctags/docs/known_doctags"],
+ public: {
+ jars: ["sdk_library/public/myjavalib-stubs.jar"],
+ stub_srcs: ["sdk_library/public/myjavalib_stub_sources"],
+ current_api: "sdk_library/public/myjavalib.txt",
+ removed_api: "sdk_library/public/myjavalib-removed.txt",
+ sdk_version: "current",
+ },
+}
+
+sdk_snapshot {
+ name: "mysdk@current",
+ java_sdk_libs: ["mysdk_myjavalib@current"],
+}
+`),
+ checkAllCopyRules(`
+.intermediates/myjavalib.stubs/android_common/javac/myjavalib.stubs.jar -> sdk_library/public/myjavalib-stubs.jar
+.intermediates/myjavalib.stubs.source/android_common/myjavalib.stubs.source_api.txt -> sdk_library/public/myjavalib.txt
+.intermediates/myjavalib.stubs.source/android_common/myjavalib.stubs.source_removed.txt -> sdk_library/public/myjavalib-removed.txt
+docs/known_doctags -> doctags/docs/known_doctags
+`),
+ )
+}