Split doclava run from metalava target.
Originally when metalava sees arg: "--generate-documentation", it will
create a seperate process to invoke javadoc/dokka.
Now this is handled by our build system. Basically metalava target will
only generate a .srcjar file. Any other droiddoc target which generates
docs can depend on this metalava target.
By doing this, if multiple doc targets depending on the same metalava
sources. The metalava won't need to be re-run by multiple times which
could cause quite some timing overhead.
Test: m clean && m -j core-docs and
compare the results using md5sum between the old and new content.
also m clean && m -j core-current-stubs-gen-docs and
compare the results using md5sum between the old and new content.
Bug: b/78245848
Change-Id: If7deef0da738645efe7d3a8376ff2bb3dec92c01
diff --git a/java/androidmk.go b/java/androidmk.go
index bd88a1d..509ad94 100644
--- a/java/androidmk.go
+++ b/java/androidmk.go
@@ -319,15 +319,12 @@
Include: "$(BUILD_SYSTEM)/soong_droiddoc_prebuilt.mk",
Extra: []android.AndroidMkExtraFunc{
func(w io.Writer, outputFile android.Path) {
- if BoolDefault(ddoc.Javadoc.properties.Installable, true) {
+ if BoolDefault(ddoc.Javadoc.properties.Installable, true) && ddoc.Javadoc.docZip != nil {
fmt.Fprintln(w, "LOCAL_DROIDDOC_DOC_ZIP := ", ddoc.Javadoc.docZip.String())
}
if ddoc.Javadoc.stubsSrcJar != nil {
fmt.Fprintln(w, "LOCAL_DROIDDOC_STUBS_SRCJAR := ", ddoc.Javadoc.stubsSrcJar.String())
}
- if ddoc.annotationsZip != nil {
- fmt.Fprintln(w, "LOCAL_DROIDDOC_ANNOTATIONS_ZIP := ", ddoc.annotationsZip.String())
- }
if ddoc.checkCurrentApiTimestamp != nil {
fmt.Fprintln(w, ".PHONY:", ddoc.Name()+"-check-current-api")
fmt.Fprintln(w, ddoc.Name()+"-check-current-api:",
@@ -387,6 +384,75 @@
}
}
+func (dstubs *Droidstubs) AndroidMk() android.AndroidMkData {
+ return android.AndroidMkData{
+ Class: "JAVA_LIBRARIES",
+ OutputFile: android.OptionalPathForPath(dstubs.stubsSrcJar),
+ Include: "$(BUILD_SYSTEM)/soong_droiddoc_prebuilt.mk",
+ Extra: []android.AndroidMkExtraFunc{
+ func(w io.Writer, outputFile android.Path) {
+ if dstubs.Javadoc.stubsSrcJar != nil {
+ fmt.Fprintln(w, "LOCAL_DROIDDOC_STUBS_SRCJAR := ", dstubs.Javadoc.stubsSrcJar.String())
+ }
+ if dstubs.annotationsZip != nil {
+ fmt.Fprintln(w, "LOCAL_DROIDDOC_ANNOTATIONS_ZIP := ", dstubs.annotationsZip.String())
+ }
+ if dstubs.checkCurrentApiTimestamp != nil {
+ fmt.Fprintln(w, ".PHONY:", dstubs.Name()+"-check-current-api")
+ fmt.Fprintln(w, dstubs.Name()+"-check-current-api:",
+ dstubs.checkCurrentApiTimestamp.String())
+
+ fmt.Fprintln(w, ".PHONY: checkapi")
+ fmt.Fprintln(w, "checkapi:",
+ dstubs.checkCurrentApiTimestamp.String())
+
+ fmt.Fprintln(w, ".PHONY: droidcore")
+ fmt.Fprintln(w, "droidcore: checkapi")
+ }
+ if dstubs.updateCurrentApiTimestamp != nil {
+ fmt.Fprintln(w, ".PHONY:", dstubs.Name()+"-update-current-api")
+ fmt.Fprintln(w, dstubs.Name()+"-update-current-api:",
+ dstubs.updateCurrentApiTimestamp.String())
+
+ fmt.Fprintln(w, ".PHONY: update-api")
+ fmt.Fprintln(w, "update-api:",
+ dstubs.updateCurrentApiTimestamp.String())
+ }
+ if dstubs.checkLastReleasedApiTimestamp != nil {
+ fmt.Fprintln(w, ".PHONY:", dstubs.Name()+"-check-last-released-api")
+ fmt.Fprintln(w, dstubs.Name()+"-check-last-released-api:",
+ dstubs.checkLastReleasedApiTimestamp.String())
+ }
+ apiFilePrefix := "INTERNAL_PLATFORM_"
+ if String(dstubs.properties.Api_tag_name) != "" {
+ apiFilePrefix += String(dstubs.properties.Api_tag_name) + "_"
+ }
+ if dstubs.apiFile != nil {
+ fmt.Fprintln(w, apiFilePrefix+"API_FILE := ", dstubs.apiFile.String())
+ }
+ if dstubs.dexApiFile != nil {
+ fmt.Fprintln(w, apiFilePrefix+"DEX_API_FILE := ", dstubs.dexApiFile.String())
+ }
+ if dstubs.privateApiFile != nil {
+ fmt.Fprintln(w, apiFilePrefix+"PRIVATE_API_FILE := ", dstubs.privateApiFile.String())
+ }
+ if dstubs.privateDexApiFile != nil {
+ fmt.Fprintln(w, apiFilePrefix+"PRIVATE_DEX_API_FILE := ", dstubs.privateDexApiFile.String())
+ }
+ if dstubs.removedApiFile != nil {
+ fmt.Fprintln(w, apiFilePrefix+"REMOVED_API_FILE := ", dstubs.removedApiFile.String())
+ }
+ if dstubs.removedDexApiFile != nil {
+ fmt.Fprintln(w, apiFilePrefix+"REMOVED_DEX_API_FILE := ", dstubs.removedDexApiFile.String())
+ }
+ if dstubs.exactApiFile != nil {
+ fmt.Fprintln(w, apiFilePrefix+"EXACT_API_FILE := ", dstubs.exactApiFile.String())
+ }
+ },
+ },
+ }
+}
+
func androidMkWriteTestData(data android.Paths, ret *android.AndroidMkData) {
var testFiles []string
for _, d := range data {