diff options
author | Paul Duffin <paulduffin@google.com> | 2020-05-13 10:17:56 +0100 |
---|---|---|
committer | Paul Duffin <paulduffin@google.com> | 2020-05-15 01:16:20 +0100 |
commit | 13e67afca531d26ac112ad76f954b69f2f0561de (patch) | |
tree | a6cb92e6730866d2c69421221b6510382c8b7f9c | |
parent | 1e83ce23e170dcef158b6358357f5e109b0035c3 (diff) |
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
Merged-In: Icd5b893b080d3a8b92b11b856a71b700be96dafa
Change-Id: Icd5b893b080d3a8b92b11b856a71b700be96dafa
(cherry picked from commit bee7404dccbde59077a34d4bcfaab5ada4344617)
-rw-r--r-- | apex/Android.bp | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/apex/Android.bp b/apex/Android.bp index c381c0f100a5..4a65550c616b 100644 --- a/apex/Android.bp +++ b/apex/Android.bp @@ -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, |