blob: 32123fd8854d8e711bf022cec05ad62cd13aa916 [file] [log] [blame]
// Copyright (C) 2019 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.
// How stubs are generated:
//
// raw source files --(metalava)--> stub source files --(javac)--> stub jar files
//
// - The metalava conversion is done by droidstub modules
// - The javac compilation is done by java_library modules
//
// The metalava conversion is also responsible for creating API signature files
// and comparing them against the checked in API signature, and also checking compatibility
// with the latest frozen API signature.
/////////////////////////////////////////////////////////////////////
// Common metalava configs
/////////////////////////////////////////////////////////////////////
packages_to_document = [
"android",
"dalvik",
"java",
"javax",
"junit",
"org.apache.http",
"org.json",
"org.w3c.dom",
"org.xml.sax",
"org.xmlpull",
]
stubs_defaults {
name: "metalava-non-updatable-api-stubs-default",
srcs: [":framework-non-updatable-stub-sources"],
sdk_version: "none",
system_modules: "none",
java_version: "1.8",
arg_files: ["core/res/AndroidManifest.xml"],
// TODO(b/147699819, b/169090544): remove below aidl includes.
aidl: {
local_include_dirs: [
"apex/media/aidl/stable",
"media/aidl",
// TODO: move to include-dirs for packages/modules/Connectivity when this moves out of
// frameworks/base
"packages/Connectivity/framework/aidl-export",
"telephony/java",
],
include_dirs: ["frameworks/av/aidl"],
},
// These are libs from framework-internal-utils that are required (i.e. being referenced)
// from framework-non-updatable-sources. Add more here when there's a need.
// DO NOT add the entire framework-internal-utils. It might cause unnecessary circular
// dependencies gets bigger.
libs: [
"android.hardware.cas-V1.2-java",
"android.hardware.health-V1.0-java-constants",
"android.hardware.radio-V1.5-java",
"android.hardware.radio-V1.6-java",
"android.hardware.thermal-V1.0-java-constants",
"android.hardware.thermal-V2.0-java",
"android.hardware.tv.input-V1.0-java-constants",
"android.hardware.tv.tuner-V1.0-java-constants",
"android.hardware.tv.tuner-V1.1-java-constants",
"android.hardware.usb-V1.0-java-constants",
"android.hardware.usb-V1.1-java-constants",
"android.hardware.usb.gadget-V1.0-java",
"android.hardware.vibrator-V1.3-java",
"framework-protos",
"stable.core.platform.api.stubs",
// There are a few classes from modules used by the core that
// need to be resolved by metalava. We use a prebuilt stub of the
// full sdk to ensure we can resolve them. If a new class gets added,
// the prebuilts/sdk/current needs to be updated.
"sdk_system_current_android",
// NOTE: The below can be removed once the prebuilt stub contains IKE.
"sdk_system_current_android.net.ipsec.ike",
],
high_mem: true, // Lots of sources => high memory use, see b/170701554
installable: false,
annotations_enabled: true,
previous_api: ":android.api.public.latest",
merge_annotations_dirs: [
"metalava-manual",
],
api_levels_annotations_enabled: false,
filter_packages: packages_to_document,
}
/////////////////////////////////////////////////////////////////////
// These modules provide source files for the stub libraries
/////////////////////////////////////////////////////////////////////
droidstubs {
name: "api-stubs-docs-non-updatable",
defaults: ["metalava-non-updatable-api-stubs-default"],
args: metalava_framework_docs_args,
check_api: {
current: {
api_file: "core/api/current.txt",
removed_api_file: "core/api/removed.txt",
},
last_released: {
api_file: ":android-non-updatable.api.public.latest",
removed_api_file: ":android-non-updatable-removed.api.public.latest",
baseline_file: ":android-incompatibilities.api.public.latest",
},
api_lint: {
enabled: true,
new_since: ":android-non-updatable.api.public.latest",
},
},
dists: [
{
targets: ["sdk", "win_sdk"],
dir: "apistubs/android/public/api",
dest: "android-non-updatable.txt",
tag: ".api.txt",
},
{
targets: ["sdk", "win_sdk"],
dir: "apistubs/android/public/api",
dest: "android-non-updatable-removed.txt",
tag: ".removed-api.txt",
},
],
}
priv_apps =
" --show-annotation android.annotation.SystemApi\\(" +
"client=android.annotation.SystemApi.Client.PRIVILEGED_APPS" +
"\\)"
priv_apps_in_stubs =
" --show-for-stub-purposes-annotation android.annotation.SystemApi\\(" +
"client=android.annotation.SystemApi.Client.PRIVILEGED_APPS" +
"\\)"
test = " --show-annotation android.annotation.TestApi"
module_libs =
" --show-annotation android.annotation.SystemApi\\(" +
"client=android.annotation.SystemApi.Client.MODULE_LIBRARIES" +
"\\)"
droidstubs {
name: "system-api-stubs-docs-non-updatable",
defaults: ["metalava-non-updatable-api-stubs-default"],
args: metalava_framework_docs_args + priv_apps,
check_api: {
current: {
api_file: "core/api/system-current.txt",
removed_api_file: "core/api/system-removed.txt",
},
last_released: {
api_file: ":android-non-updatable.api.system.latest",
removed_api_file: ":android-non-updatable-removed.api.system.latest",
baseline_file: ":android-incompatibilities.api.system.latest"
},
api_lint: {
enabled: true,
new_since: ":android-non-updatable.api.system.latest",
baseline_file: "core/api/system-lint-baseline.txt",
},
},
dists: [
{
targets: ["sdk", "win_sdk"],
dir: "apistubs/android/system/api",
dest: "android-non-updatable.txt",
tag: ".api.txt",
},
{
targets: ["sdk", "win_sdk"],
dir: "apistubs/android/system/api",
dest: "android-non-updatable-removed.txt",
tag: ".removed-api.txt",
},
],
}
droidstubs {
name: "test-api-stubs-docs-non-updatable",
defaults: ["metalava-non-updatable-api-stubs-default"],
args: metalava_framework_docs_args + test + priv_apps_in_stubs,
check_api: {
current: {
api_file: "core/api/test-current.txt",
removed_api_file: "core/api/test-removed.txt",
},
api_lint: {
enabled: true,
baseline_file: "core/api/test-lint-baseline.txt",
},
},
dists: [
{
targets: ["sdk", "win_sdk"],
dir: "apistubs/android/test/api",
dest: "android.txt",
tag: ".api.txt",
},
{
targets: ["sdk", "win_sdk"],
dir: "apistubs/android/test/api",
dest: "removed.txt",
tag: ".removed-api.txt",
},
{
targets: ["sdk", "win_sdk"],
dir: "apistubs/android/test/api",
dest: "android-non-updatable.txt",
tag: ".api.txt",
},
{
targets: ["sdk", "win_sdk"],
dir: "apistubs/android/test/api",
dest: "android-non-updatable-removed.txt",
tag: ".removed-api.txt",
},
],
}
droidstubs {
name: "module-lib-api-stubs-docs-non-updatable",
defaults: ["metalava-non-updatable-api-stubs-default"],
args: metalava_framework_docs_args + priv_apps_in_stubs + module_libs,
check_api: {
current: {
api_file: "core/api/module-lib-current.txt",
removed_api_file: "core/api/module-lib-removed.txt",
},
last_released: {
api_file: ":android-non-updatable.api.module-lib.latest",
removed_api_file: ":android-non-updatable-removed.api.module-lib.latest",
},
api_lint: {
enabled: true,
new_since: ":android-non-updatable.api.module-lib.latest",
},
},
dists: [
{
targets: ["sdk", "win_sdk"],
dir: "apistubs/android/module-lib/api",
dest: "android-non-updatable.txt",
tag: ".api.txt",
},
{
targets: ["sdk", "win_sdk"],
dir: "apistubs/android/module-lib/api",
dest: "android-non-updatable-removed.txt",
tag: ".removed-api.txt",
},
],
}
/////////////////////////////////////////////////////////////////////
// android_*_stubs_current modules are the stubs libraries compiled
// from stub sources
/////////////////////////////////////////////////////////////////////
java_defaults {
name: "android_defaults_stubs_current",
libs: [ "stub-annotations" ],
static_libs: [
// License notices from art module
"art-notices-for-framework-stubs-jar",
"framework-res-package-jar", // Export package of framework-res
],
errorprone: {
javacflags: [
"-XepDisableAllChecks",
],
},
sdk_version: "none",
system_modules: "none",
java_version: "1.8",
compile_dex: true,
}
java_defaults {
name: "android_stubs_dists_default",
dist: {
targets: ["sdk", "win_sdk"],
tag: ".jar",
dest: "android.jar",
},
}
java_library_static {
name: "android_stubs_current",
srcs: [ ":api-stubs-docs-non-updatable" ],
static_libs: [
"android.net.ipsec.ike.stubs",
"art.module.public.api.stubs",
"conscrypt.module.public.api.stubs",
"framework-appsearch.stubs",
"framework-connectivity.stubs",
"framework-graphics.stubs",
"framework-media.stubs",
"framework-mediaprovider.stubs",
"framework-permission.stubs",
"framework-permission-s.stubs",
"framework-scheduling.stubs",
"framework-sdkextensions.stubs",
"framework-statsd.stubs",
"framework-tethering.stubs",
"framework-wifi.stubs",
"i18n.module.public.api.stubs",
"private-stub-annotations-jar",
],
defaults: ["android_defaults_stubs_current"],
}
java_library_static {
name: "android_system_stubs_current",
srcs: [ ":system-api-stubs-docs-non-updatable" ],
static_libs: [
"android.net.ipsec.ike.stubs.system",
"art.module.public.api.stubs",
"conscrypt.module.public.api.stubs",
"framework-appsearch.stubs.system",
"framework-connectivity.stubs.system",
"framework-graphics.stubs.system",
"framework-media.stubs.system",
"framework-mediaprovider.stubs.system",
"framework-permission.stubs.system",
"framework-permission-s.stubs.system",
"framework-scheduling.stubs.system",
"framework-sdkextensions.stubs.system",
"framework-statsd.stubs.system",
"framework-tethering.stubs.system",
"framework-wifi.stubs.system",
"i18n.module.public.api.stubs",
"private-stub-annotations-jar",
],
defaults: [
"android_defaults_stubs_current",
"android_stubs_dists_default",
],
dist: {
dir: "apistubs/android/system",
},
dists: [
{
// Legacy dist path
targets: ["sdk", "win_sdk"],
tag: ".jar",
dest: "android_system.jar",
},
],
}
java_library_static {
name: "android_test_stubs_current",
srcs: [ ":test-api-stubs-docs-non-updatable" ],
static_libs: [
// Modules do not have test APIs, but we want to include their SystemApis, like we include
// the SystemApi of framework-non-updatable-sources.
"android.net.ipsec.ike.stubs.system",
"art.module.public.api.stubs",
"conscrypt.module.public.api.stubs",
"framework-appsearch.stubs.system",
"framework-connectivity.stubs.system",
"framework-graphics.stubs.system",
"framework-media.stubs.system",
"framework-mediaprovider.stubs.system",
"framework-permission.stubs.system",
"framework-permission-s.stubs.system",
"framework-scheduling.stubs.system",
"framework-sdkextensions.stubs.system",
"framework-statsd.stubs.system",
"framework-tethering.stubs.system",
"framework-wifi.stubs.system",
"i18n.module.public.api.stubs",
"private-stub-annotations-jar",
],
defaults: [
"android_defaults_stubs_current",
"android_stubs_dists_default",
],
dist: {
dir: "apistubs/android/test",
},
dists: [
{
// Legacy dist path
targets: ["sdk", "win_sdk"],
tag: ".jar",
dest: "android_test.jar",
},
],
}
java_library_static {
name: "android_module_lib_stubs_current",
srcs: [ ":module-lib-api-stubs-docs-non-updatable" ],
defaults: [
"android_defaults_stubs_current",
"android_stubs_dists_default",
],
libs: [
"sdk_system_current_android",
// NOTE: The below can be removed once the prebuilt stub contains IKE.
"sdk_system_current_android.net.ipsec.ike",
],
static_libs: ["art.module.public.api.stubs"],
dist: {
dir: "apistubs/android/module-lib",
},
}
/////////////////////////////////////////////////////////////////////
// hwbinder.stubs provides APIs required for building HIDL Java
// libraries.
/////////////////////////////////////////////////////////////////////
droidstubs {
name: "hwbinder-stubs-docs",
srcs: [
"core/java/android/os/HidlSupport.java",
"core/java/android/os/HidlMemory.java",
"core/java/android/os/HwBinder.java",
"core/java/android/os/HwBlob.java",
"core/java/android/os/HwParcel.java",
"core/java/android/os/IHwBinder.java",
"core/java/android/os/IHwInterface.java",
"core/java/android/os/DeadObjectException.java",
"core/java/android/os/DeadSystemException.java",
"core/java/android/os/NativeHandle.java",
"core/java/android/os/RemoteException.java",
"core/java/android/util/AndroidException.java",
],
libs: ["framework-annotations-lib"],
installable: false,
sdk_version: "core_platform",
annotations_enabled: true,
previous_api: ":android.api.public.latest",
merge_annotations_dirs: [
"metalava-manual",
],
args: priv_apps,
}
java_library_static {
name: "hwbinder.stubs",
sdk_version: "core_current",
libs: ["framework-annotations-lib"],
srcs: [
":hwbinder-stubs-docs",
],
}