From b2b33de3c0699cf4a17c3519fe1916fafba73d2d Mon Sep 17 00:00:00 2001 From: Nan Zhang Date: Fri, 23 Feb 2018 11:18:47 -0800 Subject: [PATCH] Fetch generated srcs from java libs for droiddoc. api-stubs, system-api-stubs and etc need generated sources and srcjars from "framework", so add a property that tell module to fetch srcs and srcjars from its dependency libraries. The libraries in that property has to be in the module's classpath. Also add doc_defaults targets. Bug: b/70351683 Test: m -j Change-Id: I05831fbcad488037710950e4f05dc8fb2a12f403 --- android/neverallow.go | 2 +- java/droiddoc.go | 120 +++++++++++++++++++++++++++++++++++++----- java/java.go | 35 ++++++++++++ 3 files changed, 144 insertions(+), 13 deletions(-) diff --git a/android/neverallow.go b/android/neverallow.go index 261f2eeed..3c6c0041a 100644 --- a/android/neverallow.go +++ b/android/neverallow.go @@ -50,7 +50,7 @@ var neverallows = []*rule{ because("the VNDK can never contain a library that is device dependent."), neverallow().with("vndk.enabled", "true").without("owner", ""). because("a VNDK module can never have an owner."), - neverallow().notIn("libcore").with("no_standard_libs", "true"), + neverallow().notIn("libcore", "development").with("no_standard_libs", "true"), // TODO(b/67974785): always enforce the manifest neverallow(). diff --git a/java/droiddoc.go b/java/droiddoc.go index eaa6c5fc7..8c605355c 100644 --- a/java/droiddoc.go +++ b/java/droiddoc.go @@ -18,6 +18,7 @@ import ( "android/soong/android" "android/soong/java/config" "fmt" + "path/filepath" "strings" "github.com/google/blueprint" @@ -49,6 +50,8 @@ var ( ) func init() { + android.RegisterModuleType("doc_defaults", DocDefaultsFactory) + android.RegisterModuleType("droiddoc", DroiddocFactory) android.RegisterModuleType("droiddoc_host", DroiddocHostFactory) android.RegisterModuleType("droiddoc_template", DroiddocTemplateFactory) @@ -63,22 +66,31 @@ type JavadocProperties struct { // list of directories rooted at the Android.bp file that will // be added to the search paths for finding source files when passing package names. - Local_sourcepaths []string `android:"arch_variant"` + Local_sourcepaths []string // list of source files that should not be used to build the Java module. // This is most useful in the arch/multilib variants to remove non-common files // filegroup or genrule can be included within this property. Exclude_srcs []string `android:"arch_variant"` - // list of of java libraries that will be in the classpath. + // list of java libraries that will be in the classpath. Libs []string `android:"arch_variant"` // don't build against the framework libraries (legacy-test, core-junit, // ext, and framework for device targets) No_framework_libs *bool + // the java library (in classpath) for documentation that provides java srcs and srcjars. + Srcs_lib *string + + // the base dirs under srcs_lib will be scanned for java srcs. + Srcs_lib_whitelist_dirs []string + + // the sub dirs under srcs_lib_whitelist_dirs will be scanned for java srcs. + Srcs_lib_whitelist_pkgs []string + // If set to false, don't allow this module(-docs.zip) to be exported. Defaults to true. - Installable *bool `android:"arch_variant"` + Installable *bool // if not blank, set to the version of the sdk to compile against Sdk_version *string `android:"arch_variant"` @@ -86,37 +98,43 @@ type JavadocProperties struct { type DroiddocProperties struct { // directory relative to top of the source tree that contains doc templates files. - Custom_template *string `android:"arch_variant"` + Custom_template *string // directories relative to top of the source tree which contains html/jd files. - Html_dirs []string `android:"arch_variant"` + Html_dirs []string // set a value in the Clearsilver hdf namespace. - Hdf []string `android:"arch_variant"` + Hdf []string // proofread file contains all of the text content of the javadocs concatenated into one file, // suitable for spell-checking and other goodness. - Proofread_file *string `android:"arch_variant"` + Proofread_file *string // a todo file lists the program elements that are missing documentation. // At some point, this might be improved to show more warnings. - Todo_file *string `android:"arch_variant"` + Todo_file *string + + // directory under current module source that provide additional resources (images). + Resourcesdir *string + + // resources output directory under out/soong/.intermediates. + Resourcesoutdir *string // local files that are used within user customized droiddoc options. - Arg_files []string `android:"arch_variant"` + Arg_files []string // user customized droiddoc args. // Available variables for substitution: // // $(location