blob: 380b4c6cc0bec42b748dfa7196a3db61796ae1b1 [file] [log] [blame]
Anton Hansson24c88f42019-12-13 16:17:27 +00001// Copyright (C) 2019 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
15mainline_stubs_args =
16 "--error UnhiddenSystemApi " +
17 "--hide BroadcastBehavior " +
18 "--hide DeprecationMismatch " +
19 "--hide HiddenSuperclass " +
20 "--hide HiddenTypedefConstant " +
21 "--hide HiddenTypeParameter " +
22 "--hide MissingPermission " +
23 "--hide RequiresPermission " +
24 "--hide SdkConstant " +
25 "--hide Todo " +
26 "--hide Typo " +
27 "--hide UnavailableSymbol "
28
Anton Hansson087646e2020-03-24 15:21:01 +000029// TODO: modularize this so not every module has the same whitelist
30framework_packages_to_document = [
31 "android",
32 "dalvik",
33 "java",
34 "javax",
35 "junit",
36 "org.apache.http",
37 "org.json",
38 "org.w3c.dom",
39 "org.xml.sax",
40 "org.xmlpull",
41]
42
Anton Hansson26e1ed62020-03-23 13:30:01 +000043// TODO: remove the hiding when server classes are cleaned up.
44mainline_framework_stubs_args =
45 mainline_stubs_args +
46 "--hide-package com.android.server "
Anton Hansson5036ab62019-12-17 10:03:52 +000047
Anton Hanssona12addc2020-02-03 14:44:47 +000048priv_apps = " " +
49 "--show-annotation android.annotation.SystemApi\\(" +
Jiyong Park7f1e9b22020-02-25 17:12:30 +090050 "client=android.annotation.SystemApi.Client.PRIVILEGED_APPS" +
Anton Hanssona12addc2020-02-03 14:44:47 +000051 "\\) "
52
53module_libs = " " +
54 " --show-annotation android.annotation.SystemApi\\(" +
Jiyong Park7f1e9b22020-02-25 17:12:30 +090055 "client=android.annotation.SystemApi.Client.MODULE_LIBRARIES" +
Anton Hanssona12addc2020-02-03 14:44:47 +000056 "\\) "
57
Anton Hansson26e1ed62020-03-23 13:30:01 +000058mainline_service_stubs_args =
59 mainline_stubs_args +
60 "--show-annotation android.annotation.SystemApi\\(" +
61 "client=android.annotation.SystemApi.Client.SYSTEM_SERVER" +
62 "\\) " +
63 "--hide-annotation android.annotation.Hide " +
64 "--hide InternalClasses " // com.android.* classes are okay in this interface
65
Paul Duffin13e67af2020-05-13 10:17:56 +010066// Defaults for mainline module provided java_sdk_library instances.
67java_defaults {
68 name: "framework-module-defaults",
69
70 // Additional annotations used for compiling both the implementation and the
71 // stubs libraries.
72 libs: ["framework-annotations-lib"],
73
Paul Duffin077b4df2020-05-22 17:12:12 +010074 // Framework modules are not generally shared libraries, i.e. they are not
75 // intended, and must not be allowed, to be used in a <uses-library> manifest
76 // entry.
77 shared_library: false,
78
Paul Duffin1a0ba1e2020-05-29 09:50:20 +010079 // Prevent dependencies that do not specify an sdk_version from accessing the
80 // implementation library by default and force them to use stubs instead.
81 default_to_stubs: true,
82
Paul Duffin13e67af2020-05-13 10:17:56 +010083 // Enable api lint. This will eventually become the default for java_sdk_library
84 // but it cannot yet be turned on because some usages have not been cleaned up.
85 // TODO(b/156126315) - Remove when no longer needed.
86 api_lint: {
87 enabled: true,
88 },
89
90 // The API scope specific properties.
91 public: {
92 enabled: true,
93 sdk_version: "module_current",
94 },
95 system: {
96 enabled: true,
97 sdk_version: "module_current",
98 },
99 module_lib: {
100 enabled: true,
101 sdk_version: "module_current",
102 },
103
Paul Duffin067d80b2020-05-17 13:00:36 +0100104 // Configure framework module specific metalava options.
105 droiddoc_options: [mainline_stubs_args],
106
Paul Duffin13e67af2020-05-13 10:17:56 +0100107 // The stub libraries must be visible to frameworks/base so they can be combined
108 // into API specific libraries.
109 stubs_library_visibility: [
110 "//frameworks/base", // Framework
111 ],
112
113 // Set the visibility of the modules creating the stubs source.
114 stubs_source_visibility: [
115 // Ignore any visibility rules specified on the java_sdk_library when
116 // setting the visibility of the stubs source modules.
117 "//visibility:override",
118
119 // Currently, the stub source is not required for anything other than building
120 // the stubs library so is private to avoid misuse.
121 "//visibility:private",
122 ],
123
124 // Collates API usages from each module for further analysis.
125 plugins: ["java_api_finder"],
126
127 // Mainline modules should only rely on 'module_lib' APIs provided by other modules
128 // and the non updatable parts of the platform.
129 sdk_version: "module_current",
130}
131
Anton Hansson24c88f42019-12-13 16:17:27 +0000132stubs_defaults {
133 name: "framework-module-stubs-defaults-publicapi",
Anton Hansson26e1ed62020-03-23 13:30:01 +0000134 args: mainline_framework_stubs_args,
Anton Hansson24c88f42019-12-13 16:17:27 +0000135 installable: false,
Anton Hansson4d90a282020-03-09 19:14:28 +0000136 sdk_version: "current",
Anton Hansson087646e2020-03-24 15:21:01 +0000137 filter_packages: framework_packages_to_document,
Anton Hansson5d708e52020-01-17 19:03:34 +0000138 check_api: {
139 current: {
140 api_file: "api/current.txt",
141 removed_api_file: "api/removed.txt",
142 },
143 },
Anton Hansson24c88f42019-12-13 16:17:27 +0000144}
145
146stubs_defaults {
147 name: "framework-module-stubs-defaults-systemapi",
Anton Hansson26e1ed62020-03-23 13:30:01 +0000148 args: mainline_framework_stubs_args + priv_apps,
Anton Hansson397eb472020-03-13 16:28:21 +0000149 libs: ["framework-annotations-lib"],
Jiyong Park7be934f2020-01-06 16:22:32 +0900150 installable: false,
Anton Hansson4d90a282020-03-09 19:14:28 +0000151 sdk_version: "system_current",
Anton Hansson087646e2020-03-24 15:21:01 +0000152 filter_packages: framework_packages_to_document,
Anton Hansson5d708e52020-01-17 19:03:34 +0000153 check_api: {
154 current: {
155 api_file: "api/system-current.txt",
156 removed_api_file: "api/system-removed.txt",
157 },
158 },
Jiyong Park7be934f2020-01-06 16:22:32 +0900159}
160
Anton Hanssonc8cc1eb2020-03-24 17:03:15 +0000161java_defaults {
162 name: "framework-module-stubs-lib-defaults-publicapi",
163 installable: false,
164 sdk_version: "module_current",
165}
166
167java_defaults {
168 name: "framework-module-stubs-lib-defaults-systemapi",
169 installable: false,
170 sdk_version: "module_current",
171}
172
173java_defaults {
174 name: "framework-module-stubs-lib-defaults-module_libs_api",
175 installable: false,
176 sdk_version: "module_current",
177}
178
Anton Hanssona12addc2020-02-03 14:44:47 +0000179// The defaults for module_libs comes in two parts - defaults for API checks
180// and defaults for stub generation. This is because we want the API txt
181// files to *only* include the module_libs_api, but the stubs to include
182// module_libs_api as well as priv_apps.
183
Jiyong Park7be934f2020-01-06 16:22:32 +0900184stubs_defaults {
Anton Hanssona12addc2020-02-03 14:44:47 +0000185 name: "framework-module-api-defaults-module_libs_api",
Anton Hansson26e1ed62020-03-23 13:30:01 +0000186 args: mainline_framework_stubs_args + module_libs,
Anton Hansson397eb472020-03-13 16:28:21 +0000187 libs: ["framework-annotations-lib"],
Jiyong Park7be934f2020-01-06 16:22:32 +0900188 installable: false,
Anton Hansson4d90a282020-03-09 19:14:28 +0000189 sdk_version: "module_current",
Anton Hansson087646e2020-03-24 15:21:01 +0000190 filter_packages: framework_packages_to_document,
Paul Duffin4c5dc182020-04-08 18:28:15 +0100191
192 // Do not generate stubs as they are not needed
193 generate_stubs: false,
194
Anton Hansson5d708e52020-01-17 19:03:34 +0000195 check_api: {
196 current: {
197 api_file: "api/module-lib-current.txt",
198 removed_api_file: "api/module-lib-removed.txt",
199 },
200 },
Jiyong Park7be934f2020-01-06 16:22:32 +0900201}
202
203stubs_defaults {
204 name: "framework-module-stubs-defaults-module_libs_api",
Anton Hansson26e1ed62020-03-23 13:30:01 +0000205 args: mainline_framework_stubs_args + module_libs + priv_apps,
Anton Hansson397eb472020-03-13 16:28:21 +0000206 libs: ["framework-annotations-lib"],
Anton Hansson24c88f42019-12-13 16:17:27 +0000207 installable: false,
Anton Hansson4d90a282020-03-09 19:14:28 +0000208 sdk_version: "module_current",
Anton Hansson087646e2020-03-24 15:21:01 +0000209 filter_packages: framework_packages_to_document,
Anton Hansson24c88f42019-12-13 16:17:27 +0000210}
Anton Hansson26e1ed62020-03-23 13:30:01 +0000211
212stubs_defaults {
213 name: "service-module-stubs-srcs-defaults",
214 args: mainline_service_stubs_args,
215 installable: false,
Anton Hanssonf68ef062020-03-27 15:09:26 +0000216 filter_packages: ["com.android."],
Anton Hansson26e1ed62020-03-23 13:30:01 +0000217 check_api: {
218 current: {
219 api_file: "api/current.txt",
220 removed_api_file: "api/removed.txt",
221 },
222 },
223}
224
225// Empty for now, but a convenient place to add rules for all
226// module java_library system_server stub libs.
227java_defaults {
228 name: "service-module-stubs-defaults",
229}