Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e53ade16 authored by Anton Hansson's avatar Anton Hansson Committed by Automerger Merge Worker
Browse files

Merge "Cleanup in StubLibraries.bp" am: 6b36fba3

Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1500051

Change-Id: I3c10ae2bbc711761143e94fb6177dd4e0f3e15f1
parents ad135159 6b36fba3
Loading
Loading
Loading
Loading
+33 −58
Original line number Diff line number Diff line
@@ -16,12 +16,12 @@
//
// raw source files --(metalava)--> stub source files --(javac)--> stub jar files
//
// The metalava conversion is done by droidstub modules *-api-stubs-docs.
// The javac compilation is done by java_library modules android_*_stubs_current.
// - 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 last API signature in api/*-current.txt files
// and also against the latest frozen API signature in prebuilts/sdk/*/*/api/android.txt
// files.
// and comparing them against the checked in API signature, and also checking compatibility
// with the latest frozen API signature.

/////////////////////////////////////////////////////////////////////
// Common metalava configs
@@ -41,7 +41,7 @@ packages_to_document = [
]

stubs_defaults {
    name: "metalava-base-api-stubs-default",
    name: "metalava-non-updatable-api-stubs-default",
    srcs: [
        ":framework-non-updatable-sources",
        "core/java/**/*.logtags",
@@ -51,9 +51,14 @@ stubs_defaults {
        ":android_icu4j_public_api_files",
        "**/package.html",
    ],
    sdk_version: "core_platform",
    arg_files: ["core/res/AndroidManifest.xml"],
    // TODO(b/147699819): remove below aidl includes.
    aidl: {
        local_include_dirs: ["telephony/java"],
        local_include_dirs: [
            "apex/media/aidl/stable",
            "telephony/java",
        ],
    },
    // 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.
@@ -72,6 +77,12 @@ stubs_defaults {
        "android.hardware.usb.gadget-V1.0-java",
        "android.hardware.vibrator-V1.3-java",
        "framework-protos",
        // There are a few classes from modules used as type arguments that
        // need to be resolved by metalava. For now, we can use a previously
        // finalized stub library to resolve them. If a new class gets added,
        // this may be need to be revisited to use a manually maintained stub
        // library with empty classes in order to resolve those references.
        "sdk_system_30_android",
    ],
    high_mem: true, // Lots of sources => high memory use, see b/170701554
    installable: false,
@@ -84,31 +95,6 @@ stubs_defaults {
    filter_packages: packages_to_document,
}

stubs_defaults {
    name: "metalava-full-api-stubs-default",
    defaults: ["metalava-base-api-stubs-default"],
    srcs: [
        ":conscrypt.module.public.api{.public.stubs.source}",
        ":framework-updatable-sources",
    ],
    sdk_version: "core_platform",
}

stubs_defaults {
    name: "metalava-non-updatable-api-stubs-default",
    defaults: ["metalava-base-api-stubs-default"],
    sdk_version: "core_platform",
    // There are a few classes from modules used as type arguments that
    // need to be resolved by metalava. For now, we can use a previously
    // finalized stub library to resolve them. If a new class gets added,
    // this may be need to be revisited to use a manually maintained stub
    // library with empty classes in order to resolve those references.
    libs: ["sdk_system_30_android"],
    aidl: {
        local_include_dirs: ["apex/media/aidl/stable"],
    },
}

/////////////////////////////////////////////////////////////////////
// These modules provide source files for the stub libraries
/////////////////////////////////////////////////////////////////////
@@ -116,7 +102,6 @@ stubs_defaults {
droidstubs {
    name: "api-stubs-docs-non-updatable",
    defaults: ["metalava-non-updatable-api-stubs-default"],
    arg_files: ["core/res/AndroidManifest.xml"],
    args: metalava_framework_docs_args,
    check_api: {
        current: {
@@ -135,23 +120,26 @@ droidstubs {
    },
}

priv_apps = " " +
priv_apps =
    " --show-annotation android.annotation.SystemApi\\(" +
        "client=android.annotation.SystemApi.Client.PRIVILEGED_APPS" +
    "\\)"

module_libs = " " +
    " --show-annotation android.annotation.SystemApi\\(" +
        "client=android.annotation.SystemApi.Client.MODULE_LIBRARIES" +
    "\\)" +
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"],
    arg_files: ["core/res/AndroidManifest.xml"],
    args: metalava_framework_docs_args + priv_apps,
    check_api: {
        current: {
@@ -174,14 +162,7 @@ droidstubs {
droidstubs {
    name: "test-api-stubs-docs-non-updatable",
    defaults: ["metalava-non-updatable-api-stubs-default"],
    arg_files: [
        "core/res/AndroidManifest.xml",
    ],
    args: metalava_framework_docs_args
        + " --show-annotation android.annotation.TestApi"
        + " --show-for-stub-purposes-annotation android.annotation.SystemApi\\("
        +     "client=android.annotation.SystemApi.Client.PRIVILEGED_APPS"
        + "\\)",
    args: metalava_framework_docs_args + test + priv_apps_in_stubs,
    check_api: {
        current: {
            api_file: "core/api/test-current.txt",
@@ -199,16 +180,10 @@ droidstubs {
    },
}

/////////////////////////////////////////////////////////////////////
// Following droidstub module for extra APIs for modules,
// namely @SystemApi(client=MODULE_LIBRARIES) APIs.
/////////////////////////////////////////////////////////////////////

droidstubs {
    name: "module-lib-api-stubs-docs-non-updatable",
    defaults: ["metalava-non-updatable-api-stubs-default"],
    arg_files: ["core/res/AndroidManifest.xml"],
    args: metalava_framework_docs_args + priv_apps + module_libs,
    args: metalava_framework_docs_args + priv_apps_in_stubs + module_libs,
    check_api: {
        current: {
            api_file: "core/api/module-lib-current.txt",
@@ -227,7 +202,7 @@ droidstubs {

/////////////////////////////////////////////////////////////////////
// android_*_stubs_current modules are the stubs libraries compiled
// from *-api-stubs-docs
// from stub sources
/////////////////////////////////////////////////////////////////////

java_defaults {