Loading java/sdk_library.go +61 −31 Original line number Diff line number Diff line Loading @@ -128,6 +128,11 @@ type sdkLibraryProperties struct { // Defaults to "android.annotation". Srcs_lib_whitelist_pkgs []string // if set to true, create stubs through Metalava instead of Doclava. Javadoc/Doclava is // currently still used for documentation generation, and will be replaced by Dokka soon. // Defaults to true. Metalava_enabled *bool // TODO: determines whether to create HTML doc or not //Html_doc *bool } Loading Loading @@ -417,7 +422,6 @@ func (module *sdkLibrary) createDocs(mctx android.TopDownMutatorContext, apiScop props := struct { Name *string Srcs []string Custom_template *string Installable *bool Srcs_lib *string Srcs_lib_whitelist_dirs []string Loading @@ -436,11 +440,13 @@ func (module *sdkLibrary) createDocs(mctx android.TopDownMutatorContext, apiScop Local_include_dirs []string } }{} droiddocProps := struct { Custom_template *string }{} props.Name = proptools.StringPtr(module.docsName(apiScope)) 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) // A droiddoc module has only one Libs property and doesn't distinguish between // shared libs and static libs. So we need to add both of these libs to Libs property. Loading @@ -449,10 +455,26 @@ func (module *sdkLibrary) createDocs(mctx android.TopDownMutatorContext, apiScop props.Aidl.Include_dirs = module.deviceProperties.Aidl.Include_dirs props.Aidl.Local_include_dirs = module.deviceProperties.Aidl.Local_include_dirs droiddocArgs := " -hide 110 -hide 111 -hide 113 -hide 121 -hide 125 -hide 126 -hide 127 -hide 128" + " -stubpackages " + strings.Join(module.properties.Api_packages, ":") + if module.properties.Metalava_enabled == nil { module.properties.Metalava_enabled = proptools.BoolPtr(true) } droiddocArgs := "" if Bool(module.properties.Metalava_enabled) == true { droiddocArgs = " --stub-packages " + strings.Join(module.properties.Api_packages, ":") + " " + android.JoinWithPrefix(module.properties.Hidden_api_packages, " --hide-package ") + " " + android.JoinWithPrefix(module.properties.Droiddoc_options, " ") + " --hide MissingPermission --hide BroadcastBehavior " + "--hide HiddenSuperclass --hide DeprecationMismatch --hide UnavailableSymbol " + "--hide SdkConstant --hide HiddenTypeParameter --hide Todo --hide Typo" } else { droiddocProps.Custom_template = proptools.StringPtr("droiddoc-templates-sdk") droiddocArgs = " -stubpackages " + strings.Join(module.properties.Api_packages, ":") + " " + android.JoinWithPrefix(module.properties.Hidden_api_packages, " -hidePackage ") + " " + android.JoinWithPrefix(module.properties.Droiddoc_options, "-") + " -nodocs" " " + android.JoinWithPrefix(module.properties.Droiddoc_options, " ") + " -hide 110 -hide 111 -hide 113 -hide 121 -hide 125 -hide 126 -hide 127 -hide 128 -nodocs" } switch apiScope { case apiScopeSystem: droiddocArgs = droiddocArgs + " -showAnnotation android.annotation.SystemApi" Loading Loading @@ -484,17 +506,19 @@ func (module *sdkLibrary) createDocs(mctx android.TopDownMutatorContext, apiScop // check against the not-yet-release API props.Check_api.Current.Api_file = proptools.StringPtr(currentApiFileName) props.Check_api.Current.Removed_api_file = proptools.StringPtr(removedApiFileName) // any change is reported as error props.Check_api.Current.Args = proptools.StringPtr("-error 2 -error 3 -error 4 -error 5 " + "-error 6 -error 7 -error 8 -error 9 -error 10 -error 11 -error 12 -error 13 " + "-error 14 -error 15 -error 16 -error 17 -error 18 -error 19 -error 20 " + "-error 21 -error 23 -error 24 -error 25 -error 26 -error 27") // check against the latest released API props.Check_api.Last_released.Api_file = proptools.StringPtr( module.latestApiFilegroupName(apiScope)) props.Check_api.Last_released.Removed_api_file = proptools.StringPtr( module.latestRemovedApiFilegroupName(apiScope)) if Bool(module.properties.Metalava_enabled) == false { // any change is reported as error props.Check_api.Current.Args = proptools.StringPtr("-error 2 -error 3 -error 4 -error 5 " + "-error 6 -error 7 -error 8 -error 9 -error 10 -error 11 -error 12 -error 13 " + "-error 14 -error 15 -error 16 -error 17 -error 18 -error 19 -error 20 " + "-error 21 -error 23 -error 24 -error 25 -error 26 -error 27") // backward incompatible changes are reported as error props.Check_api.Last_released.Args = proptools.StringPtr("-hide 2 -hide 3 -hide 4 -hide 5 " + "-hide 6 -hide 24 -hide 25 -hide 26 -hide 27 " + Loading @@ -508,6 +532,7 @@ func (module *sdkLibrary) createDocs(mctx android.TopDownMutatorContext, apiScop // not the compiled ones. props.Srcs_lib = proptools.StringPtr("framework") props.Srcs_lib_whitelist_dirs = []string{"core/java"} // Add android.annotation package to give access to the framework-defined // annotations such as SystemApi, NonNull, etc. if module.properties.Srcs_lib_whitelist_pkgs != nil { Loading @@ -515,13 +540,18 @@ func (module *sdkLibrary) createDocs(mctx android.TopDownMutatorContext, apiScop } else { 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, // though they don't break the build. props.Libs = append(props.Libs, "framework") mctx.CreateModule(android.ModuleFactoryAdaptor(DroiddocFactory), &props) if Bool(module.properties.Metalava_enabled) == true { mctx.CreateModule(android.ModuleFactoryAdaptor(DroidstubsFactory), &props) } else { mctx.CreateModule(android.ModuleFactoryAdaptor(DroiddocFactory), &props, &droiddocProps) } } // Creates the runtime library. This is not directly linkable from other modules. Loading Loading
java/sdk_library.go +61 −31 Original line number Diff line number Diff line Loading @@ -128,6 +128,11 @@ type sdkLibraryProperties struct { // Defaults to "android.annotation". Srcs_lib_whitelist_pkgs []string // if set to true, create stubs through Metalava instead of Doclava. Javadoc/Doclava is // currently still used for documentation generation, and will be replaced by Dokka soon. // Defaults to true. Metalava_enabled *bool // TODO: determines whether to create HTML doc or not //Html_doc *bool } Loading Loading @@ -417,7 +422,6 @@ func (module *sdkLibrary) createDocs(mctx android.TopDownMutatorContext, apiScop props := struct { Name *string Srcs []string Custom_template *string Installable *bool Srcs_lib *string Srcs_lib_whitelist_dirs []string Loading @@ -436,11 +440,13 @@ func (module *sdkLibrary) createDocs(mctx android.TopDownMutatorContext, apiScop Local_include_dirs []string } }{} droiddocProps := struct { Custom_template *string }{} props.Name = proptools.StringPtr(module.docsName(apiScope)) 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) // A droiddoc module has only one Libs property and doesn't distinguish between // shared libs and static libs. So we need to add both of these libs to Libs property. Loading @@ -449,10 +455,26 @@ func (module *sdkLibrary) createDocs(mctx android.TopDownMutatorContext, apiScop props.Aidl.Include_dirs = module.deviceProperties.Aidl.Include_dirs props.Aidl.Local_include_dirs = module.deviceProperties.Aidl.Local_include_dirs droiddocArgs := " -hide 110 -hide 111 -hide 113 -hide 121 -hide 125 -hide 126 -hide 127 -hide 128" + " -stubpackages " + strings.Join(module.properties.Api_packages, ":") + if module.properties.Metalava_enabled == nil { module.properties.Metalava_enabled = proptools.BoolPtr(true) } droiddocArgs := "" if Bool(module.properties.Metalava_enabled) == true { droiddocArgs = " --stub-packages " + strings.Join(module.properties.Api_packages, ":") + " " + android.JoinWithPrefix(module.properties.Hidden_api_packages, " --hide-package ") + " " + android.JoinWithPrefix(module.properties.Droiddoc_options, " ") + " --hide MissingPermission --hide BroadcastBehavior " + "--hide HiddenSuperclass --hide DeprecationMismatch --hide UnavailableSymbol " + "--hide SdkConstant --hide HiddenTypeParameter --hide Todo --hide Typo" } else { droiddocProps.Custom_template = proptools.StringPtr("droiddoc-templates-sdk") droiddocArgs = " -stubpackages " + strings.Join(module.properties.Api_packages, ":") + " " + android.JoinWithPrefix(module.properties.Hidden_api_packages, " -hidePackage ") + " " + android.JoinWithPrefix(module.properties.Droiddoc_options, "-") + " -nodocs" " " + android.JoinWithPrefix(module.properties.Droiddoc_options, " ") + " -hide 110 -hide 111 -hide 113 -hide 121 -hide 125 -hide 126 -hide 127 -hide 128 -nodocs" } switch apiScope { case apiScopeSystem: droiddocArgs = droiddocArgs + " -showAnnotation android.annotation.SystemApi" Loading Loading @@ -484,17 +506,19 @@ func (module *sdkLibrary) createDocs(mctx android.TopDownMutatorContext, apiScop // check against the not-yet-release API props.Check_api.Current.Api_file = proptools.StringPtr(currentApiFileName) props.Check_api.Current.Removed_api_file = proptools.StringPtr(removedApiFileName) // any change is reported as error props.Check_api.Current.Args = proptools.StringPtr("-error 2 -error 3 -error 4 -error 5 " + "-error 6 -error 7 -error 8 -error 9 -error 10 -error 11 -error 12 -error 13 " + "-error 14 -error 15 -error 16 -error 17 -error 18 -error 19 -error 20 " + "-error 21 -error 23 -error 24 -error 25 -error 26 -error 27") // check against the latest released API props.Check_api.Last_released.Api_file = proptools.StringPtr( module.latestApiFilegroupName(apiScope)) props.Check_api.Last_released.Removed_api_file = proptools.StringPtr( module.latestRemovedApiFilegroupName(apiScope)) if Bool(module.properties.Metalava_enabled) == false { // any change is reported as error props.Check_api.Current.Args = proptools.StringPtr("-error 2 -error 3 -error 4 -error 5 " + "-error 6 -error 7 -error 8 -error 9 -error 10 -error 11 -error 12 -error 13 " + "-error 14 -error 15 -error 16 -error 17 -error 18 -error 19 -error 20 " + "-error 21 -error 23 -error 24 -error 25 -error 26 -error 27") // backward incompatible changes are reported as error props.Check_api.Last_released.Args = proptools.StringPtr("-hide 2 -hide 3 -hide 4 -hide 5 " + "-hide 6 -hide 24 -hide 25 -hide 26 -hide 27 " + Loading @@ -508,6 +532,7 @@ func (module *sdkLibrary) createDocs(mctx android.TopDownMutatorContext, apiScop // not the compiled ones. props.Srcs_lib = proptools.StringPtr("framework") props.Srcs_lib_whitelist_dirs = []string{"core/java"} // Add android.annotation package to give access to the framework-defined // annotations such as SystemApi, NonNull, etc. if module.properties.Srcs_lib_whitelist_pkgs != nil { Loading @@ -515,13 +540,18 @@ func (module *sdkLibrary) createDocs(mctx android.TopDownMutatorContext, apiScop } else { 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, // though they don't break the build. props.Libs = append(props.Libs, "framework") mctx.CreateModule(android.ModuleFactoryAdaptor(DroiddocFactory), &props) if Bool(module.properties.Metalava_enabled) == true { mctx.CreateModule(android.ModuleFactoryAdaptor(DroidstubsFactory), &props) } else { mctx.CreateModule(android.ModuleFactoryAdaptor(DroiddocFactory), &props, &droiddocProps) } } // Creates the runtime library. This is not directly linkable from other modules. Loading