|  | // Copyright (C) 2020 The Android Open Source Project | 
|  | // | 
|  | // Licensed under the Apache License, Version 2.0 (the "License"); | 
|  | // you may not use this file except in compliance with the License. | 
|  | // You may obtain a copy of the License at | 
|  | // | 
|  | //      http://www.apache.org/licenses/LICENSE-2.0 | 
|  | // | 
|  | // Unless required by applicable law or agreed to in writing, software | 
|  | // distributed under the License is distributed on an "AS IS" BASIS, | 
|  | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | 
|  | // See the License for the specific language governing permissions and | 
|  | // limitations under the License. | 
|  |  | 
|  | package { | 
|  | default_visibility: ["//visibility:private"], | 
|  | // See: http://go/android-license-faq | 
|  | // A large-scale-change added 'default_applicable_licenses' to import | 
|  | // all of the 'license_kinds' from "frameworks_base_license" | 
|  | // to get the below license kinds: | 
|  | //   SPDX-license-identifier-Apache-2.0 | 
|  | //   SPDX-license-identifier-MIT | 
|  | //   SPDX-license-identifier-Unicode-DFS | 
|  | default_applicable_licenses: ["frameworks_base_license"], | 
|  | } | 
|  |  | 
|  | bootstrap_go_package { | 
|  | name: "soong-api", | 
|  | pkgPath: "android/soong/api", | 
|  | deps: [ | 
|  | "blueprint", | 
|  | "soong", | 
|  | "soong-android", | 
|  | "soong-genrule", | 
|  | "soong-java", | 
|  | ], | 
|  | srcs: ["api.go"], | 
|  | pluginFor: ["soong_build"], | 
|  | } | 
|  |  | 
|  | python_defaults { | 
|  | name: "python3_version_defaults", | 
|  | version: { | 
|  | py2: { | 
|  | enabled: false, | 
|  | }, | 
|  | py3: { | 
|  | enabled: true, | 
|  | embedded_launcher: false, | 
|  | }, | 
|  | }, | 
|  | } | 
|  |  | 
|  | python_binary_host { | 
|  | name: "api_versions_trimmer", | 
|  | srcs: ["api_versions_trimmer.py"], | 
|  | defaults: ["python3_version_defaults"], | 
|  | } | 
|  |  | 
|  | python_test_host { | 
|  | name: "api_versions_trimmer_unittests", | 
|  | main: "api_versions_trimmer_unittests.py", | 
|  | srcs: [ | 
|  | "api_versions_trimmer_unittests.py", | 
|  | "api_versions_trimmer.py", | 
|  | ], | 
|  | defaults: ["python3_version_defaults"], | 
|  | test_options: { | 
|  | unit_test: true, | 
|  | }, | 
|  | } | 
|  |  | 
|  | python_binary_host { | 
|  | name: "merge_annotation_zips", | 
|  | srcs: ["merge_annotation_zips.py"], | 
|  | defaults: ["python3_version_defaults"], | 
|  | } | 
|  |  | 
|  | python_test_host { | 
|  | name: "merge_annotation_zips_test", | 
|  | main: "merge_annotation_zips_test.py", | 
|  | srcs: [ | 
|  | "merge_annotation_zips.py", | 
|  | "merge_annotation_zips_test.py", | 
|  | ], | 
|  | defaults: ["python3_version_defaults"], | 
|  | test_options: { | 
|  | unit_test: true, | 
|  | }, | 
|  | } | 
|  |  | 
|  | metalava_cmd = "$(location metalava)" | 
|  | // Silence reflection warnings. See b/168689341 | 
|  | metalava_cmd += " -J--add-opens=java.base/java.util=ALL-UNNAMED " | 
|  | metalava_cmd += " --quiet --no-banner --format=v2 " | 
|  |  | 
|  | genrule { | 
|  | name: "current-api-xml", | 
|  | tools: ["metalava"], | 
|  | srcs: [":frameworks-base-api-current.txt"], | 
|  | out: ["current.api"], | 
|  | cmd: metalava_cmd + "-convert2xmlnostrip $(in) $(out)", | 
|  | visibility: ["//visibility:public"], | 
|  | } | 
|  |  | 
|  | combined_apis { | 
|  | name: "frameworks-base-api", | 
|  | bootclasspath: [ | 
|  | "android.net.ipsec.ike", | 
|  | "art.module.public.api", | 
|  | "conscrypt.module.public.api", | 
|  | "framework-adservices", | 
|  | "framework-appsearch", | 
|  | "framework-bluetooth", | 
|  | "framework-connectivity", | 
|  | "framework-connectivity-t", | 
|  | "framework-graphics", | 
|  | "framework-media", | 
|  | "framework-mediaprovider", | 
|  | "framework-ondevicepersonalization", | 
|  | "framework-permission", | 
|  | "framework-permission-s", | 
|  | "framework-scheduling", | 
|  | "framework-sdkextensions", | 
|  | "framework-statsd", | 
|  | "framework-sdksandbox", | 
|  | "framework-tethering", | 
|  | "framework-uwb", | 
|  | "framework-wifi", | 
|  | "i18n.module.public.api", | 
|  | ], | 
|  | system_server_classpath: [ | 
|  | "service-media-s", | 
|  | "service-permission", | 
|  | "service-sdksandbox", | 
|  | ], | 
|  | } | 
|  |  | 
|  | genrule { | 
|  | name: "frameworks-base-api-current-compat", | 
|  | srcs: [ | 
|  | ":android.api.public.latest", | 
|  | ":android-incompatibilities.api.public.latest", | 
|  | ":frameworks-base-api-current.txt", | 
|  | ], | 
|  | out: ["updated-baseline.txt"], | 
|  | tools: ["metalava"], | 
|  | cmd: metalava_cmd + | 
|  | "--check-compatibility:api:released $(location :android.api.public.latest) " + | 
|  | "--baseline:compatibility:released $(location :android-incompatibilities.api.public.latest) " + | 
|  | "--update-baseline:compatibility:released $(genDir)/updated-baseline.txt " + | 
|  | "$(location :frameworks-base-api-current.txt)", | 
|  | } | 
|  |  | 
|  | genrule { | 
|  | name: "frameworks-base-api-system-current-compat", | 
|  | srcs: [ | 
|  | ":android.api.system.latest", | 
|  | ":android-incompatibilities.api.system.latest", | 
|  | ":frameworks-base-api-current.txt", | 
|  | ":frameworks-base-api-system-current.txt", | 
|  | ], | 
|  | out: ["updated-baseline.txt"], | 
|  | tools: ["metalava"], | 
|  | cmd: metalava_cmd + | 
|  | "--check-compatibility:api:released $(location :android.api.system.latest) " + | 
|  | "--check-compatibility:base $(location :frameworks-base-api-current.txt) " + | 
|  | "--baseline:compatibility:released $(location :android-incompatibilities.api.system.latest) " + | 
|  | "--update-baseline:compatibility:released $(genDir)/updated-baseline.txt " + | 
|  | "$(location :frameworks-base-api-system-current.txt)", | 
|  | } | 
|  |  | 
|  | genrule { | 
|  | name: "frameworks-base-api-module-lib-current-compat", | 
|  | srcs: [ | 
|  | ":android.api.module-lib.latest", | 
|  | ":android-incompatibilities.api.module-lib.latest", | 
|  | ":frameworks-base-api-current.txt", | 
|  | ":frameworks-base-api-module-lib-current.txt", | 
|  | ], | 
|  | out: ["updated-baseline.txt"], | 
|  | tools: ["metalava"], | 
|  | cmd: metalava_cmd + | 
|  | "--check-compatibility:api:released $(location :android.api.module-lib.latest) " + | 
|  | // Note: having "public" be the base of module-lib is not perfect -- it should | 
|  | // ideally be a merged public+system (which metalava is not currently able to generate). | 
|  | // This "base" will help when migrating from MODULE_LIBS -> public, but not when | 
|  | // migrating from MODULE_LIBS -> system (where it needs to instead be listed as | 
|  | // an incompatibility). | 
|  | "--check-compatibility:base $(location :frameworks-base-api-current.txt) " + | 
|  | "--baseline:compatibility:released $(location :android-incompatibilities.api.module-lib.latest) " + | 
|  | "--update-baseline:compatibility:released $(genDir)/updated-baseline.txt " + | 
|  | "$(location :frameworks-base-api-module-lib-current.txt)", | 
|  | } | 
|  |  | 
|  | genrule { | 
|  | name: "combined-removed-dex", | 
|  | visibility: [ | 
|  | "//frameworks/base/boot", | 
|  | ], | 
|  | srcs: [ | 
|  | ":frameworks-base-api-removed.txt", | 
|  | ":frameworks-base-api-system-removed.txt", | 
|  | ":android.car-stubs-docs{.removed-api.txt}", | 
|  | ":android.car-system-stubs-docs{.removed-api.txt}", | 
|  | ], | 
|  | tool_files: ["gen_combined_removed_dex.sh"], | 
|  | tools: ["metalava"], | 
|  | out: ["combined-removed-dex.txt"], | 
|  | cmd: "$(location gen_combined_removed_dex.sh) $(location metalava) $(genDir) $(in) > $(out)", | 
|  | } |