blob: de4b24aa274c75395b2fac599d6a6b4f50fee7d7 [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 Hanssonf79b08b2020-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 Hansson180ec392020-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 Parkb4f8a852020-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 Parkb4f8a852020-02-25 17:12:30 +090055 "client=android.annotation.SystemApi.Client.MODULE_LIBRARIES" +
Anton Hanssona12addc2020-02-03 14:44:47 +000056 "\\) "
57
Anton Hansson180ec392020-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 Duffinbee74042020-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 Duffin41475502020-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 Duffinbee74042020-05-13 10:17:56 +010079 // Enable api lint. This will eventually become the default for java_sdk_library
80 // but it cannot yet be turned on because some usages have not been cleaned up.
81 // TODO(b/156126315) - Remove when no longer needed.
82 api_lint: {
83 enabled: true,
84 },
85
86 // The API scope specific properties.
87 public: {
88 enabled: true,
89 sdk_version: "module_current",
90 },
91 system: {
92 enabled: true,
93 sdk_version: "module_current",
94 },
95 module_lib: {
96 enabled: true,
97 sdk_version: "module_current",
98 },
99
Paul Duffin56195fb2020-05-17 13:00:36 +0100100 // Configure framework module specific metalava options.
101 droiddoc_options: [mainline_stubs_args],
102
Paul Duffinbee74042020-05-13 10:17:56 +0100103 // The stub libraries must be visible to frameworks/base so they can be combined
104 // into API specific libraries.
105 stubs_library_visibility: [
106 "//frameworks/base", // Framework
107 ],
108
109 // Set the visibility of the modules creating the stubs source.
110 stubs_source_visibility: [
111 // Ignore any visibility rules specified on the java_sdk_library when
112 // setting the visibility of the stubs source modules.
113 "//visibility:override",
114
115 // Currently, the stub source is not required for anything other than building
116 // the stubs library so is private to avoid misuse.
117 "//visibility:private",
118 ],
119
120 // Collates API usages from each module for further analysis.
121 plugins: ["java_api_finder"],
122
123 // Mainline modules should only rely on 'module_lib' APIs provided by other modules
124 // and the non updatable parts of the platform.
125 sdk_version: "module_current",
126}
127
Anton Hansson24c88f42019-12-13 16:17:27 +0000128stubs_defaults {
129 name: "framework-module-stubs-defaults-publicapi",
Anton Hansson180ec392020-03-23 13:30:01 +0000130 args: mainline_framework_stubs_args,
Anton Hansson24c88f42019-12-13 16:17:27 +0000131 installable: false,
Anton Hanssoneb34cbe2020-04-08 16:37:10 +0100132 sdk_version: "module_current",
Anton Hansson6e9bd962020-05-20 11:51:22 +0100133 annotations_enabled: true,
134 merge_annotations_dirs: [
135 "metalava-manual",
136 ],
Anton Hanssonf79b08b2020-03-24 15:21:01 +0000137 filter_packages: framework_packages_to_document,
Anton Hanssondc033c32020-01-17 19:03:34 +0000138 check_api: {
139 current: {
140 api_file: "api/current.txt",
141 removed_api_file: "api/removed.txt",
142 },
Anton Hansson340954c2020-05-01 18:25:09 +0100143 api_lint: {
144 enabled: true,
145 },
Anton Hanssondc033c32020-01-17 19:03:34 +0000146 },
Anton Hanssona92a23b2020-03-23 17:04:23 +0000147 dist: {
148 targets: ["sdk", "win_sdk"],
149 dir: "apistubs/android/public/api",
150 },
Anton Hansson24c88f42019-12-13 16:17:27 +0000151}
152
153stubs_defaults {
154 name: "framework-module-stubs-defaults-systemapi",
Anton Hansson180ec392020-03-23 13:30:01 +0000155 args: mainline_framework_stubs_args + priv_apps,
Anton Hansson3b9ac0c2020-03-13 16:28:21 +0000156 libs: ["framework-annotations-lib"],
Jiyong Park7be934f2020-01-06 16:22:32 +0900157 installable: false,
Anton Hanssoneb34cbe2020-04-08 16:37:10 +0100158 sdk_version: "module_current",
Anton Hansson6e9bd962020-05-20 11:51:22 +0100159 annotations_enabled: true,
160 merge_annotations_dirs: [
161 "metalava-manual",
162 ],
Anton Hanssonf79b08b2020-03-24 15:21:01 +0000163 filter_packages: framework_packages_to_document,
Anton Hanssondc033c32020-01-17 19:03:34 +0000164 check_api: {
165 current: {
166 api_file: "api/system-current.txt",
167 removed_api_file: "api/system-removed.txt",
168 },
Anton Hansson340954c2020-05-01 18:25:09 +0100169 api_lint: {
170 enabled: true,
171 },
Anton Hanssondc033c32020-01-17 19:03:34 +0000172 },
Anton Hanssona92a23b2020-03-23 17:04:23 +0000173 dist: {
174 targets: ["sdk", "win_sdk"],
175 dir: "apistubs/android/system/api",
176 },
Jiyong Park7be934f2020-01-06 16:22:32 +0900177}
178
Anton Hanssonb470bf32020-03-24 17:03:15 +0000179java_defaults {
180 name: "framework-module-stubs-lib-defaults-publicapi",
181 installable: false,
182 sdk_version: "module_current",
Anton Hansson6e9bd962020-05-20 11:51:22 +0100183 libs: [ "stub-annotations" ],
Anton Hansson60650132020-05-20 14:24:04 +0100184 java_version: "1.8",
Anton Hansson5259a142020-03-25 13:30:03 +0000185 dist: {
186 targets: ["sdk", "win_sdk"],
187 dir: "apistubs/android/public",
188 },
Anton Hanssonb470bf32020-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 Hansson6e9bd962020-05-20 11:51:22 +0100195 libs: [ "stub-annotations" ],
Anton Hansson60650132020-05-20 14:24:04 +0100196 java_version: "1.8",
Anton Hansson5259a142020-03-25 13:30:03 +0000197 dist: {
198 targets: ["sdk", "win_sdk"],
199 dir: "apistubs/android/system",
200 },
Anton Hanssonb470bf32020-03-24 17:03:15 +0000201}
202
203java_defaults {
204 name: "framework-module-stubs-lib-defaults-module_libs_api",
205 installable: false,
206 sdk_version: "module_current",
Anton Hansson6e9bd962020-05-20 11:51:22 +0100207 libs: [ "stub-annotations" ],
Anton Hansson60650132020-05-20 14:24:04 +0100208 java_version: "1.8",
Anton Hansson5259a142020-03-25 13:30:03 +0000209 dist: {
210 targets: ["sdk", "win_sdk"],
211 dir: "apistubs/android/module-lib",
212 },
Anton Hanssonb470bf32020-03-24 17:03:15 +0000213}
214
Anton Hanssona12addc2020-02-03 14:44:47 +0000215// The defaults for module_libs comes in two parts - defaults for API checks
216// and defaults for stub generation. This is because we want the API txt
217// files to *only* include the module_libs_api, but the stubs to include
218// module_libs_api as well as priv_apps.
219
Jiyong Park7be934f2020-01-06 16:22:32 +0900220stubs_defaults {
Anton Hanssona12addc2020-02-03 14:44:47 +0000221 name: "framework-module-api-defaults-module_libs_api",
Anton Hansson180ec392020-03-23 13:30:01 +0000222 args: mainline_framework_stubs_args + module_libs,
Anton Hansson3b9ac0c2020-03-13 16:28:21 +0000223 libs: ["framework-annotations-lib"],
Jiyong Park7be934f2020-01-06 16:22:32 +0900224 installable: false,
Anton Hansson15273532020-03-09 19:14:28 +0000225 sdk_version: "module_current",
Anton Hansson6e9bd962020-05-20 11:51:22 +0100226 annotations_enabled: true,
227 merge_annotations_dirs: [
228 "metalava-manual",
229 ],
Anton Hanssonf79b08b2020-03-24 15:21:01 +0000230 filter_packages: framework_packages_to_document,
Anton Hanssondc033c32020-01-17 19:03:34 +0000231 check_api: {
232 current: {
233 api_file: "api/module-lib-current.txt",
234 removed_api_file: "api/module-lib-removed.txt",
235 },
Anton Hansson340954c2020-05-01 18:25:09 +0100236 api_lint: {
237 enabled: true,
238 },
Anton Hanssondc033c32020-01-17 19:03:34 +0000239 },
Anton Hanssona92a23b2020-03-23 17:04:23 +0000240 dist: {
241 targets: ["sdk", "win_sdk"],
242 dir: "apistubs/android/module-lib/api",
243 },
Jiyong Park7be934f2020-01-06 16:22:32 +0900244}
245
246stubs_defaults {
247 name: "framework-module-stubs-defaults-module_libs_api",
Anton Hansson180ec392020-03-23 13:30:01 +0000248 args: mainline_framework_stubs_args + module_libs + priv_apps,
Anton Hansson3b9ac0c2020-03-13 16:28:21 +0000249 libs: ["framework-annotations-lib"],
Anton Hansson24c88f42019-12-13 16:17:27 +0000250 installable: false,
Anton Hansson15273532020-03-09 19:14:28 +0000251 sdk_version: "module_current",
Anton Hansson6e9bd962020-05-20 11:51:22 +0100252 annotations_enabled: true,
253 merge_annotations_dirs: [
254 "metalava-manual",
255 ],
Anton Hanssonf79b08b2020-03-24 15:21:01 +0000256 filter_packages: framework_packages_to_document,
Anton Hansson24c88f42019-12-13 16:17:27 +0000257}
Anton Hansson180ec392020-03-23 13:30:01 +0000258
259stubs_defaults {
260 name: "service-module-stubs-srcs-defaults",
261 args: mainline_service_stubs_args,
262 installable: false,
Anton Hansson6e9bd962020-05-20 11:51:22 +0100263 annotations_enabled: true,
264 merge_annotations_dirs: [
265 "metalava-manual",
266 ],
Anton Hansson442fcf42020-03-27 15:09:26 +0000267 filter_packages: ["com.android."],
Anton Hansson180ec392020-03-23 13:30:01 +0000268 check_api: {
269 current: {
270 api_file: "api/current.txt",
271 removed_api_file: "api/removed.txt",
272 },
Anton Hansson340954c2020-05-01 18:25:09 +0100273 api_lint: {
274 enabled: true,
275 },
Anton Hansson180ec392020-03-23 13:30:01 +0000276 },
Anton Hanssona92a23b2020-03-23 17:04:23 +0000277 dist: {
278 targets: ["sdk", "win_sdk"],
279 dir: "apistubs/android/system-server/api",
280 },
Anton Hansson180ec392020-03-23 13:30:01 +0000281}
282
283// Empty for now, but a convenient place to add rules for all
284// module java_library system_server stub libs.
285java_defaults {
286 name: "service-module-stubs-defaults",
Anton Hansson5259a142020-03-25 13:30:03 +0000287 dist: {
288 targets: ["sdk", "win_sdk"],
289 dir: "apistubs/android/system-server",
290 },
Anton Hansson180ec392020-03-23 13:30:01 +0000291}