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

Commit 6f2dea9c authored by Anton Hansson's avatar Anton Hansson
Browse files

Move some API rules out of top-level Android.bp

These defaults are used by api / stub modules, so move them into
the api subdir.

Test: m
Merged-In: I97661daa1c4c3cba6c31ccf1212334a41adaa271
Change-Id: I97661daa1c4c3cba6c31ccf1212334a41adaa271
parent 14e7f959
Loading
Loading
Loading
Loading
+0 −151
Original line number Diff line number Diff line
@@ -603,19 +603,6 @@ java_library {
    ],
}

packages_to_document = [
    "android",
    "dalvik",
    "java",
    "javax",
    "junit",
    "org.apache.http",
    "org.json",
    "org.w3c.dom",
    "org.xml.sax",
    "org.xmlpull",
]

filegroup {
    name: "android-non-updatable-stub-sources",
    srcs: [
@@ -629,144 +616,6 @@ filegroup {
    visibility: ["//frameworks/base/api"],
}

// Defaults for all stubs that include the non-updatable framework. These defaults do not include
// module symbols, so will not compile correctly on their own. Users must add module APIs to the
// classpath (or sources) somehow.
stubs_defaults {
    name: "android-non-updatable-stubs-defaults",
    srcs: [":android-non-updatable-stub-sources"],
    sdk_version: "none",
    system_modules: "none",
    java_version: "1.8",
    arg_files: [":frameworks-base-core-AndroidManifest.xml"],
    aidl: {
        include_dirs: [
            "frameworks/av/aidl",
            "frameworks/base/media/aidl",
            "frameworks/base/telephony/java",
            "frameworks/native/libs/permission/aidl",
            "packages/modules/Bluetooth/framework/aidl-export",
            "packages/modules/Connectivity/framework/aidl-export",
            "packages/modules/Media/apex/aidl/stable",
            "hardware/interfaces/biometrics/common/aidl",
            "hardware/interfaces/biometrics/fingerprint/aidl",
            "hardware/interfaces/graphics/common/aidl",
            "hardware/interfaces/keymaster/aidl",
            "system/hardware/interfaces/media/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.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",
    ],
    flags: [
        "--api-lint-ignore-prefix android.icu.",
        "--api-lint-ignore-prefix java.",
        "--api-lint-ignore-prefix junit.",
        "--api-lint-ignore-prefix org.",
        "--error NoSettingsProvider",
        "--error UnhiddenSystemApi",
        "--error UnflaggedApi",
        "--force-convert-to-warning-nullability-annotations +*:-android.*:+android.icu.*:-dalvik.*",
        "--hide BroadcastBehavior",
        "--hide CallbackInterface",
        "--hide DeprecationMismatch",
        "--hide HiddenSuperclass",
        "--hide MissingPermission",
        "--hide RequiresPermission",
        "--hide SdkConstant",
        "--hide Todo",
        "--hide-package android.audio.policy.configuration.V7_0",
        "--hide-package com.android.server",
        "--manifest $(location :frameworks-base-core-AndroidManifest.xml)",
    ],
    filter_packages: packages_to_document,
    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"],
    defaults_visibility: ["//frameworks/base/api"],
    visibility: ["//frameworks/base/api"],
}

// Defaults with module APIs in the classpath (mostly from prebuilts).
// Suitable for compiling android-non-updatable.
stubs_defaults {
    name: "module-classpath-stubs-defaults",
    aidl: {
        include_dirs: [
            "packages/modules/Bluetooth/framework/aidl-export",
            "packages/modules/Connectivity/framework/aidl-export",
            "packages/modules/Media/apex/aidl/stable",
        ],
    },
    libs: [
        "art.module.public.api",
        "sdk_module-lib_current_framework-tethering",
        "sdk_module-lib_current_framework-connectivity-t",
        "sdk_public_current_framework-bluetooth",
        // 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",
    ],
}

// Defaults for the java_sdk_libraries of unbundled jars from framework.
// java_sdk_libraries using these defaults should also add themselves to the
// non_updatable_modules list in frameworks/base/api/api.go
java_defaults {
    name: "framework-non-updatable-unbundled-defaults",
    defaults: [
        "framework-non-updatable-lint-defaults",
        "non-updatable-framework-module-defaults",
    ],
    public: {
        libs: ["android_module_lib_stubs_current"],
    },
    system: {
        libs: ["android_module_lib_stubs_current"],
    },
    module_lib: {
        libs: ["android_module_lib_stubs_current"],
    },
    test: {
        libs: ["android_test_frameworks_core_stubs_current"],
    },
    sdk_version: "core_platform",
    stub_only_libs: ["framework-protos"],
    impl_only_libs: ["framework-minus-apex-headers"], // the framework, including hidden API
    impl_library_visibility: ["//frameworks/base"],
    defaults_visibility: ["//frameworks/base/location"],
    plugins: ["error_prone_android_framework"],
    errorprone: {
        javacflags: [
            "-Xep:AndroidFrameworkCompatChange:ERROR",
            "-Xep:AndroidFrameworkUid:ERROR",
        ],
    },
    // Include manual annotations in API txt files
    merge_annotations_dirs: ["metalava-manual"],
}

build = [
    "AconfigFlags.bp",
    "ProtoLibraries.bp",
+151 −0
Original line number Diff line number Diff line
@@ -262,6 +262,157 @@ java_genrule {
    cmd: "cat $(in) | md5sum | cut -d' ' -f1 > $(out)",
}

packages_to_document = [
    "android",
    "dalvik",
    "java",
    "javax",
    "junit",
    "org.apache.http",
    "org.json",
    "org.w3c.dom",
    "org.xml.sax",
    "org.xmlpull",
]

// Defaults for all stubs that include the non-updatable framework. These defaults do not include
// module symbols, so will not compile correctly on their own. Users must add module APIs to the
// classpath (or sources) somehow.
stubs_defaults {
    name: "android-non-updatable-stubs-defaults",
    srcs: [":android-non-updatable-stub-sources"],
    sdk_version: "none",
    system_modules: "none",
    java_version: "1.8",
    arg_files: [":frameworks-base-core-AndroidManifest.xml"],
    aidl: {
        include_dirs: [
            "frameworks/av/aidl",
            "frameworks/base/media/aidl",
            "frameworks/base/telephony/java",
            "frameworks/native/libs/permission/aidl",
            "packages/modules/Bluetooth/framework/aidl-export",
            "packages/modules/Connectivity/framework/aidl-export",
            "packages/modules/Media/apex/aidl/stable",
            "hardware/interfaces/biometrics/common/aidl",
            "hardware/interfaces/biometrics/fingerprint/aidl",
            "hardware/interfaces/graphics/common/aidl",
            "hardware/interfaces/keymaster/aidl",
            "system/hardware/interfaces/media/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.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",
    ],
    flags: [
        "--api-lint-ignore-prefix android.icu.",
        "--api-lint-ignore-prefix java.",
        "--api-lint-ignore-prefix junit.",
        "--api-lint-ignore-prefix org.",
        "--error NoSettingsProvider",
        "--error UnhiddenSystemApi",
        "--error UnflaggedApi",
        "--force-convert-to-warning-nullability-annotations +*:-android.*:+android.icu.*:-dalvik.*",
        "--hide BroadcastBehavior",
        "--hide CallbackInterface",
        "--hide DeprecationMismatch",
        "--hide HiddenSuperclass",
        "--hide MissingPermission",
        "--hide RequiresPermission",
        "--hide SdkConstant",
        "--hide Todo",
        "--hide-package android.audio.policy.configuration.V7_0",
        "--hide-package com.android.server",
        "--manifest $(location :frameworks-base-core-AndroidManifest.xml)",
    ],
    filter_packages: packages_to_document,
    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"],
    defaults_visibility: ["//frameworks/base/api"],
    visibility: ["//frameworks/base/api"],
}

// Defaults with module APIs in the classpath (mostly from prebuilts).
// Suitable for compiling android-non-updatable.
stubs_defaults {
    name: "module-classpath-stubs-defaults",
    aidl: {
        include_dirs: [
            "packages/modules/Bluetooth/framework/aidl-export",
            "packages/modules/Connectivity/framework/aidl-export",
            "packages/modules/Media/apex/aidl/stable",
        ],
    },
    libs: [
        "art.module.public.api",
        "sdk_module-lib_current_framework-tethering",
        "sdk_module-lib_current_framework-connectivity-t",
        "sdk_public_current_framework-bluetooth",
        // 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",
    ],
}

// Defaults for the java_sdk_libraries of unbundled jars from framework.
// java_sdk_libraries using these defaults should also add themselves to the
// non_updatable_modules list in frameworks/base/api/api.go
java_defaults {
    name: "framework-non-updatable-unbundled-defaults",
    defaults: [
        "framework-non-updatable-lint-defaults",
        "non-updatable-framework-module-defaults",
    ],
    public: {
        libs: ["android_module_lib_stubs_current"],
    },
    system: {
        libs: ["android_module_lib_stubs_current"],
    },
    module_lib: {
        libs: ["android_module_lib_stubs_current"],
    },
    test: {
        libs: ["android_test_frameworks_core_stubs_current"],
    },
    sdk_version: "core_platform",
    stub_only_libs: ["framework-protos"],
    impl_only_libs: ["framework-minus-apex-headers"], // the framework, including hidden API
    impl_library_visibility: ["//frameworks/base"],
    defaults_visibility: ["//frameworks/base/location"],
    plugins: ["error_prone_android_framework"],
    errorprone: {
        javacflags: [
            "-Xep:AndroidFrameworkCompatChange:ERROR",
            "-Xep:AndroidFrameworkUid:ERROR",
        ],
    },
    // Include manual annotations in API txt files
    merge_annotations_dirs: ["metalava-manual"],
}

build = [
    "ApiDocs.bp",
    "StubLibraries.bp",