blob: 388b24a4d5f5927984e09e8382357b665d1221a9 [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" +
Makoto Onukia13287f2020-07-10 12:05:21 -070056 "\\)" +
57 " --show-for-stub-purposes-annotation android.annotation.SystemApi\\(" +
58 "client=android.annotation.SystemApi.Client.PRIVILEGED_APPS" +
Anton Hanssona12addc2020-02-03 14:44:47 +000059 "\\) "
60
Anton Hansson26e1ed62020-03-23 13:30:01 +000061mainline_service_stubs_args =
62 mainline_stubs_args +
63 "--show-annotation android.annotation.SystemApi\\(" +
64 "client=android.annotation.SystemApi.Client.SYSTEM_SERVER" +
65 "\\) " +
66 "--hide-annotation android.annotation.Hide " +
67 "--hide InternalClasses " // com.android.* classes are okay in this interface
68
Paul Duffin13e67af2020-05-13 10:17:56 +010069// Defaults for mainline module provided java_sdk_library instances.
70java_defaults {
71 name: "framework-module-defaults",
72
73 // Additional annotations used for compiling both the implementation and the
74 // stubs libraries.
75 libs: ["framework-annotations-lib"],
76
Paul Duffin077b4df2020-05-22 17:12:12 +010077 // Framework modules are not generally shared libraries, i.e. they are not
78 // intended, and must not be allowed, to be used in a <uses-library> manifest
79 // entry.
80 shared_library: false,
81
Paul Duffin1a0ba1e2020-05-29 09:50:20 +010082 // Prevent dependencies that do not specify an sdk_version from accessing the
83 // implementation library by default and force them to use stubs instead.
84 default_to_stubs: true,
85
Paul Duffin13e67af2020-05-13 10:17:56 +010086 // Enable api lint. This will eventually become the default for java_sdk_library
87 // but it cannot yet be turned on because some usages have not been cleaned up.
88 // TODO(b/156126315) - Remove when no longer needed.
89 api_lint: {
90 enabled: true,
91 },
92
93 // The API scope specific properties.
94 public: {
95 enabled: true,
96 sdk_version: "module_current",
97 },
98 system: {
99 enabled: true,
100 sdk_version: "module_current",
101 },
102 module_lib: {
103 enabled: true,
104 sdk_version: "module_current",
105 },
106
Paul Duffin067d80b2020-05-17 13:00:36 +0100107 // Configure framework module specific metalava options.
108 droiddoc_options: [mainline_stubs_args],
109
Anton Hansson7d74e592020-05-27 11:26:16 +0100110 annotations_enabled: true,
111
Paul Duffin13e67af2020-05-13 10:17:56 +0100112 stubs_library_visibility: [
Anton Hansson02e7f102020-07-02 16:41:45 +0100113 "//visibility:public",
Paul Duffin13e67af2020-05-13 10:17:56 +0100114 ],
115
116 // Set the visibility of the modules creating the stubs source.
117 stubs_source_visibility: [
118 // Ignore any visibility rules specified on the java_sdk_library when
119 // setting the visibility of the stubs source modules.
120 "//visibility:override",
121
122 // Currently, the stub source is not required for anything other than building
123 // the stubs library so is private to avoid misuse.
124 "//visibility:private",
125 ],
126
127 // Collates API usages from each module for further analysis.
128 plugins: ["java_api_finder"],
129
130 // Mainline modules should only rely on 'module_lib' APIs provided by other modules
131 // and the non updatable parts of the platform.
132 sdk_version: "module_current",
133}
134
Anton Hansson24c88f42019-12-13 16:17:27 +0000135stubs_defaults {
136 name: "framework-module-stubs-defaults-publicapi",
Anton Hansson26e1ed62020-03-23 13:30:01 +0000137 args: mainline_framework_stubs_args,
Anton Hansson24c88f42019-12-13 16:17:27 +0000138 installable: false,
Anton Hansson369bafa2020-04-08 16:37:10 +0100139 sdk_version: "module_current",
Anton Hansson8e4f83b2020-05-20 11:51:22 +0100140 annotations_enabled: true,
141 merge_annotations_dirs: [
142 "metalava-manual",
143 ],
Anton Hansson087646e2020-03-24 15:21:01 +0000144 filter_packages: framework_packages_to_document,
Anton Hansson5d708e52020-01-17 19:03:34 +0000145 check_api: {
146 current: {
147 api_file: "api/current.txt",
148 removed_api_file: "api/removed.txt",
149 },
150 },
Anton Hanssondb43d8f2020-03-23 17:04:23 +0000151 dist: {
152 targets: ["sdk", "win_sdk"],
153 dir: "apistubs/android/public/api",
154 },
Anton Hansson24c88f42019-12-13 16:17:27 +0000155}
156
157stubs_defaults {
158 name: "framework-module-stubs-defaults-systemapi",
Anton Hansson26e1ed62020-03-23 13:30:01 +0000159 args: mainline_framework_stubs_args + priv_apps,
Anton Hansson397eb472020-03-13 16:28:21 +0000160 libs: ["framework-annotations-lib"],
Jiyong Park7be934f2020-01-06 16:22:32 +0900161 installable: false,
Anton Hansson369bafa2020-04-08 16:37:10 +0100162 sdk_version: "module_current",
Anton Hansson8e4f83b2020-05-20 11:51:22 +0100163 annotations_enabled: true,
164 merge_annotations_dirs: [
165 "metalava-manual",
166 ],
Anton Hansson087646e2020-03-24 15:21:01 +0000167 filter_packages: framework_packages_to_document,
Anton Hansson5d708e52020-01-17 19:03:34 +0000168 check_api: {
169 current: {
170 api_file: "api/system-current.txt",
171 removed_api_file: "api/system-removed.txt",
172 },
173 },
Anton Hanssondb43d8f2020-03-23 17:04:23 +0000174 dist: {
175 targets: ["sdk", "win_sdk"],
176 dir: "apistubs/android/system/api",
177 },
Jiyong Park7be934f2020-01-06 16:22:32 +0900178}
179
Anton Hanssonc8cc1eb2020-03-24 17:03:15 +0000180java_defaults {
181 name: "framework-module-stubs-lib-defaults-publicapi",
182 installable: false,
183 sdk_version: "module_current",
Anton Hansson8e4f83b2020-05-20 11:51:22 +0100184 libs: [ "stub-annotations" ],
Anton Hansson6f646a52020-03-25 13:30:03 +0000185 dist: {
186 targets: ["sdk", "win_sdk"],
187 dir: "apistubs/android/public",
188 },
Anton Hanssonc8cc1eb2020-03-24 17:03:15 +0000189}
190
191java_defaults {
192 name: "framework-module-stubs-lib-defaults-systemapi",
193 installable: false,
194 sdk_version: "module_current",
Anton Hansson8e4f83b2020-05-20 11:51:22 +0100195 libs: [ "stub-annotations" ],
Anton Hansson6f646a52020-03-25 13:30:03 +0000196 dist: {
197 targets: ["sdk", "win_sdk"],
198 dir: "apistubs/android/system",
199 },
Anton Hanssonc8cc1eb2020-03-24 17:03:15 +0000200}
201
202java_defaults {
203 name: "framework-module-stubs-lib-defaults-module_libs_api",
204 installable: false,
205 sdk_version: "module_current",
Anton Hansson8e4f83b2020-05-20 11:51:22 +0100206 libs: [ "stub-annotations" ],
Anton Hansson6f646a52020-03-25 13:30:03 +0000207 dist: {
208 targets: ["sdk", "win_sdk"],
209 dir: "apistubs/android/module-lib",
210 },
Anton Hanssonc8cc1eb2020-03-24 17:03:15 +0000211}
212
Anton Hanssona12addc2020-02-03 14:44:47 +0000213// The defaults for module_libs comes in two parts - defaults for API checks
214// and defaults for stub generation. This is because we want the API txt
215// files to *only* include the module_libs_api, but the stubs to include
216// module_libs_api as well as priv_apps.
217
Jiyong Park7be934f2020-01-06 16:22:32 +0900218stubs_defaults {
Anton Hanssona12addc2020-02-03 14:44:47 +0000219 name: "framework-module-api-defaults-module_libs_api",
Anton Hansson26e1ed62020-03-23 13:30:01 +0000220 args: mainline_framework_stubs_args + module_libs,
Anton Hansson397eb472020-03-13 16:28:21 +0000221 libs: ["framework-annotations-lib"],
Jiyong Park7be934f2020-01-06 16:22:32 +0900222 installable: false,
Anton Hansson4d90a282020-03-09 19:14:28 +0000223 sdk_version: "module_current",
Anton Hansson8e4f83b2020-05-20 11:51:22 +0100224 annotations_enabled: true,
225 merge_annotations_dirs: [
226 "metalava-manual",
227 ],
Anton Hansson087646e2020-03-24 15:21:01 +0000228 filter_packages: framework_packages_to_document,
Paul Duffin4c5dc182020-04-08 18:28:15 +0100229
230 // Do not generate stubs as they are not needed
231 generate_stubs: false,
232
Anton Hansson5d708e52020-01-17 19:03:34 +0000233 check_api: {
234 current: {
235 api_file: "api/module-lib-current.txt",
236 removed_api_file: "api/module-lib-removed.txt",
237 },
238 },
Anton Hanssondb43d8f2020-03-23 17:04:23 +0000239 dist: {
240 targets: ["sdk", "win_sdk"],
241 dir: "apistubs/android/module-lib/api",
242 },
Jiyong Park7be934f2020-01-06 16:22:32 +0900243}
244
245stubs_defaults {
246 name: "framework-module-stubs-defaults-module_libs_api",
Anton Hansson26e1ed62020-03-23 13:30:01 +0000247 args: mainline_framework_stubs_args + module_libs + priv_apps,
Anton Hansson397eb472020-03-13 16:28:21 +0000248 libs: ["framework-annotations-lib"],
Anton Hansson24c88f42019-12-13 16:17:27 +0000249 installable: false,
Anton Hansson4d90a282020-03-09 19:14:28 +0000250 sdk_version: "module_current",
Anton Hansson8e4f83b2020-05-20 11:51:22 +0100251 annotations_enabled: true,
252 merge_annotations_dirs: [
253 "metalava-manual",
254 ],
Anton Hansson087646e2020-03-24 15:21:01 +0000255 filter_packages: framework_packages_to_document,
Anton Hansson24c88f42019-12-13 16:17:27 +0000256}
Anton Hansson26e1ed62020-03-23 13:30:01 +0000257
258stubs_defaults {
259 name: "service-module-stubs-srcs-defaults",
260 args: mainline_service_stubs_args,
261 installable: false,
Anton Hansson8e4f83b2020-05-20 11:51:22 +0100262 annotations_enabled: true,
263 merge_annotations_dirs: [
264 "metalava-manual",
265 ],
Anton Hanssonf68ef062020-03-27 15:09:26 +0000266 filter_packages: ["com.android."],
Anton Hansson26e1ed62020-03-23 13:30:01 +0000267 check_api: {
268 current: {
269 api_file: "api/current.txt",
270 removed_api_file: "api/removed.txt",
271 },
272 },
Anton Hanssondb43d8f2020-03-23 17:04:23 +0000273 dist: {
274 targets: ["sdk", "win_sdk"],
275 dir: "apistubs/android/system-server/api",
276 },
Anton Hansson26e1ed62020-03-23 13:30:01 +0000277}
278
279// Empty for now, but a convenient place to add rules for all
280// module java_library system_server stub libs.
281java_defaults {
282 name: "service-module-stubs-defaults",
Anton Hansson6f646a52020-03-25 13:30:03 +0000283 dist: {
284 targets: ["sdk", "win_sdk"],
285 dir: "apistubs/android/system-server",
286 },
Anton Hansson26e1ed62020-03-23 13:30:01 +0000287}