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,