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 15package { 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 27bootstrap_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 43python_binary_host { 44 name: "merge_annotation_zips", 45 srcs: ["merge_annotation_zips.py"], 46} 47 48python_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 60metalava_cmd = "$(location metalava)" 61// Silence reflection warnings. See b/168689341 62metalava_cmd += " -J--add-opens=java.base/java.util=ALL-UNNAMED " 63metalava_cmd += " --quiet --no-banner --format=v2 " 64 65genrule { 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 74combined_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-configinfrastructure", 84 "framework-connectivity", 85 "framework-connectivity-t", 86 "framework-devicelock", 87 "framework-graphics", 88 "framework-healthfitness", 89 "framework-media", 90 "framework-mediaprovider", 91 "framework-ondevicepersonalization", 92 "framework-permission", 93 "framework-permission-s", 94 "framework-scheduling", 95 "framework-sdkextensions", 96 "framework-statsd", 97 "framework-sdksandbox", 98 "framework-tethering", 99 "framework-uwb", 100 "framework-virtualization", 101 "framework-wifi", 102 "i18n.module.public.api", 103 ], 104 system_server_classpath: [ 105 "service-art", 106 "service-configinfrastructure", 107 "service-healthfitness", 108 "service-media-s", 109 "service-permission", 110 "service-rkp", 111 "service-sdksandbox", 112 ], 113} 114 115genrule { 116 name: "frameworks-base-api-current-compat", 117 srcs: [ 118 ":android.api.public.latest", 119 ":android-incompatibilities.api.public.latest", 120 ":frameworks-base-api-current.txt", 121 ], 122 out: ["updated-baseline.txt"], 123 tools: ["metalava"], 124 cmd: metalava_cmd + 125 "--check-compatibility:api:released $(location :android.api.public.latest) " + 126 "--baseline:compatibility:released $(location :android-incompatibilities.api.public.latest) " + 127 "--update-baseline:compatibility:released $(genDir)/updated-baseline.txt " + 128 "$(location :frameworks-base-api-current.txt)", 129} 130 131genrule { 132 name: "frameworks-base-api-system-current-compat", 133 srcs: [ 134 ":android.api.system.latest", 135 ":android-incompatibilities.api.system.latest", 136 ":frameworks-base-api-current.txt", 137 ":frameworks-base-api-system-current.txt", 138 ], 139 out: ["updated-baseline.txt"], 140 tools: ["metalava"], 141 cmd: metalava_cmd + 142 "--check-compatibility:api:released $(location :android.api.system.latest) " + 143 "--check-compatibility:base $(location :frameworks-base-api-current.txt) " + 144 "--baseline:compatibility:released $(location :android-incompatibilities.api.system.latest) " + 145 "--update-baseline:compatibility:released $(genDir)/updated-baseline.txt " + 146 "$(location :frameworks-base-api-system-current.txt)", 147} 148 149genrule { 150 name: "frameworks-base-api-module-lib-current-compat", 151 srcs: [ 152 ":android.api.module-lib.latest", 153 ":android-incompatibilities.api.module-lib.latest", 154 ":frameworks-base-api-current.txt", 155 ":frameworks-base-api-module-lib-current.txt", 156 ], 157 out: ["updated-baseline.txt"], 158 tools: ["metalava"], 159 cmd: metalava_cmd + 160 "--check-compatibility:api:released $(location :android.api.module-lib.latest) " + 161 // Note: having "public" be the base of module-lib is not perfect -- it should 162 // ideally be a merged public+system (which metalava is not currently able to generate). 163 // This "base" will help when migrating from MODULE_LIBS -> public, but not when 164 // migrating from MODULE_LIBS -> system (where it needs to instead be listed as 165 // an incompatibility). 166 "--check-compatibility:base $(location :frameworks-base-api-current.txt) " + 167 "--baseline:compatibility:released $(location :android-incompatibilities.api.module-lib.latest) " + 168 "--update-baseline:compatibility:released $(genDir)/updated-baseline.txt " + 169 "$(location :frameworks-base-api-module-lib-current.txt)", 170} 171 172genrule { 173 name: "frameworks-base-api-current.srcjar", 174 tools: ["merge_zips"], 175 out: ["current.srcjar"], 176 cmd: "$(location merge_zips) $(out) $(in)", 177 srcs: [ 178 ":api-stubs-docs-non-updatable", 179 ":all-modules-public-stubs-source", 180 ], 181 visibility: ["//visibility:private"], // Used by make module in //development, mind 182} 183 184// This produces the same annotations.zip as framework-doc-stubs, but by using 185// outputs from individual modules instead of all the source code. 186genrule_defaults { 187 name: "sdk-annotations-defaults", 188 out: ["annotations.zip"], 189 tools: [ 190 "merge_annotation_zips", 191 "soong_zip", 192 ], 193 cmd: "$(location merge_annotation_zips) $(genDir)/out $(in) && " + 194 "$(location soong_zip) -o $(out) -C $(genDir)/out -D $(genDir)/out", 195} 196 197genrule { 198 name: "sdk-annotations.zip", 199 defaults: ["sdk-annotations-defaults"], 200 srcs: [ 201 ":android-non-updatable-doc-stubs{.annotations.zip}", 202 ":all-modules-public-annotations", 203 ], 204} 205 206genrule { 207 name: "sdk-annotations-system.zip", 208 defaults: ["sdk-annotations-defaults"], 209 srcs: [ 210 ":android-non-updatable-doc-stubs-system{.annotations.zip}", 211 ":all-modules-system-annotations", 212 ], 213} 214 215genrule { 216 name: "sdk-annotations-module-lib.zip", 217 defaults: ["sdk-annotations-defaults"], 218 srcs: [ 219 ":android-non-updatable-doc-stubs-module-lib{.annotations.zip}", 220 ":all-modules-module-lib-annotations", 221 ], 222} 223 224genrule { 225 name: "sdk-annotations-system-server.zip", 226 defaults: ["sdk-annotations-defaults"], 227 srcs: [ 228 ":android-non-updatable-doc-stubs-system-server{.annotations.zip}", 229 ":all-modules-system-server-annotations", 230 ], 231} 232 233genrule { 234 name: "combined-removed-dex", 235 visibility: [ 236 "//frameworks/base/boot", 237 ], 238 srcs: [ 239 ":frameworks-base-api-removed.txt", 240 ":frameworks-base-api-system-removed.txt", 241 ":android.car-stubs-docs{.removed-api.txt}", 242 ":android.car-system-stubs-docs{.removed-api.txt}", 243 ], 244 tool_files: ["gen_combined_removed_dex.sh"], 245 tools: ["metalava"], 246 out: ["combined-removed-dex.txt"], 247 cmd: "$(location gen_combined_removed_dex.sh) $(location metalava) $(genDir) $(in) > $(out)", 248} 249 250java_genrule { 251 name: "api_fingerprint", 252 srcs: [ 253 ":frameworks-base-api-current.txt", 254 ":frameworks-base-api-system-current.txt", 255 ":frameworks-base-api-module-lib-current.txt", 256 ":frameworks-base-api-system-server-current.txt", 257 ], 258 out: ["api_fingerprint.txt"], 259 cmd: "cat $(in) | md5sum | cut -d' ' -f1 > $(out)", 260} 261 262build = [ 263 "ApiDocs.bp", 264 "StubLibraries.bp", 265] 266