blob: 63ec7c3017d373f129e4c8bdad6200e1b08f7ab3 [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
74 // Enable api lint. This will eventually become the default for java_sdk_library
75 // but it cannot yet be turned on because some usages have not been cleaned up.
76 // TODO(b/156126315) - Remove when no longer needed.
77 api_lint: {
78 enabled: true,
79 },
80
81 // The API scope specific properties.
82 public: {
83 enabled: true,
84 sdk_version: "module_current",
85 },
86 system: {
87 enabled: true,
88 sdk_version: "module_current",
89 },
90 module_lib: {
91 enabled: true,
92 sdk_version: "module_current",
93 },
94
Paul Duffin56195fb2020-05-17 13:00:36 +010095 // Configure framework module specific metalava options.
96 droiddoc_options: [mainline_stubs_args],
97
Paul Duffinbee74042020-05-13 10:17:56 +010098 // The stub libraries must be visible to frameworks/base so they can be combined
99 // into API specific libraries.
100 stubs_library_visibility: [
101 "//frameworks/base", // Framework
102 ],
103
104 // Set the visibility of the modules creating the stubs source.
105 stubs_source_visibility: [
106 // Ignore any visibility rules specified on the java_sdk_library when
107 // setting the visibility of the stubs source modules.
108 "//visibility:override",
109
110 // Currently, the stub source is not required for anything other than building
111 // the stubs library so is private to avoid misuse.
112 "//visibility:private",
113 ],
114
115 // Collates API usages from each module for further analysis.
116 plugins: ["java_api_finder"],
117
118 // Mainline modules should only rely on 'module_lib' APIs provided by other modules
119 // and the non updatable parts of the platform.
120 sdk_version: "module_current",
121}
122
Anton Hansson24c88f42019-12-13 16:17:27 +0000123stubs_defaults {
124 name: "framework-module-stubs-defaults-publicapi",
Anton Hansson180ec392020-03-23 13:30:01 +0000125 args: mainline_framework_stubs_args,
Anton Hansson24c88f42019-12-13 16:17:27 +0000126 installable: false,
Anton Hanssoneb34cbe2020-04-08 16:37:10 +0100127 sdk_version: "module_current",
Anton Hansson6e9bd962020-05-20 11:51:22 +0100128 annotations_enabled: true,
129 merge_annotations_dirs: [
130 "metalava-manual",
131 ],
Anton Hanssonf79b08b2020-03-24 15:21:01 +0000132 filter_packages: framework_packages_to_document,
Anton Hanssondc033c32020-01-17 19:03:34 +0000133 check_api: {
134 current: {
135 api_file: "api/current.txt",
136 removed_api_file: "api/removed.txt",
137 },
Anton Hansson340954c2020-05-01 18:25:09 +0100138 api_lint: {
139 enabled: true,
140 },
Anton Hanssondc033c32020-01-17 19:03:34 +0000141 },
Anton Hanssona92a23b2020-03-23 17:04:23 +0000142 dist: {
143 targets: ["sdk", "win_sdk"],
144 dir: "apistubs/android/public/api",
145 },
Anton Hansson24c88f42019-12-13 16:17:27 +0000146}
147
148stubs_defaults {
149 name: "framework-module-stubs-defaults-systemapi",
Anton Hansson180ec392020-03-23 13:30:01 +0000150 args: mainline_framework_stubs_args + priv_apps,
Anton Hansson3b9ac0c2020-03-13 16:28:21 +0000151 libs: ["framework-annotations-lib"],
Jiyong Park7be934f2020-01-06 16:22:32 +0900152 installable: false,
Anton Hanssoneb34cbe2020-04-08 16:37:10 +0100153 sdk_version: "module_current",
Anton Hansson6e9bd962020-05-20 11:51:22 +0100154 annotations_enabled: true,
155 merge_annotations_dirs: [
156 "metalava-manual",
157 ],
Anton Hanssonf79b08b2020-03-24 15:21:01 +0000158 filter_packages: framework_packages_to_document,
Anton Hanssondc033c32020-01-17 19:03:34 +0000159 check_api: {
160 current: {
161 api_file: "api/system-current.txt",
162 removed_api_file: "api/system-removed.txt",
163 },
Anton Hansson340954c2020-05-01 18:25:09 +0100164 api_lint: {
165 enabled: true,
166 },
Anton Hanssondc033c32020-01-17 19:03:34 +0000167 },
Anton Hanssona92a23b2020-03-23 17:04:23 +0000168 dist: {
169 targets: ["sdk", "win_sdk"],
170 dir: "apistubs/android/system/api",
171 },
Jiyong Park7be934f2020-01-06 16:22:32 +0900172}
173
Anton Hanssonb470bf32020-03-24 17:03:15 +0000174java_defaults {
175 name: "framework-module-stubs-lib-defaults-publicapi",
176 installable: false,
177 sdk_version: "module_current",
Anton Hansson6e9bd962020-05-20 11:51:22 +0100178 libs: [ "stub-annotations" ],
Anton Hansson60650132020-05-20 14:24:04 +0100179 java_version: "1.8",
Anton Hansson5259a142020-03-25 13:30:03 +0000180 dist: {
181 targets: ["sdk", "win_sdk"],
182 dir: "apistubs/android/public",
183 },
Anton Hanssonb470bf32020-03-24 17:03:15 +0000184}
185
186java_defaults {
187 name: "framework-module-stubs-lib-defaults-systemapi",
188 installable: false,
189 sdk_version: "module_current",
Anton Hansson6e9bd962020-05-20 11:51:22 +0100190 libs: [ "stub-annotations" ],
Anton Hansson60650132020-05-20 14:24:04 +0100191 java_version: "1.8",
Anton Hansson5259a142020-03-25 13:30:03 +0000192 dist: {
193 targets: ["sdk", "win_sdk"],
194 dir: "apistubs/android/system",
195 },
Anton Hanssonb470bf32020-03-24 17:03:15 +0000196}
197
198java_defaults {
199 name: "framework-module-stubs-lib-defaults-module_libs_api",
200 installable: false,
201 sdk_version: "module_current",
Anton Hansson6e9bd962020-05-20 11:51:22 +0100202 libs: [ "stub-annotations" ],
Anton Hansson60650132020-05-20 14:24:04 +0100203 java_version: "1.8",
Anton Hansson5259a142020-03-25 13:30:03 +0000204 dist: {
205 targets: ["sdk", "win_sdk"],
206 dir: "apistubs/android/module-lib",
207 },
Anton Hanssonb470bf32020-03-24 17:03:15 +0000208}
209
Anton Hanssona12addc2020-02-03 14:44:47 +0000210// The defaults for module_libs comes in two parts - defaults for API checks
211// and defaults for stub generation. This is because we want the API txt
212// files to *only* include the module_libs_api, but the stubs to include
213// module_libs_api as well as priv_apps.
214
Jiyong Park7be934f2020-01-06 16:22:32 +0900215stubs_defaults {
Anton Hanssona12addc2020-02-03 14:44:47 +0000216 name: "framework-module-api-defaults-module_libs_api",
Anton Hansson180ec392020-03-23 13:30:01 +0000217 args: mainline_framework_stubs_args + module_libs,
Anton Hansson3b9ac0c2020-03-13 16:28:21 +0000218 libs: ["framework-annotations-lib"],
Jiyong Park7be934f2020-01-06 16:22:32 +0900219 installable: false,
Anton Hansson15273532020-03-09 19:14:28 +0000220 sdk_version: "module_current",
Anton Hansson6e9bd962020-05-20 11:51:22 +0100221 annotations_enabled: true,
222 merge_annotations_dirs: [
223 "metalava-manual",
224 ],
Anton Hanssonf79b08b2020-03-24 15:21:01 +0000225 filter_packages: framework_packages_to_document,
Anton Hanssondc033c32020-01-17 19:03:34 +0000226 check_api: {
227 current: {
228 api_file: "api/module-lib-current.txt",
229 removed_api_file: "api/module-lib-removed.txt",
230 },
Anton Hansson340954c2020-05-01 18:25:09 +0100231 api_lint: {
232 enabled: true,
233 },
Anton Hanssondc033c32020-01-17 19:03:34 +0000234 },
Anton Hanssona92a23b2020-03-23 17:04:23 +0000235 dist: {
236 targets: ["sdk", "win_sdk"],
237 dir: "apistubs/android/module-lib/api",
238 },
Jiyong Park7be934f2020-01-06 16:22:32 +0900239}
240
241stubs_defaults {
242 name: "framework-module-stubs-defaults-module_libs_api",
Anton Hansson180ec392020-03-23 13:30:01 +0000243 args: mainline_framework_stubs_args + module_libs + priv_apps,
Anton Hansson3b9ac0c2020-03-13 16:28:21 +0000244 libs: ["framework-annotations-lib"],
Anton Hansson24c88f42019-12-13 16:17:27 +0000245 installable: false,
Anton Hansson15273532020-03-09 19:14:28 +0000246 sdk_version: "module_current",
Anton Hansson6e9bd962020-05-20 11:51:22 +0100247 annotations_enabled: true,
248 merge_annotations_dirs: [
249 "metalava-manual",
250 ],
Anton Hanssonf79b08b2020-03-24 15:21:01 +0000251 filter_packages: framework_packages_to_document,
Anton Hansson24c88f42019-12-13 16:17:27 +0000252}
Anton Hansson180ec392020-03-23 13:30:01 +0000253
254stubs_defaults {
255 name: "service-module-stubs-srcs-defaults",
256 args: mainline_service_stubs_args,
257 installable: false,
Anton Hansson6e9bd962020-05-20 11:51:22 +0100258 annotations_enabled: true,
259 merge_annotations_dirs: [
260 "metalava-manual",
261 ],
Anton Hansson442fcf42020-03-27 15:09:26 +0000262 filter_packages: ["com.android."],
Anton Hansson180ec392020-03-23 13:30:01 +0000263 check_api: {
264 current: {
265 api_file: "api/current.txt",
266 removed_api_file: "api/removed.txt",
267 },
Anton Hansson340954c2020-05-01 18:25:09 +0100268 api_lint: {
269 enabled: true,
270 },
Anton Hansson180ec392020-03-23 13:30:01 +0000271 },
Anton Hanssona92a23b2020-03-23 17:04:23 +0000272 dist: {
273 targets: ["sdk", "win_sdk"],
274 dir: "apistubs/android/system-server/api",
275 },
Anton Hansson180ec392020-03-23 13:30:01 +0000276}
277
278// Empty for now, but a convenient place to add rules for all
279// module java_library system_server stub libs.
280java_defaults {
281 name: "service-module-stubs-defaults",
Anton Hansson5259a142020-03-25 13:30:03 +0000282 dist: {
283 targets: ["sdk", "win_sdk"],
284 dir: "apistubs/android/system-server",
285 },
Anton Hansson180ec392020-03-23 13:30:01 +0000286}