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

Commit 0600a8a7 authored by Lorenzo Colitti's avatar Lorenzo Colitti
Browse files

Enable/disable current targets via soong var instead of inline.

Add a soong variable to enable/disable all targets that build
against the current SDK. This makes it easy to enable or disable
those targets all together. It also makes it much easier to
automerge Android.bp changes from AOSP to mainline-prod without
merge conflict, because the build target definitions are always
the same, only the variable at the top of the file changes.

Bug: 167645754
Test: m NetworkStackApiStableShims NetworkStackApiCurrentShims succeeds
Change-Id: Ie0e7d4f73efcf1942aadf8b9d67e4de914307c09
Merged-In: Ie0e7d4f73efcf1942aadf8b9d67e4de914307c09
parent 0ef45d4c
Loading
Loading
Loading
Loading
+11 −1
Original line number Diff line number Diff line
@@ -45,6 +45,10 @@ package {
    default_applicable_licenses: ["Android-Apache-2.0"],
}

// Whether to enable the targets in this file that target current SDKs.
// Set to false in branches like mainline-prod where API classes are too old to build current code.
enable_current_sdk_targets = true

java_defaults {
    name: "NetworkStackDevApiLevel",
    min_sdk_version: "29",
@@ -117,6 +121,7 @@ java_library {
// integer so if the next SDK release happens to use that integer, we don't need to rename them.
java_library {
    name: "NetworkStackApi31Shims",
    enabled: enable_current_sdk_targets,
    defaults: ["NetworkStackShimsDefaults"],
    srcs: [
        "apishim/31/**/*.java",
@@ -136,6 +141,7 @@ java_library {
// called directly by the networkstack code.
java_library {
    name: "NetworkStackApiCurrentShims",
    enabled: enable_current_sdk_targets,
    defaults: ["NetworkStackShimsDefaults"],
    static_libs: [
        "NetworkStackShimsCommon",
@@ -203,6 +209,7 @@ android_library {
    ],
    static_libs: ["NetworkStackApiCurrentShims"],
    manifest: "AndroidManifestBase.xml",
    enabled: enable_current_sdk_targets,
    visibility: [
        "//frameworks/base/tests/net/integration",
        "//packages/modules/Connectivity/Tethering/tests/integration",
@@ -270,6 +277,7 @@ android_app {
    // The InProcessNetworkStack goes together with the PlatformCaptivePortalLogin, which replaces
    // the default CaptivePortalLogin.
    required: ["PlatformNetworkPermissionConfig", "PlatformCaptivePortalLogin"],
    enabled: enable_current_sdk_targets,
}

// Pre-merge the AndroidManifest for NetworkStackNext, so that its manifest can be merged on top
@@ -277,7 +285,8 @@ android_library {
    name: "NetworkStackNextManifestBase",
    defaults: ["NetworkStackAppDefaults", "NetworkStackDevApiLevel"],
    static_libs: ["NetworkStackApiCurrentLib"],
    manifest: "AndroidManifest.xml"
    manifest: "AndroidManifest.xml",
    enabled: enable_current_sdk_targets,
}

// NetworkStack build targeting the current API release, for testing on in-development SDK
@@ -289,6 +298,7 @@ android_app {
    manifest: "AndroidManifest_Next.xml",
    // The permission configuration *must* be included to ensure security of the device
    required: ["NetworkPermissionConfig"],
    enabled: enable_current_sdk_targets,
}

// Updatable network stack for finalized API