123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429 |
- // Copyright (C) 2021 The Android Open Source Project
- //
- // Licensed under the Apache License, Version 2.0 (the "License");
- // you may not use this file except in compliance with the License.
- // You may obtain a copy of the License at
- //
- // http://www.apache.org/licenses/LICENSE-2.0
- //
- // Unless required by applicable law or agreed to in writing, software
- // distributed under the License is distributed on an "AS IS" BASIS,
- // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- // See the License for the specific language governing permissions and
- // limitations under the License.
- //
- // Definitions for building the Android core libraries, i.e. ART, I18n and
- // Conscrypt.
- //
- // These are here as the definitions are used by the build itself and include
- // parts from all three of those modules.
- //
- // A stubs target containing the parts of the public SDK API provided by the
- // core libraries.
- //
- // Don't use this directly, use "sdk_version: core_current".
- package {
- default_applicable_licenses: ["Android-Apache-2.0"],
- }
- dist_targets = [
- "sdk",
- "win_sdk",
- ]
- java_defaults {
- name: "core.current.stubs.defaults",
- visibility: ["//visibility:public"],
- sdk_version: "none",
- system_modules: "none",
- dist: {
- targets: dist_targets,
- },
- }
- java_library {
- name: "core.current.stubs.from-source",
- defaults: [
- "core.current.stubs.defaults",
- ],
- static_libs: [
- "art.module.public.api.stubs",
- "conscrypt.module.public.api.stubs",
- "i18n.module.public.api.stubs",
- ],
- }
- java_library {
- name: "core.current.stubs",
- defaults: [
- "core.current.stubs.defaults",
- ],
- static_libs: [
- "core.current.stubs.from-source",
- ],
- product_variables: {
- build_from_text_stub: {
- static_libs: [
- "core.current.stubs.from-text",
- ],
- exclude_static_libs: [
- "core.current.stubs.from-source",
- ],
- },
- },
- }
- // Distributed with the SDK for turning into system modules to compile apps
- // against.
- //
- // Also, produces dist files that are used by the
- // prebuilts/sdk/update_prebuilts.py script to update the prebuilts/sdk
- // directory.
- java_library {
- name: "core-current-stubs-for-system-modules",
- visibility: ["//development/sdk"],
- static_libs: [
- "core.current.stubs",
- // This one is not on device but it's needed when javac compiles code
- // containing lambdas.
- "core-lambda-stubs-for-system-modules",
- ],
- sdk_version: "none",
- system_modules: "none",
- dists: [
- {
- // Legacy dist location for the public file.
- dest: "core-for-system-modules.jar",
- targets: dist_targets,
- },
- {
- dest: "system-modules/public/core-for-system-modules.jar",
- targets: dist_targets,
- },
- ],
- }
- // Defaults module to strip out android annotations
- java_defaults {
- name: "system-modules-no-annotations",
- sdk_version: "none",
- system_modules: "none",
- jarjar_rules: "jarjar-strip-annotations-rules.txt",
- }
- // Same as core-current-stubs-for-system-modules, but android annotations are
- // stripped.
- java_library {
- name: "core-current-stubs-for-system-modules-no-annotations",
- visibility: ["//development/sdk"],
- defaults: [
- "system-modules-no-annotations",
- ],
- static_libs: [
- "core-current-stubs-for-system-modules",
- ],
- dists: [
- {
- // Legacy dist location for the public file.
- dest: "core-for-system-modules-no-annotations.jar",
- targets: dist_targets,
- },
- {
- dest: "system-modules/public/core-for-system-modules-no-annotations.jar",
- targets: dist_targets,
- },
- ],
- }
- // Used when compiling higher-level code against core.current.stubs.
- java_system_modules {
- name: "core-public-stubs-system-modules",
- visibility: ["//visibility:public"],
- libs: [
- "core-current-stubs-for-system-modules-no-annotations",
- ],
- }
- // A stubs target containing the parts of the public SDK & @SystemApi(MODULE_LIBRARIES) API
- // provided by the core libraries.
- //
- // Don't use this directly, use "sdk_version: module_current".
- java_library {
- name: "core.module_lib.stubs",
- static_libs: [
- "art.module.public.api.stubs.module_lib",
- // Replace the following with the module-lib correspondence when Conscrypt or i18N module
- // provides @SystemApi(MODULE_LIBRARIES). Currently, assume that only ART module provides
- // @SystemApi(MODULE_LIBRARIES).
- "conscrypt.module.public.api.stubs",
- "i18n.module.public.api.stubs",
- ],
- sdk_version: "none",
- system_modules: "none",
- visibility: ["//visibility:private"],
- }
- // Produces a dist file that is used by the
- // prebuilts/sdk/update_prebuilts.py script to update the prebuilts/sdk
- // directory.
- java_library {
- name: "core-module-lib-stubs-for-system-modules",
- visibility: ["//visibility:private"],
- static_libs: [
- "core.module_lib.stubs",
- // This one is not on device but it's needed when javac compiles code
- // containing lambdas.
- "core-lambda-stubs-for-system-modules",
- ],
- sdk_version: "none",
- system_modules: "none",
- dist: {
- dest: "system-modules/module-lib/core-for-system-modules.jar",
- targets: dist_targets,
- },
- }
- // Same as core-module-lib-stubs-for-system-modules, but android annotations are
- // stripped. This is used by the Java toolchain, while the annotated stub is to
- // be used by Kotlin one.
- java_library {
- name: "core-module-lib-stubs-for-system-modules-no-annotations",
- visibility: ["//visibility:private"],
- defaults: [
- "system-modules-no-annotations",
- ],
- static_libs: [
- "core-module-lib-stubs-for-system-modules",
- ],
- dist: {
- dest: "system-modules/module-lib/core-for-system-modules-no-annotations.jar",
- targets: dist_targets,
- },
- }
- // Used when compiling higher-level code with sdk_version "module_current"
- java_system_modules {
- name: "core-module-lib-stubs-system-modules",
- libs: [
- "core-module-lib-stubs-for-system-modules-no-annotations",
- ],
- visibility: ["//visibility:public"],
- }
- // Ideally this should be a restricted allowlist but there are hundreds of modules that depend on
- // this.
- // TODO(http://b/134561230) - limit the number of dependents on this.
- core_platform_visibility = ["//visibility:public"]
- // Libraries containing the core platform API stubs for the core libraries.
- //
- // Although this stubs library is primarily used by the Java compiler / build to indicate
- // the core platform API surface area, compile_dex: true is used so that the Core Platform
- // API annotations are available to the dex tools that enable enforcement of runtime
- // accessibility. b/119068555
- java_library {
- name: "legacy.core.platform.api.stubs.from-source",
- visibility: core_platform_visibility,
- defaults: [
- "core.platform.api.stubs.defaults",
- ],
- static_libs: [
- "art.module.public.api.stubs.module_lib",
- "conscrypt.module.platform.api.stubs",
- "legacy.i18n.module.platform.api.stubs",
- ],
- }
- java_library {
- name: "legacy.core.platform.api.stubs",
- visibility: core_platform_visibility,
- defaults: [
- "core.platform.api.stubs.defaults",
- ],
- static_libs: [
- "legacy.core.platform.api.stubs.from-source",
- ],
- product_variables: {
- build_from_text_stub: {
- static_libs: [
- "stable.core.platform.api.stubs.from-text",
- ],
- exclude_static_libs: [
- "stable.core.platform.api.stubs.from-source",
- ],
- },
- },
- }
- java_defaults {
- name: "core.platform.api.stubs.defaults",
- hostdex: true,
- compile_dex: true,
- sdk_version: "none",
- system_modules: "none",
- patch_module: "java.base",
- }
- // Same as legacy.core.platform.api.stubs, but android annotations are
- // stripped. This is used by the Java toolchain, while the annotated stub is to
- // be used by Kotlin one.
- java_library {
- name: "legacy.core.platform.api.no.annotations.stubs",
- visibility: core_platform_visibility,
- defaults: [
- "system-modules-no-annotations",
- ],
- hostdex: true,
- compile_dex: true,
- static_libs: [
- "legacy.core.platform.api.stubs",
- ],
- patch_module: "java.base",
- }
- java_library {
- name: "stable.core.platform.api.stubs.from-source",
- visibility: core_platform_visibility,
- defaults: [
- "core.platform.api.stubs.defaults",
- ],
- static_libs: [
- "art.module.public.api.stubs.module_lib",
- // conscrypt only has a stable version, so it is okay to depend on it here:
- "conscrypt.module.platform.api.stubs",
- "stable.i18n.module.platform.api.stubs",
- ],
- }
- java_library {
- name: "stable.core.platform.api.stubs",
- visibility: core_platform_visibility,
- defaults: [
- "core.platform.api.stubs.defaults",
- ],
- static_libs: [
- "stable.core.platform.api.stubs.from-source",
- ],
- product_variables: {
- build_from_text_stub: {
- static_libs: [
- "stable.core.platform.api.stubs.from-text",
- ],
- exclude_static_libs: [
- "stable.core.platform.api.stubs.from-source",
- ],
- },
- },
- }
- // Same as stable.core.platform.api.stubs, but android annotations are
- // stripped. This is used by the Java toolchain, while the annotated stub is to
- // be used by Kotlin one.
- java_library {
- name: "stable.core.platform.api.no.annotations.stubs",
- visibility: core_platform_visibility,
- defaults: [
- "system-modules-no-annotations",
- ],
- hostdex: true,
- compile_dex: true,
- static_libs: [
- "stable.core.platform.api.stubs",
- ],
- patch_module: "java.base",
- }
- // Used when compiling higher-level code against *.core.platform.api.stubs.
- java_system_modules {
- name: "legacy-core-platform-api-stubs-system-modules",
- visibility: core_platform_visibility,
- libs: [
- "legacy.core.platform.api.no.annotations.stubs",
- // This one is not on device but it's needed when javac compiles code
- // containing lambdas.
- "core-lambda-stubs-for-system-modules",
- ],
- }
- java_system_modules {
- name: "stable-core-platform-api-stubs-system-modules",
- visibility: core_platform_visibility,
- libs: [
- "stable.core.platform.api.no.annotations.stubs",
- // This one is not on device but it's needed when javac compiles code
- // containing lambdas.
- "core-lambda-stubs-for-system-modules",
- ],
- }
- // Used when compiling higher-level code against art.module.public.api.stubs.
- // This abstraction should come from the inner tree linking against the stubs
- // and not from an "sdk", since parts of this abstraction do not belong to an
- // official API (e.g. stub-annotations).
- //
- // This is only intended for use within core libraries and must not be used
- // from outside.
- java_system_modules {
- name: "art-module-public-api-stubs-system-modules",
- visibility: [
- "//art/build/sdk",
- "//external/conscrypt",
- "//external/icu/android_icu4j",
- "//external/wycheproof",
- ],
- libs: [
- "art.module.public.api.stubs",
- // This one is not on device but it's needed when javac compiles code
- // containing lambdas.
- "core-lambda-stubs-for-system-modules",
- // Ensure that core libraries that depend on the public API can access
- // the UnsupportedAppUsage, CorePlatformApi and IntraCoreApi
- // annotations.
- "art.module.api.annotations.for.system.modules",
- ],
- }
- // Used when compiling higher-level code against art.module.public.api.stubs.module_lib.
- //
- // This is only intended for use within core libraries and must not be used
- // from outside.
- java_system_modules {
- name: "art-module-lib-api-stubs-system-modules",
- visibility: [
- "//art/build/sdk",
- "//external/conscrypt",
- "//external/icu/android_icu4j",
- ],
- libs: [
- "art.module.public.api.stubs.module_lib",
- ],
- }
- // Used when compiling against art.module.intra.core.api.stubs.
- java_system_modules {
- name: "art-module-intra-core-api-stubs-system-modules",
- visibility: [
- "//art/build/sdk",
- "//external/bouncycastle",
- "//external/conscrypt",
- "//external/icu/android_icu4j",
- ],
- libs: [
- // The intra core API stubs library.
- "art.module.intra.core.api.stubs",
- // Additional classes needed by javac but which are not present in the stubs.
- "art-module-intra-core-api-stubs-system-modules-lib",
- ],
- }
- build = [
- "TxtStubLibraries.bp",
- ]
|