blob: 1b149fb9bbbfe7a73d3319206454c3592141179a [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
Anton Hansson096a1752020-12-15 18:28:20 +000015package {
16 default_visibility: [":__subpackages__"],
17}
18
Anton Hansson24c88f42019-12-13 16:17:27 +000019mainline_stubs_args =
20 "--error UnhiddenSystemApi " +
21 "--hide BroadcastBehavior " +
22 "--hide DeprecationMismatch " +
23 "--hide HiddenSuperclass " +
24 "--hide HiddenTypedefConstant " +
25 "--hide HiddenTypeParameter " +
26 "--hide MissingPermission " +
27 "--hide RequiresPermission " +
28 "--hide SdkConstant " +
29 "--hide Todo " +
30 "--hide Typo " +
31 "--hide UnavailableSymbol "
32
Anton Hanssonf79b08b2020-03-24 15:21:01 +000033// TODO: modularize this so not every module has the same whitelist
34framework_packages_to_document = [
35 "android",
36 "dalvik",
37 "java",
38 "javax",
39 "junit",
40 "org.apache.http",
41 "org.json",
42 "org.w3c.dom",
43 "org.xml.sax",
44 "org.xmlpull",
45]
46
Anton Hansson180ec392020-03-23 13:30:01 +000047// TODO: remove the hiding when server classes are cleaned up.
48mainline_framework_stubs_args =
49 mainline_stubs_args +
50 "--hide-package com.android.server "
Anton Hansson5036ab62019-12-17 10:03:52 +000051
Anton Hanssona12addc2020-02-03 14:44:47 +000052priv_apps = " " +
53 "--show-annotation android.annotation.SystemApi\\(" +
Jiyong Parkb4f8a852020-02-25 17:12:30 +090054 "client=android.annotation.SystemApi.Client.PRIVILEGED_APPS" +
Anton Hanssona12addc2020-02-03 14:44:47 +000055 "\\) "
56
57module_libs = " " +
58 " --show-annotation android.annotation.SystemApi\\(" +
Jiyong Parkb4f8a852020-02-25 17:12:30 +090059 "client=android.annotation.SystemApi.Client.MODULE_LIBRARIES" +
Makoto Onukia13287f2020-07-10 12:05:21 -070060 "\\)" +
61 " --show-for-stub-purposes-annotation android.annotation.SystemApi\\(" +
62 "client=android.annotation.SystemApi.Client.PRIVILEGED_APPS" +
Anton Hanssona12addc2020-02-03 14:44:47 +000063 "\\) "
64
Anton Hansson180ec392020-03-23 13:30:01 +000065mainline_service_stubs_args =
66 mainline_stubs_args +
67 "--show-annotation android.annotation.SystemApi\\(" +
68 "client=android.annotation.SystemApi.Client.SYSTEM_SERVER" +
69 "\\) " +
70 "--hide-annotation android.annotation.Hide " +
71 "--hide InternalClasses " // com.android.* classes are okay in this interface
72
Paul Duffinbace9a12020-06-02 17:48:57 +010073// Defaults common to all mainline module java_sdk_library instances.
Paul Duffinbee74042020-05-13 10:17:56 +010074java_defaults {
Paul Duffinbace9a12020-06-02 17:48:57 +010075 name: "framework-module-common-defaults",
Paul Duffinbee74042020-05-13 10:17:56 +010076
77 // Additional annotations used for compiling both the implementation and the
78 // stubs libraries.
79 libs: ["framework-annotations-lib"],
80
Paul Duffin41475502020-05-22 17:12:12 +010081 // Framework modules are not generally shared libraries, i.e. they are not
82 // intended, and must not be allowed, to be used in a <uses-library> manifest
83 // entry.
84 shared_library: false,
85
Paul Duffin1a0ba1e2020-05-29 09:50:20 +010086 // Prevent dependencies that do not specify an sdk_version from accessing the
87 // implementation library by default and force them to use stubs instead.
88 default_to_stubs: true,
89
Paul Duffinbee74042020-05-13 10:17:56 +010090 // Enable api lint. This will eventually become the default for java_sdk_library
91 // but it cannot yet be turned on because some usages have not been cleaned up.
92 // TODO(b/156126315) - Remove when no longer needed.
93 api_lint: {
94 enabled: true,
95 },
96
97 // The API scope specific properties.
98 public: {
99 enabled: true,
100 sdk_version: "module_current",
101 },
Paul Duffinbee74042020-05-13 10:17:56 +0100102
Anton Hanssond32fadc2021-01-25 10:20:46 +0000103 // installable implies we'll create a non-apex (platform) variant, which
104 // we shouldn't ordinarily need (and it can create issues), so disable that.
105 installable: false,
106
Paul Duffin56195fb2020-05-17 13:00:36 +0100107 // Configure framework module specific metalava options.
108 droiddoc_options: [mainline_stubs_args],
109
Anton Hansson01ff6b22020-05-27 11:26:16 +0100110 annotations_enabled: true,
111
Anton Hansson70882b52020-08-18 12:52:51 +0100112 // Allow access to the stubs from anywhere
113 visibility: ["//visibility:public"],
114 stubs_library_visibility: ["//visibility:public"],
Paul Duffinbee74042020-05-13 10:17:56 +0100115
Anton Hansson70882b52020-08-18 12:52:51 +0100116 // Hide impl library and stub sources
Anton Hansson7a9bc4e2020-08-18 12:52:44 +0100117 impl_library_visibility: [
Liz Kammer09e4eb12020-10-15 10:28:13 -0700118 ":__pkg__",
Anton Hansson7a9bc4e2020-08-18 12:52:44 +0100119 "//frameworks/base", // For framework-all
120 ],
Anton Hansson70882b52020-08-18 12:52:51 +0100121 stubs_source_visibility: ["//visibility:private"],
Paul Duffinbee74042020-05-13 10:17:56 +0100122
Anton Hansson7b592972020-11-02 18:57:12 +0000123 defaults_visibility: ["//visibility:private"],
124
Paul Duffinbee74042020-05-13 10:17:56 +0100125 // Collates API usages from each module for further analysis.
126 plugins: ["java_api_finder"],
127
128 // Mainline modules should only rely on 'module_lib' APIs provided by other modules
129 // and the non updatable parts of the platform.
130 sdk_version: "module_current",
131}
132
Paul Duffinbace9a12020-06-02 17:48:57 +0100133// Defaults for mainline module provided java_sdk_library instances.
134java_defaults {
135 name: "framework-module-defaults",
136 defaults: ["framework-module-common-defaults"],
137
138 system: {
139 enabled: true,
140 sdk_version: "module_current",
141 },
142 module_lib: {
143 enabled: true,
144 sdk_version: "module_current",
145 },
Anton Hansson096a1752020-12-15 18:28:20 +0000146 defaults_visibility: [
147 ":__subpackages__",
148 "//frameworks/base/libs/hwui",
149 "//frameworks/base/wifi",
150 "//packages/modules:__subpackages__",
151 "//packages/providers/MediaProvider:__subpackages__",
152 ],
Paul Duffinbace9a12020-06-02 17:48:57 +0100153}
154
155// Defaults for mainline module system server provided java_sdk_library instances.
156java_defaults {
157 name: "framework-system-server-module-defaults",
158 defaults: ["framework-module-common-defaults"],
159
160 system_server: {
161 enabled: true,
162 sdk_version: "module_current",
163 },
Anton Hansson096a1752020-12-15 18:28:20 +0000164 defaults_visibility: [
165 ":__subpackages__",
166 "//packages/modules:__subpackages__",
167 ],
Paul Duffinbace9a12020-06-02 17:48:57 +0100168}
169
Anton Hansson24c88f42019-12-13 16:17:27 +0000170stubs_defaults {
Anton Hansson180ec392020-03-23 13:30:01 +0000171 name: "service-module-stubs-srcs-defaults",
172 args: mainline_service_stubs_args,
173 installable: false,
Anton Hansson6e9bd962020-05-20 11:51:22 +0100174 annotations_enabled: true,
175 merge_annotations_dirs: [
176 "metalava-manual",
177 ],
Anton Hansson442fcf42020-03-27 15:09:26 +0000178 filter_packages: ["com.android."],
Anton Hansson180ec392020-03-23 13:30:01 +0000179 check_api: {
180 current: {
181 api_file: "api/current.txt",
182 removed_api_file: "api/removed.txt",
183 },
Anton Hansson340954c2020-05-01 18:25:09 +0100184 api_lint: {
185 enabled: true,
186 },
Anton Hansson180ec392020-03-23 13:30:01 +0000187 },
Anton Hanssona92a23b2020-03-23 17:04:23 +0000188 dist: {
189 targets: ["sdk", "win_sdk"],
190 dir: "apistubs/android/system-server/api",
191 },
Anton Hansson180ec392020-03-23 13:30:01 +0000192}
193
194// Empty for now, but a convenient place to add rules for all
195// module java_library system_server stub libs.
196java_defaults {
197 name: "service-module-stubs-defaults",
Anton Hansson5259a142020-03-25 13:30:03 +0000198 dist: {
199 targets: ["sdk", "win_sdk"],
200 dir: "apistubs/android/system-server",
201 },
Anton Hansson180ec392020-03-23 13:30:01 +0000202}