From baaf9dd5ab253624bd2b51c1a1f5635af873013b Mon Sep 17 00:00:00 2001 From: Jiyong Park Date: Wed, 2 May 2018 01:35:27 +0900 Subject: [PATCH] Property api_srcs added for api-only source files New property api_srcs is added to java_sdk_library. The property is used to specify set of source files that will be part of the API but not part of the runtime library. Currently, this is only for the legacy http library (org.apache.http.legacy) where some framework classes (such as android.net.SslError which are compiled into framework.jar) are registered as its API for historical reason. Bug: 77575606 Test: m -j Change-Id: I36d153f4815f8e4c939d5eeec632a38e7943b4b0 --- java/sdk_library.go | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/java/sdk_library.go b/java/sdk_library.go index 67c052f95..703401cf1 100644 --- a/java/sdk_library.go +++ b/java/sdk_library.go @@ -92,6 +92,9 @@ type sdkLibraryProperties struct { // or .aidl files. Srcs []string `android:"arch_variant"` + // list of optional source files that are part of API but not part of runtime library. + Api_srcs []string `android:"arch_variant"` + // list of of java libraries that will be in the classpath Libs []string `android:"arch_variant"` @@ -316,7 +319,8 @@ func (module *sdkLibrary) createDocs(mctx android.TopDownMutatorContext, apiScop }{} props.Name = proptools.StringPtr(module.docsName(apiScope)) - props.Srcs = module.properties.Srcs + props.Srcs = append(props.Srcs, module.properties.Srcs...) + props.Srcs = append(props.Srcs, module.properties.Api_srcs...) props.Custom_template = proptools.StringPtr("droiddoc-templates-sdk") props.Installable = proptools.BoolPtr(false) props.Libs = module.properties.Libs @@ -359,16 +363,12 @@ func (module *sdkLibrary) createDocs(mctx android.TopDownMutatorContext, apiScop // API class is extending from the framework class. In that case, doclava needs // to know whether the base class is hidden or not. Since that information is // encoded as @hide string in the comment, we need source files for the classes, - // not the compiled ones. Also there are rare cases where part of SDK library is - // implemented in the framework (e.g. org.apache.http.legacy). In that case, - // we need framework source to make API stubs, though the sources are not - // required to build the runtime library. + // not the compiled ones. props.Srcs_lib = proptools.StringPtr("framework") props.Srcs_lib_whitelist_dirs = []string{"core/java"} - props.Srcs_lib_whitelist_pkgs = module.properties.Api_packages // Add android.annotation package to give access to the framework-defined // annotations such as SystemApi, NonNull, etc. - props.Srcs_lib_whitelist_pkgs = append(props.Srcs_lib_whitelist_pkgs, "android.annotation") + props.Srcs_lib_whitelist_pkgs = []string{"android.annotation"} // These libs are required by doclava to parse the framework sources add via // Src_lib and Src_lib_whitelist_* properties just above. // If we don't add them to the classpath, errors messages are generated by doclava,