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

Commit 648e609e authored by Anton Hansson's avatar Anton Hansson
Browse files

Replace manual genrule modules with combined_apis

This simplifies the addition of new modules by cutting down the number
of lists that the new module must be added to. The combined_apis module
generates equivalent genrules in a programmatic fashion.

Bug: 169103987
Test: `mmm frameworks/base/api` before and after and compare the soong
      intermediates of that folder.
Change-Id: Ia718f9374042e5fbb2168476f5bad3b1867b8a05
parent 28eda09c
Loading
Loading
Loading
Loading
+27 −362
Original line number Diff line number Diff line
@@ -102,47 +102,34 @@ genrule {
    visibility: ["//visibility:public"],
}

genrule {
    name: "frameworks-base-api-current.txt",
    srcs: [
        ":android.net.ipsec.ike{.public.api.txt}",
        ":art.module.public.api{.public.api.txt}",
        ":conscrypt.module.public.api{.public.api.txt}",
        ":framework-appsearch{.public.api.txt}",
        ":framework-connectivity{.public.api.txt}",
        ":framework-connectivity-tiramisu{.public.api.txt}",
        ":framework-graphics{.public.api.txt}",
        ":framework-media{.public.api.txt}",
        ":framework-mediaprovider{.public.api.txt}",
        ":framework-nearby{.public.api.txt}",
        ":framework-permission{.public.api.txt}",
        ":framework-permission-s{.public.api.txt}",
        ":framework-scheduling{.public.api.txt}",
        ":framework-sdkextensions{.public.api.txt}",
        ":framework-statsd{.public.api.txt}",
        ":framework-supplementalprocess{.public.api.txt}",
        ":framework-tethering{.public.api.txt}",
        ":framework-uwb{.public.api.txt}",
        ":framework-wifi{.public.api.txt}",
        ":i18n.module.public.api{.public.api.txt}",
        ":non-updatable-current.txt",
    ],
    out: ["current.txt"],
    tools: ["metalava"],
    cmd: metalava_cmd + "$(in) --api $(out)",
    dists: [
        {
            targets: ["droidcore"],
            dir: "api",
            dest: "current.txt",
        },
        {
            targets: ["sdk"],
            dir: "apistubs/android/public/api",
            dest: "android.txt",
        },
combined_apis {
    name: "frameworks-base-api",
    bootclasspath: [
        "android.net.ipsec.ike",
        "art.module.public.api",
        "conscrypt.module.public.api",
        "framework-appsearch",
        "framework-connectivity",
        "framework-connectivity-tiramisu",
        "framework-graphics",
        "framework-media",
        "framework-mediaprovider",
        "framework-nearby",
        "framework-permission",
        "framework-permission-s",
        "framework-scheduling",
        "framework-sdkextensions",
        "framework-statsd",
        "framework-supplementalprocess",
        "framework-tethering",
        "framework-uwb",
        "framework-wifi",
        "i18n.module.public.api",
    ],
    system_server_classpath: [
        "service-media-s",
        "service-permission",
    ],
    visibility: ["//visibility:public"],
}

genrule {
@@ -161,120 +148,6 @@ genrule {
        "$(location :frameworks-base-api-current.txt)",
}

genrule {
    name: "frameworks-base-api-current.srcjar",
    srcs: [
        ":android.net.ipsec.ike{.public.stubs.source}",
        ":api-stubs-docs-non-updatable",
        ":art.module.public.api{.public.stubs.source}",
        ":conscrypt.module.public.api{.public.stubs.source}",
        ":framework-appsearch{.public.stubs.source}",
        ":framework-connectivity{.public.stubs.source}",
        ":framework-connectivity-tiramisu{.public.stubs.source}",
        ":framework-graphics{.public.stubs.source}",
        ":framework-media{.public.stubs.source}",
        ":framework-mediaprovider{.public.stubs.source}",
        ":framework-nearby{.public.stubs.source}",
        ":framework-permission{.public.stubs.source}",
        ":framework-permission-s{.public.stubs.source}",
        ":framework-scheduling{.public.stubs.source}",
        ":framework-sdkextensions{.public.stubs.source}",
        ":framework-statsd{.public.stubs.source}",
        ":framework-supplementalprocess{.public.stubs.source}",
        ":framework-tethering{.public.stubs.source}",
        ":framework-uwb{.public.stubs.source}",
        ":framework-wifi{.public.stubs.source}",
        ":i18n.module.public.api{.public.stubs.source}",
    ],
    out: ["current.srcjar"],
    tools: ["merge_zips"],
    cmd: "$(location merge_zips) $(out) $(in)",
    visibility: ["//visibility:private"], // Used by make module in //development, mind.
}

genrule {
    name: "frameworks-base-api-removed.txt",
    srcs: [
        ":android.net.ipsec.ike{.public.removed-api.txt}",
        ":art.module.public.api{.public.removed-api.txt}",
        ":conscrypt.module.public.api{.public.removed-api.txt}",
        ":framework-appsearch{.public.removed-api.txt}",
        ":framework-connectivity{.public.removed-api.txt}",
        ":framework-connectivity-tiramisu{.public.removed-api.txt}",
        ":framework-graphics{.public.removed-api.txt}",
        ":framework-media{.public.removed-api.txt}",
        ":framework-mediaprovider{.public.removed-api.txt}",
        ":framework-nearby{.public.removed-api.txt}",
        ":framework-permission{.public.removed-api.txt}",
        ":framework-permission-s{.public.removed-api.txt}",
        ":framework-scheduling{.public.removed-api.txt}",
        ":framework-sdkextensions{.public.removed-api.txt}",
        ":framework-statsd{.public.removed-api.txt}",
        ":framework-supplementalprocess{.public.removed-api.txt}",
        ":framework-tethering{.public.removed-api.txt}",
        ":framework-uwb{.public.removed-api.txt}",
        ":framework-wifi{.public.removed-api.txt}",
        ":i18n.module.public.api{.public.removed-api.txt}",
        ":non-updatable-removed.txt",
    ],
    out: ["removed.txt"],
    tools: ["metalava"],
    cmd: metalava_cmd + "$(in) --api $(out)",
    dists: [
        {
            targets: ["droidcore"],
            dir: "api",
            dest: "removed.txt",
        },
        {
            targets: ["sdk"],
            dir: "apistubs/android/public/api",
            dest: "removed.txt",
        },
    ],
}

genrule {
    name: "frameworks-base-api-system-current.txt",
    srcs: [
        ":art.module.public.api{.system.api.txt}",
        ":android.net.ipsec.ike{.system.api.txt}",
        ":framework-appsearch{.system.api.txt}",
        ":framework-connectivity{.system.api.txt}",
        ":framework-connectivity-tiramisu{.system.api.txt}",
        ":framework-graphics{.system.api.txt}",
        ":framework-media{.system.api.txt}",
        ":framework-mediaprovider{.system.api.txt}",
        ":framework-nearby{.system.api.txt}",
        ":framework-permission{.system.api.txt}",
        ":framework-permission-s{.system.api.txt}",
        ":framework-scheduling{.system.api.txt}",
        ":framework-sdkextensions{.system.api.txt}",
        ":framework-statsd{.system.api.txt}",
        ":framework-supplementalprocess{.system.api.txt}",
        ":framework-tethering{.system.api.txt}",
        ":framework-uwb{.system.api.txt}",
        ":framework-wifi{.system.api.txt}",
        ":non-updatable-system-current.txt",
    ],
    out: ["system-current.txt"],
    tools: ["metalava"],
    cmd: metalava_cmd + "$(in) --api $(out)",
    dists: [
        {
            targets: ["droidcore"],
            dir: "api",
            dest: "system-current.txt",
        },
        {
            targets: ["sdk"],
            dir: "apistubs/android/system/api",
            dest: "android.txt",
        },
    ],
    visibility: ["//visibility:public"],
}

genrule {
    name: "frameworks-base-api-system-current-compat",
    srcs: [
@@ -293,87 +166,6 @@ genrule {
        "$(location :frameworks-base-api-system-current.txt)",
}

genrule {
    name: "frameworks-base-api-system-removed.txt",
    srcs: [
        ":art.module.public.api{.system.removed-api.txt}",
        ":android.net.ipsec.ike{.system.removed-api.txt}",
        ":framework-appsearch{.system.removed-api.txt}",
        ":framework-connectivity{.system.removed-api.txt}",
        ":framework-connectivity-tiramisu{.system.removed-api.txt}",
        ":framework-graphics{.system.removed-api.txt}",
        ":framework-media{.system.removed-api.txt}",
        ":framework-mediaprovider{.system.removed-api.txt}",
        ":framework-nearby{.system.removed-api.txt}",
        ":framework-permission{.system.removed-api.txt}",
        ":framework-permission-s{.system.removed-api.txt}",
        ":framework-scheduling{.system.removed-api.txt}",
        ":framework-sdkextensions{.system.removed-api.txt}",
        ":framework-statsd{.system.removed-api.txt}",
        ":framework-supplementalprocess{.system.removed-api.txt}",
        ":framework-tethering{.system.removed-api.txt}",
        ":framework-uwb{.system.removed-api.txt}",
        ":framework-wifi{.system.removed-api.txt}",
        ":non-updatable-system-removed.txt",
    ],
    out: ["system-removed.txt"],
    tools: ["metalava"],
    cmd: metalava_cmd + "$(in) --api $(out)",
    dists: [
        {
            targets: ["droidcore"],
            dir: "api",
            dest: "system-removed.txt",
        },
        {
            targets: ["sdk"],
            dir: "apistubs/android/system/api",
            dest: "removed.txt",
        },
    ],
    visibility: ["//visibility:public"],
}

genrule {
    name: "frameworks-base-api-module-lib-current.txt",
    srcs: [
        ":art.module.public.api{.module-lib.api.txt}",
        ":android.net.ipsec.ike{.module-lib.api.txt}",
        ":framework-appsearch{.module-lib.api.txt}",
        ":framework-connectivity{.module-lib.api.txt}",
        ":framework-connectivity-tiramisu{.module-lib.api.txt}",
        ":framework-graphics{.module-lib.api.txt}",
        ":framework-media{.module-lib.api.txt}",
        ":framework-mediaprovider{.module-lib.api.txt}",
        ":framework-nearby{.module-lib.api.txt}",
        ":framework-permission{.module-lib.api.txt}",
        ":framework-permission-s{.module-lib.api.txt}",
        ":framework-scheduling{.module-lib.api.txt}",
        ":framework-sdkextensions{.module-lib.api.txt}",
        ":framework-statsd{.module-lib.api.txt}",
        ":framework-supplementalprocess{.module-lib.api.txt}",
        ":framework-tethering{.module-lib.api.txt}",
        ":framework-uwb{.module-lib.api.txt}",
        ":framework-wifi{.module-lib.api.txt}",
        ":non-updatable-module-lib-current.txt",
    ],
    out: ["module-lib-current.txt"],
    tools: ["metalava"],
    cmd: metalava_cmd + "$(in) --api $(out)",
    dists: [
        {
            targets: ["droidcore"],
            dir: "api",
            dest: "module-lib-current.txt",
        },
        {
            targets: ["sdk"],
            dir: "apistubs/android/module-lib/api",
            dest: "android.txt",
        },
    ],
}

genrule {
    name: "frameworks-base-api-module-lib-current-compat",
    srcs: [
@@ -395,46 +187,6 @@ genrule {
        "$(location :frameworks-base-api-module-lib-current.txt)",
}

genrule {
    name: "frameworks-base-api-module-lib-removed.txt",
    srcs: [
        ":art.module.public.api{.module-lib.removed-api.txt}",
        ":android.net.ipsec.ike{.module-lib.removed-api.txt}",
        ":framework-appsearch{.module-lib.removed-api.txt}",
        ":framework-connectivity{.module-lib.removed-api.txt}",
        ":framework-connectivity-tiramisu{.module-lib.removed-api.txt}",
        ":framework-graphics{.module-lib.removed-api.txt}",
        ":framework-media{.module-lib.removed-api.txt}",
        ":framework-mediaprovider{.module-lib.removed-api.txt}",
        ":framework-nearby{.module-lib.removed-api.txt}",
        ":framework-permission{.module-lib.removed-api.txt}",
        ":framework-permission-s{.module-lib.removed-api.txt}",
        ":framework-scheduling{.module-lib.removed-api.txt}",
        ":framework-sdkextensions{.module-lib.removed-api.txt}",
        ":framework-statsd{.module-lib.removed-api.txt}",
        ":framework-supplementalprocess{.module-lib.removed-api.txt}",
        ":framework-tethering{.module-lib.removed-api.txt}",
        ":framework-uwb{.module-lib.removed-api.txt}",
        ":framework-wifi{.module-lib.removed-api.txt}",
        ":non-updatable-module-lib-removed.txt",
    ],
    out: ["module-lib-removed.txt"],
    tools: ["metalava"],
    cmd: metalava_cmd + "$(in) --api $(out)",
    dists: [
        {
            targets: ["droidcore"],
            dir: "api",
            dest: "module-lib-removed.txt",
        },
        {
            targets: ["sdk"],
            dir: "apistubs/android/module-lib/api",
            dest: "removed.txt",
        },
    ],
}

genrule {
    name: "combined-removed-dex",
    visibility: [
@@ -451,90 +203,3 @@ genrule {
    out: ["combined-removed-dex.txt"],
    cmd: "$(location gen_combined_removed_dex.sh) $(location metalava) $(genDir) $(in) > $(out)",
}

genrule {
    name: "frameworks-base-api-system-server-current.txt",
    srcs: [
        ":service-media-s{.system-server.api.txt}",
        ":service-permission{.system-server.api.txt}",
        ":non-updatable-system-server-current.txt",
    ],
    out: ["system-server-current.txt"],
    tools: ["metalava"],
    cmd: metalava_cmd + "$(in) --api $(out)",
    dists: [
        {
            targets: ["droidcore"],
            dir: "api",
            dest: "system-server-current.txt",
        },
        {
            targets: ["sdk"],
            dir: "apistubs/android/system-server/api",
            dest: "android.txt",
        },
    ],
}

genrule {
    name: "frameworks-base-api-system-server-removed.txt",
    srcs: [
        ":service-media-s{.system-server.removed-api.txt}",
        ":service-permission{.system-server.removed-api.txt}",
        ":non-updatable-system-server-removed.txt",
    ],
    out: ["system-server-removed.txt"],
    tools: ["metalava"],
    cmd: metalava_cmd + "$(in) --api $(out)",
    dists: [
        {
            targets: ["droidcore"],
            dir: "api",
            dest: "system-server-removed.txt",
        },
        {
            targets: ["sdk"],
            dir: "apistubs/android/system-server/api",
            dest: "removed.txt",
        },
    ],
}

// This rule will filter classes present in the jar files of mainline modules
// from the lint database in api-versions.xml.
// This is done to reduce the number of false positive NewApi findings in
// java libraries that compile against the module SDK
genrule {
    name: "api-versions-xml-public-filtered",
    srcs: [
        // Note: order matters: first parameter is the full api-versions.xml
        // after that the stubs files in any order
        // stubs files are all modules that export API surfaces EXCEPT ART
        ":framework-doc-stubs{.api_versions.xml}",
        ":android.net.ipsec.ike.stubs{.jar}",
        ":conscrypt.module.public.api.stubs{.jar}",
        ":framework-appsearch.stubs{.jar}",
        ":framework-connectivity.stubs{.jar}",
        ":framework-connectivity-tiramisu.stubs{.jar}",
        ":framework-graphics.stubs{.jar}",
        ":framework-media.stubs{.jar}",
        ":framework-mediaprovider.stubs{.jar}",
        ":framework-nearby.stubs{.jar}",
        ":framework-permission.stubs{.jar}",
        ":framework-permission-s.stubs{.jar}",
        ":framework-scheduling.stubs{.jar}",
        ":framework-sdkextensions.stubs{.jar}",
        ":framework-statsd.stubs{.jar}",
        ":framework-supplementalprocess.stubs{.jar}",
        ":framework-tethering.stubs{.jar}",
        ":framework-uwb.stubs{.jar}",
        ":framework-wifi.stubs{.jar}",
        ":i18n.module.public.api.stubs{.jar}",
    ],
    out: ["api-versions-public-filtered.xml"],
    tools: ["api_versions_trimmer"],
    cmd: "$(location api_versions_trimmer) $(out) $(in)",
    dist: {
        targets: ["sdk"],
    },
}