• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// Copyright (C) 2018 The Android Open Source Project
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//      http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15// Generates stub source files for the core platform API of the ART module.
16// i.e. every class/member that is either in the public API or annotated with
17// @CorePlatformApi.
18//
19// The API specification .txt files managed by this only contain the additional
20// classes/members that are in the intra-core API but which are not in the public
21// API.
22//
23// There are two versions of the API surface. The "stable" version contains the
24// APIs which are considered stable, and is indicated in source with the
25// annotation @CorePlatformApi(status = CorePlatformApi.Status.STABLE). The
26// "legacy" version also includes those which have not been audited for stability
27// or which are deprecated (which have the default status of LEGACY_ONLY).
28//
29// TODO(b/161973015): Remove the legacy/stable distinction once no longer useful.
30
31package {
32    // http://go/android-license-faq
33    // A large-scale-change added 'default_applicable_licenses' to import
34    // the below license kinds from "libcore_license":
35    //   SPDX-license-identifier-Apache-2.0
36    //   SPDX-license-identifier-GPL
37    //   SPDX-license-identifier-GPL-2.0
38    //   SPDX-license-identifier-LGPL
39    //   SPDX-license-identifier-MIT
40    //   SPDX-license-identifier-W3C
41    default_applicable_licenses: ["libcore_license"],
42}
43
44// Ideally this should be a restricted allowlist but there are hundreds of modules that depend on
45// this.
46// TODO(http://b/134561230) - limit the number of dependents on this.
47core_platform_visibility = ["//visibility:public"]
48
49// Libraries containing the core platform API stubs for the core libraries.
50//
51// Although this stubs library is primarily used by the Java compiler / build to indicate
52// the core platform API surface area, compile_dex: true is used so that the Core Platform
53// API annotations are available to the dex tools that enable enforcement of runtime
54// accessibility. b/119068555
55java_library {
56    name: "legacy.core.platform.api.stubs",
57    visibility: core_platform_visibility,
58    hostdex: true,
59    compile_dex: true,
60
61    sdk_version: "none",
62    system_modules: "none",
63    static_libs: [
64        "art.module.public.api.stubs.module_lib",
65        "conscrypt.module.platform.api.stubs",
66        "legacy.i18n.module.platform.api.stubs",
67    ],
68    patch_module: "java.base",
69}
70
71java_library {
72    name: "stable.core.platform.api.stubs",
73    visibility: core_platform_visibility,
74    hostdex: true,
75    compile_dex: true,
76
77    sdk_version: "none",
78    system_modules: "none",
79    static_libs: [
80        "art.module.public.api.stubs.module_lib",
81        // conscrypt only has a stable version, so it is okay to depend on it here:
82        "conscrypt.module.platform.api.stubs",
83        "stable.i18n.module.platform.api.stubs",
84    ],
85    patch_module: "java.base",
86}
87
88// Used when compiling higher-level code against *.core.platform.api.stubs.
89java_system_modules {
90    name: "legacy-core-platform-api-stubs-system-modules",
91    visibility: core_platform_visibility,
92    libs: [
93        "legacy.core.platform.api.stubs",
94        // This one is not on device but it's needed when javac compiles code
95        // containing lambdas.
96        "core-lambda-stubs-for-system-modules",
97        // This one is not on device but it's needed when javac compiles code
98        // containing @Generated annotations produced by some code generation
99        // tools.
100        // See http://b/123891440.
101        "core-generated-annotation-stubs",
102    ],
103}
104
105java_system_modules {
106    name: "stable-core-platform-api-stubs-system-modules",
107    visibility: core_platform_visibility,
108    libs: [
109        "stable.core.platform.api.stubs",
110        // This one is not on device but it's needed when javac compiles code
111        // containing lambdas.
112        "core-lambda-stubs-for-system-modules",
113        // This one is not on device but it's needed when javac compiles code
114        // containing @Generated annotations produced by some code generation
115        // tools.
116        // See http://b/123891440.
117        "core-generated-annotation-stubs",
118    ],
119}
120