blob: c1715a002d6d19375e42cc74b1b0b33c9315f851 [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
Anton Hansson01ff6b22020-05-27 11:26:16 +0100103 annotations_enabled: true,
104
Paul Duffinbee74042020-05-13 10:17:56 +0100105 // The stub libraries must be visible to frameworks/base so they can be combined
106 // into API specific libraries.
107 stubs_library_visibility: [
108 "//frameworks/base", // Framework
109 ],
110
111 // Set the visibility of the modules creating the stubs source.
112 stubs_source_visibility: [
113 // Ignore any visibility rules specified on the java_sdk_library when
114 // setting the visibility of the stubs source modules.
115 "//visibility:override",
116
117 // Currently, the stub source is not required for anything other than building
118 // the stubs library so is private to avoid misuse.
119 "//visibility:private",
120 ],
121
122 // Collates API usages from each module for further analysis.
123 plugins: ["java_api_finder"],
124
125 // Mainline modules should only rely on 'module_lib' APIs provided by other modules
126 // and the non updatable parts of the platform.
127 sdk_version: "module_current",
128}
129
Anton Hansson24c88f42019-12-13 16:17:27 +0000130stubs_defaults {
131 name: "framework-module-stubs-defaults-publicapi",
Anton Hansson180ec392020-03-23 13:30:01 +0000132 args: mainline_framework_stubs_args,
Anton Hansson24c88f42019-12-13 16:17:27 +0000133 installable: false,
Anton Hanssoneb34cbe2020-04-08 16:37:10 +0100134 sdk_version: "module_current",
Anton Hansson6e9bd962020-05-20 11:51:22 +0100135 annotations_enabled: true,
136 merge_annotations_dirs: [
137 "metalava-manual",
138 ],
Anton Hanssonf79b08b2020-03-24 15:21:01 +0000139 filter_packages: framework_packages_to_document,
Anton Hanssondc033c32020-01-17 19:03:34 +0000140 check_api: {
141 current: {
142 api_file: "api/current.txt",
143 removed_api_file: "api/removed.txt",
144 },
Anton Hansson340954c2020-05-01 18:25:09 +0100145 api_lint: {
146 enabled: true,
147 },
Anton Hanssondc033c32020-01-17 19:03:34 +0000148 },
Anton Hanssona92a23b2020-03-23 17:04:23 +0000149 dist: {
150 targets: ["sdk", "win_sdk"],
151 dir: "apistubs/android/public/api",
152 },
Anton Hansson24c88f42019-12-13 16:17:27 +0000153}
154
155stubs_defaults {
156 name: "framework-module-stubs-defaults-systemapi",
Anton Hansson180ec392020-03-23 13:30:01 +0000157 args: mainline_framework_stubs_args + priv_apps,
Anton Hansson3b9ac0c2020-03-13 16:28:21 +0000158 libs: ["framework-annotations-lib"],
Jiyong Park7be934f2020-01-06 16:22:32 +0900159 installable: false,
Anton Hanssoneb34cbe2020-04-08 16:37:10 +0100160 sdk_version: "module_current",
Anton Hansson6e9bd962020-05-20 11:51:22 +0100161 annotations_enabled: true,
162 merge_annotations_dirs: [
163 "metalava-manual",
164 ],
Anton Hanssonf79b08b2020-03-24 15:21:01 +0000165 filter_packages: framework_packages_to_document,
Anton Hanssondc033c32020-01-17 19:03:34 +0000166 check_api: {
167 current: {
168 api_file: "api/system-current.txt",
169 removed_api_file: "api/system-removed.txt",
170 },
Anton Hansson340954c2020-05-01 18:25:09 +0100171 api_lint: {
172 enabled: true,
173 },
Anton Hanssondc033c32020-01-17 19:03:34 +0000174 },
Anton Hanssona92a23b2020-03-23 17:04:23 +0000175 dist: {
176 targets: ["sdk", "win_sdk"],
177 dir: "apistubs/android/system/api",
178 },
Jiyong Park7be934f2020-01-06 16:22:32 +0900179}
180
Anton Hanssonb470bf32020-03-24 17:03:15 +0000181java_defaults {
182 name: "framework-module-stubs-lib-defaults-publicapi",
183 installable: false,
184 sdk_version: "module_current",
Anton Hansson6e9bd962020-05-20 11:51:22 +0100185 libs: [ "stub-annotations" ],
Anton Hansson60650132020-05-20 14:24:04 +0100186 java_version: "1.8",
Anton Hansson5259a142020-03-25 13:30:03 +0000187 dist: {
188 targets: ["sdk", "win_sdk"],
189 dir: "apistubs/android/public",
190 },
Anton Hanssonb470bf32020-03-24 17:03:15 +0000191}
192
193java_defaults {
194 name: "framework-module-stubs-lib-defaults-systemapi",
195 installable: false,
196 sdk_version: "module_current",
Anton Hansson6e9bd962020-05-20 11:51:22 +0100197 libs: [ "stub-annotations" ],
Anton Hansson60650132020-05-20 14:24:04 +0100198 java_version: "1.8",
Anton Hansson5259a142020-03-25 13:30:03 +0000199 dist: {
200 targets: ["sdk", "win_sdk"],
201 dir: "apistubs/android/system",
202 },
Anton Hanssonb470bf32020-03-24 17:03:15 +0000203}
204
205java_defaults {
206 name: "framework-module-stubs-lib-defaults-module_libs_api",
207 installable: false,
208 sdk_version: "module_current",
Anton Hansson6e9bd962020-05-20 11:51:22 +0100209 libs: [ "stub-annotations" ],
Anton Hansson60650132020-05-20 14:24:04 +0100210 java_version: "1.8",
Anton Hansson5259a142020-03-25 13:30:03 +0000211 dist: {
212 targets: ["sdk", "win_sdk"],
213 dir: "apistubs/android/module-lib",
214 },
Anton Hanssonb470bf32020-03-24 17:03:15 +0000215}
216
Anton Hanssona12addc2020-02-03 14:44:47 +0000217// The defaults for module_libs comes in two parts - defaults for API checks
218// and defaults for stub generation. This is because we want the API txt
219// files to *only* include the module_libs_api, but the stubs to include
220// module_libs_api as well as priv_apps.
221
Jiyong Park7be934f2020-01-06 16:22:32 +0900222stubs_defaults {
Anton Hanssona12addc2020-02-03 14:44:47 +0000223 name: "framework-module-api-defaults-module_libs_api",
Anton Hansson180ec392020-03-23 13:30:01 +0000224 args: mainline_framework_stubs_args + module_libs,
Anton Hansson3b9ac0c2020-03-13 16:28:21 +0000225 libs: ["framework-annotations-lib"],
Jiyong Park7be934f2020-01-06 16:22:32 +0900226 installable: false,
Anton Hansson15273532020-03-09 19:14:28 +0000227 sdk_version: "module_current",
Anton Hansson6e9bd962020-05-20 11:51:22 +0100228 annotations_enabled: true,
229 merge_annotations_dirs: [
230 "metalava-manual",
231 ],
Anton Hanssonf79b08b2020-03-24 15:21:01 +0000232 filter_packages: framework_packages_to_document,
Anton Hanssondc033c32020-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 },
Anton Hansson340954c2020-05-01 18:25:09 +0100238 api_lint: {
239 enabled: true,
240 },
Anton Hanssondc033c32020-01-17 19:03:34 +0000241 },
Anton Hanssona92a23b2020-03-23 17:04:23 +0000242 dist: {
243 targets: ["sdk", "win_sdk"],
244 dir: "apistubs/android/module-lib/api",
245 },
Jiyong Park7be934f2020-01-06 16:22:32 +0900246}
247
248stubs_defaults {
249 name: "framework-module-stubs-defaults-module_libs_api",
Anton Hansson180ec392020-03-23 13:30:01 +0000250 args: mainline_framework_stubs_args + module_libs + priv_apps,
Anton Hansson3b9ac0c2020-03-13 16:28:21 +0000251 libs: ["framework-annotations-lib"],
Anton Hansson24c88f42019-12-13 16:17:27 +0000252 installable: false,
Anton Hansson15273532020-03-09 19:14:28 +0000253 sdk_version: "module_current",
Anton Hansson6e9bd962020-05-20 11:51:22 +0100254 annotations_enabled: true,
255 merge_annotations_dirs: [
256 "metalava-manual",
257 ],
Anton Hanssonf79b08b2020-03-24 15:21:01 +0000258 filter_packages: framework_packages_to_document,
Anton Hansson24c88f42019-12-13 16:17:27 +0000259}
Anton Hansson180ec392020-03-23 13:30:01 +0000260
261stubs_defaults {
262 name: "service-module-stubs-srcs-defaults",
263 args: mainline_service_stubs_args,
264 installable: false,
Anton Hansson6e9bd962020-05-20 11:51:22 +0100265 annotations_enabled: true,
266 merge_annotations_dirs: [
267 "metalava-manual",
268 ],
Anton Hansson442fcf42020-03-27 15:09:26 +0000269 filter_packages: ["com.android."],
Anton Hansson180ec392020-03-23 13:30:01 +0000270 check_api: {
271 current: {
272 api_file: "api/current.txt",
273 removed_api_file: "api/removed.txt",
274 },
Anton Hansson340954c2020-05-01 18:25:09 +0100275 api_lint: {
276 enabled: true,
277 },
Anton Hansson180ec392020-03-23 13:30:01 +0000278 },
Anton Hanssona92a23b2020-03-23 17:04:23 +0000279 dist: {
280 targets: ["sdk", "win_sdk"],
281 dir: "apistubs/android/system-server/api",
282 },
Anton Hansson180ec392020-03-23 13:30:01 +0000283}
284
285// Empty for now, but a convenient place to add rules for all
286// module java_library system_server stub libs.
287java_defaults {
288 name: "service-module-stubs-defaults",
Anton Hansson5259a142020-03-25 13:30:03 +0000289 dist: {
290 targets: ["sdk", "win_sdk"],
291 dir: "apistubs/android/system-server",
292 },
Anton Hansson180ec392020-03-23 13:30:01 +0000293}