From a2ae7e03587147be192d1e88f9dcdce894e5baa7 Mon Sep 17 00:00:00 2001 From: Paul Duffin Date: Fri, 11 Sep 2020 11:55:00 +0100 Subject: 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 --- sdk/java_sdk_test.go | 70 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) (limited to 'sdk/java_sdk_test.go') 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 +`), + ) +} -- cgit v1.2.3-59-g8ed1b