blob: 4e80acb64e05447e100cfdf9fa203ab43c95b588 [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 " +
Alexander Dorokhinec38a05e2020-12-04 12:17:30 -080018 "--hide CallbackInterface " +
Anton Hansson24c88f42019-12-13 16:17:27 +000019 "--hide DeprecationMismatch " +
20 "--hide HiddenSuperclass " +
21 "--hide HiddenTypedefConstant " +
22 "--hide HiddenTypeParameter " +
23 "--hide MissingPermission " +
24 "--hide RequiresPermission " +
25 "--hide SdkConstant " +
26 "--hide Todo " +
27 "--hide Typo " +
28 "--hide UnavailableSymbol "
29
Anton Hanssonf79b08b2020-03-24 15:21:01 +000030// TODO: modularize this so not every module has the same whitelist
31framework_packages_to_document = [
32 "android",
33 "dalvik",
34 "java",
35 "javax",
36 "junit",
37 "org.apache.http",
38 "org.json",
39 "org.w3c.dom",
40 "org.xml.sax",
41 "org.xmlpull",
42]
43
Anton Hansson180ec392020-03-23 13:30:01 +000044// TODO: remove the hiding when server classes are cleaned up.
45mainline_framework_stubs_args =
46 mainline_stubs_args +
47 "--hide-package com.android.server "
Anton Hansson5036ab62019-12-17 10:03:52 +000048
Anton Hanssona12addc2020-02-03 14:44:47 +000049priv_apps = " " +
50 "--show-annotation android.annotation.SystemApi\\(" +
Jiyong Parkb4f8a852020-02-25 17:12:30 +090051 "client=android.annotation.SystemApi.Client.PRIVILEGED_APPS" +
Anton Hanssona12addc2020-02-03 14:44:47 +000052 "\\) "
53
54module_libs = " " +
55 " --show-annotation android.annotation.SystemApi\\(" +
Jiyong Parkb4f8a852020-02-25 17:12:30 +090056 "client=android.annotation.SystemApi.Client.MODULE_LIBRARIES" +
Makoto Onukia13287f2020-07-10 12:05:21 -070057 "\\)" +
58 " --show-for-stub-purposes-annotation android.annotation.SystemApi\\(" +
59 "client=android.annotation.SystemApi.Client.PRIVILEGED_APPS" +
Anton Hanssona12addc2020-02-03 14:44:47 +000060 "\\) "
61
Anton Hansson180ec392020-03-23 13:30:01 +000062mainline_service_stubs_args =
63 mainline_stubs_args +
64 "--show-annotation android.annotation.SystemApi\\(" +
65 "client=android.annotation.SystemApi.Client.SYSTEM_SERVER" +
66 "\\) " +
67 "--hide-annotation android.annotation.Hide " +
68 "--hide InternalClasses " // com.android.* classes are okay in this interface
69
Paul Duffinbace9a12020-06-02 17:48:57 +010070// Defaults common to all mainline module java_sdk_library instances.
Paul Duffinbee74042020-05-13 10:17:56 +010071java_defaults {
Paul Duffinbace9a12020-06-02 17:48:57 +010072 name: "framework-module-common-defaults",
Paul Duffinbee74042020-05-13 10:17:56 +010073
74 // Additional annotations used for compiling both the implementation and the
75 // stubs libraries.
76 libs: ["framework-annotations-lib"],
77
Paul Duffin41475502020-05-22 17:12:12 +010078 // Framework modules are not generally shared libraries, i.e. they are not
79 // intended, and must not be allowed, to be used in a <uses-library> manifest
80 // entry.
81 shared_library: false,
82
Paul Duffin1a0ba1e2020-05-29 09:50:20 +010083 // Prevent dependencies that do not specify an sdk_version from accessing the
84 // implementation library by default and force them to use stubs instead.
85 default_to_stubs: true,
86
Paul Duffinbee74042020-05-13 10:17:56 +010087 // Enable api lint. This will eventually become the default for java_sdk_library
88 // but it cannot yet be turned on because some usages have not been cleaned up.
89 // TODO(b/156126315) - Remove when no longer needed.
90 api_lint: {
91 enabled: true,
92 },
93
94 // The API scope specific properties.
95 public: {
96 enabled: true,
97 sdk_version: "module_current",
98 },
Paul Duffinbee74042020-05-13 10:17:56 +010099
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
Anton Hansson70882b52020-08-18 12:52:51 +0100105 // Allow access to the stubs from anywhere
106 visibility: ["//visibility:public"],
107 stubs_library_visibility: ["//visibility:public"],
Paul Duffinbee74042020-05-13 10:17:56 +0100108
Anton Hansson70882b52020-08-18 12:52:51 +0100109 // Hide impl library and stub sources
Anton Hansson7a9bc4e2020-08-18 12:52:44 +0100110 impl_library_visibility: [
Liz Kammer09e4eb12020-10-15 10:28:13 -0700111 ":__pkg__",
Anton Hansson7a9bc4e2020-08-18 12:52:44 +0100112 "//frameworks/base", // For framework-all
113 ],
Anton Hansson70882b52020-08-18 12:52:51 +0100114 stubs_source_visibility: ["//visibility:private"],
Paul Duffinbee74042020-05-13 10:17:56 +0100115
Anton Hansson7b592972020-11-02 18:57:12 +0000116 defaults_visibility: ["//visibility:private"],
117
Paul Duffinbee74042020-05-13 10:17:56 +0100118 // Collates API usages from each module for further analysis.
119 plugins: ["java_api_finder"],
120
121 // Mainline modules should only rely on 'module_lib' APIs provided by other modules
122 // and the non updatable parts of the platform.
123 sdk_version: "module_current",
124}
125
Paul Duffinbace9a12020-06-02 17:48:57 +0100126// Defaults for mainline module provided java_sdk_library instances.
127java_defaults {
128 name: "framework-module-defaults",
129 defaults: ["framework-module-common-defaults"],
130
131 system: {
132 enabled: true,
133 sdk_version: "module_current",
134 },
135 module_lib: {
136 enabled: true,
137 sdk_version: "module_current",
138 },
139}
140
141// Defaults for mainline module system server provided java_sdk_library instances.
142java_defaults {
143 name: "framework-system-server-module-defaults",
144 defaults: ["framework-module-common-defaults"],
145
146 system_server: {
147 enabled: true,
148 sdk_version: "module_current",
149 },
150}
151
Anton Hansson24c88f42019-12-13 16:17:27 +0000152stubs_defaults {
Anton Hansson180ec392020-03-23 13:30:01 +0000153 name: "service-module-stubs-srcs-defaults",
154 args: mainline_service_stubs_args,
155 installable: false,
Anton Hansson6e9bd962020-05-20 11:51:22 +0100156 annotations_enabled: true,
157 merge_annotations_dirs: [
158 "metalava-manual",
159 ],
Anton Hansson442fcf42020-03-27 15:09:26 +0000160 filter_packages: ["com.android."],
Anton Hansson180ec392020-03-23 13:30:01 +0000161 check_api: {
162 current: {
163 api_file: "api/current.txt",
164 removed_api_file: "api/removed.txt",
165 },
Anton Hansson340954c2020-05-01 18:25:09 +0100166 api_lint: {
167 enabled: true,
168 },
Anton Hansson180ec392020-03-23 13:30:01 +0000169 },
Anton Hanssona92a23b2020-03-23 17:04:23 +0000170 dist: {
171 targets: ["sdk", "win_sdk"],
172 dir: "apistubs/android/system-server/api",
173 },
Anton Hansson180ec392020-03-23 13:30:01 +0000174}
175
176// Empty for now, but a convenient place to add rules for all
177// module java_library system_server stub libs.
178java_defaults {
179 name: "service-module-stubs-defaults",
Anton Hansson5259a142020-03-25 13:30:03 +0000180 dist: {
181 targets: ["sdk", "win_sdk"],
182 dir: "apistubs/android/system-server",
183 },
Anton Hansson180ec392020-03-23 13:30:01 +0000184}