Add framework-module-defaults for java_sdk_library

Provides defaults for java_sdk_library to that are equivalent to those
already used by the framework modules to simplify conversion.

* The java_api_finder is in the defaults as that should be used by
  all mainline modules.
* The public/system/module_lib scopes are explicitly specified in the
  defaults to include module_lib but exclude test as changing that
  behaviour by default would break upwards of 24 existing
  java_sdk_library usages.
* The stubs for each API scope is compiled against module_current
  because if they compiled against the scope specific sdk version it
  would create cycles for "current" and "system_current" because some
  of the modules contribute to those.

Test: m update-api
Bug: 155164730
Change-Id: Icd5b893b080d3a8b92b11b856a71b700be96dafa
This commit is contained in:
Paul Duffin
2020-05-13 10:17:56 +01:00
parent 4e46cf22a4
commit bee7404dcc

View File

@@ -63,6 +63,60 @@ mainline_service_stubs_args =
"--hide-annotation android.annotation.Hide " +
"--hide InternalClasses " // com.android.* classes are okay in this interface
// Defaults for mainline module provided java_sdk_library instances.
java_defaults {
name: "framework-module-defaults",
// Additional annotations used for compiling both the implementation and the
// stubs libraries.
libs: ["framework-annotations-lib"],
// Enable api lint. This will eventually become the default for java_sdk_library
// but it cannot yet be turned on because some usages have not been cleaned up.
// TODO(b/156126315) - Remove when no longer needed.
api_lint: {
enabled: true,
},
// The API scope specific properties.
public: {
enabled: true,
sdk_version: "module_current",
},
system: {
enabled: true,
sdk_version: "module_current",
},
module_lib: {
enabled: true,
sdk_version: "module_current",
},
// The stub libraries must be visible to frameworks/base so they can be combined
// into API specific libraries.
stubs_library_visibility: [
"//frameworks/base", // Framework
],
// Set the visibility of the modules creating the stubs source.
stubs_source_visibility: [
// Ignore any visibility rules specified on the java_sdk_library when
// setting the visibility of the stubs source modules.
"//visibility:override",
// Currently, the stub source is not required for anything other than building
// the stubs library so is private to avoid misuse.
"//visibility:private",
],
// Collates API usages from each module for further analysis.
plugins: ["java_api_finder"],
// Mainline modules should only rely on 'module_lib' APIs provided by other modules
// and the non updatable parts of the platform.
sdk_version: "module_current",
}
stubs_defaults {
name: "framework-module-stubs-defaults-publicapi",
args: mainline_framework_stubs_args,