Debian Codegraph @

api/Android.bp

raw
1 // Copyright (C) 2020 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
15 package {
16 default_visibility: ["//visibility:private"],
17 // See: http://go/android-license-faq
18 // A large-scale-change added 'default_applicable_licenses' to import
19 // all of the 'license_kinds' from "frameworks_base_license"
20 // to get the below license kinds:
21 // SPDX-license-identifier-Apache-2.0
22 // SPDX-license-identifier-MIT
23 // SPDX-license-identifier-Unicode-DFS
24 default_applicable_licenses: ["frameworks_base_license"],
25 }
26
27 bootstrap_go_package {
28 name: "soong-api",
29 pkgPath: "android/soong/api",
30 deps: [
31 "blueprint",
32 "soong",
33 "soong-android",
34 "soong-bp2build",
35 "soong-genrule",
36 "soong-java",
37 ],
38 srcs: ["api.go"],
39 testSrcs: ["api_test.go"],
40 pluginFor: ["soong_build"],
41 }
42
43 python_binary_host {
44 name: "merge_annotation_zips",
45 srcs: ["merge_annotation_zips.py"],
46 }
47
48 python_test_host {
49 name: "merge_annotation_zips_test",
50 main: "merge_annotation_zips_test.py",
51 srcs: [
52 "merge_annotation_zips.py",
53 "merge_annotation_zips_test.py",
54 ],
55 test_options: {
56 unit_test: true,
57 },
58 }
59
60 metalava_cmd = "$(location metalava)"
61 // Silence reflection warnings. See b/168689341
62 metalava_cmd += " -J--add-opens=java.base/java.util=ALL-UNNAMED "
63 metalava_cmd += " --quiet --no-banner --format=v2 "
64
65 genrule {
66 name: "current-api-xml",
67 tools: ["metalava"],
68 srcs: [":frameworks-base-api-current.txt"],
69 out: ["current.api"],
70 cmd: metalava_cmd + "-convert2xmlnostrip $(in) $(out)",
71 visibility: ["//visibility:public"],
72 }
73
74 combined_apis {
75 name: "frameworks-base-api",
76 bootclasspath: [
77 "android.net.ipsec.ike",
78 "art.module.public.api",
79 "conscrypt.module.public.api",
80 "framework-adservices",
81 "framework-appsearch",
82 "framework-bluetooth",
83 "framework-connectivity",
84 "framework-connectivity-t",
85 "framework-graphics",
86 "framework-media",
87 "framework-mediaprovider",
88 "framework-ondevicepersonalization",
89 "framework-permission",
90 "framework-permission-s",
91 "framework-scheduling",
92 "framework-sdkextensions",
93 "framework-statsd",
94 "framework-sdksandbox",
95 "framework-tethering",
96 "framework-uwb",
97 "framework-virtualization",
98 "framework-wifi",
99 "i18n.module.public.api",
100 ],
101 system_server_classpath: [
102 "service-media-s",
103 "service-permission",
104 "service-rkp",
105 "service-sdksandbox",
106 ],
107 }
108
109 genrule {
110 name: "frameworks-base-api-current-compat",
111 srcs: [
112 ":android.api.public.latest",
113 ":android-incompatibilities.api.public.latest",
114 ":frameworks-base-api-current.txt",
115 ],
116 out: ["updated-baseline.txt"],
117 tools: ["metalava"],
118 cmd: metalava_cmd +
119 "--check-compatibility:api:released $(location :android.api.public.latest) " +
120 "--baseline:compatibility:released $(location :android-incompatibilities.api.public.latest) " +
121 "--update-baseline:compatibility:released $(genDir)/updated-baseline.txt " +
122 "$(location :frameworks-base-api-current.txt)",
123 }
124
125 genrule {
126 name: "frameworks-base-api-system-current-compat",
127 srcs: [
128 ":android.api.system.latest",
129 ":android-incompatibilities.api.system.latest",
130 ":frameworks-base-api-current.txt",
131 ":frameworks-base-api-system-current.txt",
132 ],
133 out: ["updated-baseline.txt"],
134 tools: ["metalava"],
135 cmd: metalava_cmd +
136 "--check-compatibility:api:released $(location :android.api.system.latest) " +
137 "--check-compatibility:base $(location :frameworks-base-api-current.txt) " +
138 "--baseline:compatibility:released $(location :android-incompatibilities.api.system.latest) " +
139 "--update-baseline:compatibility:released $(genDir)/updated-baseline.txt " +
140 "$(location :frameworks-base-api-system-current.txt)",
141 }
142
143 genrule {
144 name: "frameworks-base-api-module-lib-current-compat",
145 srcs: [
146 ":android.api.module-lib.latest",
147 ":android-incompatibilities.api.module-lib.latest",
148 ":frameworks-base-api-current.txt",
149 ":frameworks-base-api-module-lib-current.txt",
150 ],
151 out: ["updated-baseline.txt"],
152 tools: ["metalava"],
153 cmd: metalava_cmd +
154 "--check-compatibility:api:released $(location :android.api.module-lib.latest) " +
155 // Note: having "public" be the base of module-lib is not perfect -- it should
156 // ideally be a merged public+system (which metalava is not currently able to generate).
157 // This "base" will help when migrating from MODULE_LIBS -> public, but not when
158 // migrating from MODULE_LIBS -> system (where it needs to instead be listed as
159 // an incompatibility).
160 "--check-compatibility:base $(location :frameworks-base-api-current.txt) " +
161 "--baseline:compatibility:released $(location :android-incompatibilities.api.module-lib.latest) " +
162 "--update-baseline:compatibility:released $(genDir)/updated-baseline.txt " +
163 "$(location :frameworks-base-api-module-lib-current.txt)",
164 }
165
166 genrule {
167 name: "frameworks-base-api-current.srcjar",
168 tools: ["merge_zips"],
169 out: ["current.srcjar"],
170 cmd: "$(location merge_zips) $(out) $(in)",
171 srcs: [
172 ":api-stubs-docs-non-updatable",
173 ":all-modules-public-stubs-source",
174 ],
175 visibility: ["//visibility:private"], // Used by make module in //development, mind
176 }
177
178 // This produces the same annotations.zip as framework-doc-stubs, but by using
179 // outputs from individual modules instead of all the source code.
180 genrule_defaults {
181 name: "sdk-annotations-defaults",
182 out: ["annotations.zip"],
183 tools: [
184 "merge_annotation_zips",
185 "soong_zip",
186 ],
187 cmd: "$(location merge_annotation_zips) $(genDir)/out $(in) && " +
188 "$(location soong_zip) -o $(out) -C $(genDir)/out -D $(genDir)/out",
189 }
190
191 genrule {
192 name: "sdk-annotations.zip",
193 defaults: ["sdk-annotations-defaults"],
194 srcs: [
195 ":android-non-updatable-doc-stubs{.annotations.zip}",
196 ":all-modules-public-annotations",
197 ],
198 }
199
200 genrule {
201 name: "sdk-annotations-system.zip",
202 defaults: ["sdk-annotations-defaults"],
203 srcs: [
204 ":android-non-updatable-doc-stubs-system{.annotations.zip}",
205 ":all-modules-system-annotations",
206 ],
207 }
208
209 genrule {
210 name: "sdk-annotations-module-lib.zip",
211 defaults: ["sdk-annotations-defaults"],
212 srcs: [
213 ":android-non-updatable-doc-stubs-module-lib{.annotations.zip}",
214 ":all-modules-module-lib-annotations",
215 ],
216 }
217
218 genrule {
219 name: "sdk-annotations-system-server.zip",
220 defaults: ["sdk-annotations-defaults"],
221 srcs: [
222 ":android-non-updatable-doc-stubs-system-server{.annotations.zip}",
223 ":all-modules-system-server-annotations",
224 ],
225 }
226
227 genrule {
228 name: "combined-removed-dex",
229 visibility: [
230 "//frameworks/base/boot",
231 ],
232 srcs: [
233 ":frameworks-base-api-removed.txt",
234 ":frameworks-base-api-system-removed.txt",
235 ":android.car-stubs-docs{.removed-api.txt}",
236 ":android.car-system-stubs-docs{.removed-api.txt}",
237 ],
238 tool_files: ["gen_combined_removed_dex.sh"],
239 tools: ["metalava"],
240 out: ["combined-removed-dex.txt"],
241 cmd: "$(location gen_combined_removed_dex.sh) $(location metalava) $(genDir) $(in) > $(out)",
242 }
243
244 java_genrule {
245 name: "api_fingerprint",
246 srcs: [
247 ":frameworks-base-api-current.txt",
248 ":frameworks-base-api-system-current.txt",
249 ":frameworks-base-api-module-lib-current.txt",
250 ":frameworks-base-api-system-server-current.txt",
251 ],
252 out: ["api_fingerprint.txt"],
253 cmd: "cat $(in) | md5sum | cut -d' ' -f1 > $(out)",
254 }