blob: f5bafe8bf8dae1fb02fe65d90be64318626d6b40 [file] [log] [blame]
// 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-bp2build",
"soong-genrule",
"soong-java",
],
srcs: ["api.go"],
testSrcs: ["api_test.go"],
pluginFor: ["soong_build"],
}
python_binary_host {
name: "merge_annotation_zips",
srcs: ["merge_annotation_zips.py"],
}
python_test_host {
name: "merge_annotation_zips_test",
main: "merge_annotation_zips_test.py",
srcs: [
"merge_annotation_zips.py",
"merge_annotation_zips_test.py",
],
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-configinfrastructure",
"framework-connectivity",
"framework-connectivity-t",
"framework-devicelock",
"framework-graphics",
"framework-healthfitness",
"framework-media",
"framework-mediaprovider",
"framework-ondevicepersonalization",
"framework-permission",
"framework-permission-s",
"framework-scheduling",
"framework-sdkextensions",
"framework-statsd",
"framework-sdksandbox",
"framework-tethering",
"framework-uwb",
"framework-virtualization",
"framework-wifi",
"i18n.module.public.api",
],
system_server_classpath: [
"service-art",
"service-configinfrastructure",
"service-healthfitness",
"service-media-s",
"service-permission",
"service-rkp",
"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: "frameworks-base-api-current.srcjar",
tools: ["merge_zips"],
out: ["current.srcjar"],
cmd: "$(location merge_zips) $(out) $(in)",
srcs: [
":api-stubs-docs-non-updatable",
":all-modules-public-stubs-source",
],
visibility: ["//visibility:private"], // Used by make module in //development, mind
}
// This produces the same annotations.zip as framework-doc-stubs, but by using
// outputs from individual modules instead of all the source code.
genrule_defaults {
name: "sdk-annotations-defaults",
out: ["annotations.zip"],
tools: [
"merge_annotation_zips",
"soong_zip",
],
cmd: "$(location merge_annotation_zips) $(genDir)/out $(in) && " +
"$(location soong_zip) -o $(out) -C $(genDir)/out -D $(genDir)/out",
}
genrule {
name: "sdk-annotations.zip",
defaults: ["sdk-annotations-defaults"],
srcs: [
":android-non-updatable-doc-stubs{.annotations.zip}",
":all-modules-public-annotations",
],
}
genrule {
name: "sdk-annotations-system.zip",
defaults: ["sdk-annotations-defaults"],
srcs: [
":android-non-updatable-doc-stubs-system{.annotations.zip}",
":all-modules-system-annotations",
],
}
genrule {
name: "sdk-annotations-module-lib.zip",
defaults: ["sdk-annotations-defaults"],
srcs: [
":android-non-updatable-doc-stubs-module-lib{.annotations.zip}",
":all-modules-module-lib-annotations",
],
}
genrule {
name: "sdk-annotations-system-server.zip",
defaults: ["sdk-annotations-defaults"],
srcs: [
":android-non-updatable-doc-stubs-system-server{.annotations.zip}",
":all-modules-system-server-annotations",
],
}
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)",
}
java_genrule {
name: "api_fingerprint",
srcs: [
":frameworks-base-api-current.txt",
":frameworks-base-api-system-current.txt",
":frameworks-base-api-module-lib-current.txt",
":frameworks-base-api-system-server-current.txt",
],
out: ["api_fingerprint.txt"],
cmd: "cat $(in) | md5sum | cut -d' ' -f1 > $(out)",
}
build = [
"ApiDocs.bp",
"StubLibraries.bp",
]