Use module specific soong variable when last_optional_release is set. am: 25a6a5df1b

Original change: https://android-review.googlesource.com/c/platform/packages/modules/common/+/2766466

Change-Id: I82f9698c898ea8285bb0bc0b5b3f643a31424e8a
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Alyssa Ketpreechasawat
2023-09-28 15:22:26 +00:00
committed by Automerger Merge Worker
3 changed files with 140 additions and 2 deletions

View File

@@ -922,8 +922,7 @@ class MainlineModule:
# If the module is optional then it needs its own Soong config
# variable to allow it to be managed separately from other modules.
if (self.last_optional_release and
self.last_optional_release > build_release):
if self.last_optional_release:
config_var = ConfigVar(
namespace=f"{self.short_name}_module",
name="source_build",

View File

@@ -607,6 +607,21 @@ class TestAndroidBpTransformations(unittest.TestCase):
self.apply_transformations(src, transformations, mm.Tiramisu, expected)
def test_optional_mainline_module_latest(self):
"""Tests the transformations applied to an optional mainline sdk LATEST.
This uses wifi as an example of a optional mainline sdk. This checks
that the use_source_config_var property is inserted.
"""
src = read_test_data("wifi_Android.bp.input")
expected = read_test_data("wifi_latest_Android.bp.expected")
module = MAINLINE_MODULES_BY_APEX["com.android.wifi"]
transformations = module.transformations(mm.LATEST, mm.Sdk)
self.apply_transformations(src, transformations, mm.LATEST, expected)
def test_art(self):
"""Tests the transformations applied to a the ART mainline module.

View File

@@ -0,0 +1,124 @@
// This is auto-generated. DO NOT EDIT.
package {
// A default list here prevents the license LSC from adding its own list which would
// be unnecessary as every module in the sdk already has its own licenses property.
default_applicable_licenses: ["Android-Apache-2.0"],
}
prebuilt_bootclasspath_fragment {
name: "com.android.wifi-bootclasspath-fragment",
// Do not prefer prebuilt if the Soong config variable "source_build" in namespace "wifi_module" is true.
use_source_config_var: {
config_namespace: "wifi_module",
var_name: "source_build",
},
visibility: ["//visibility:public"],
apex_available: ["com.android.wifi"],
licenses: ["wifi-module-sdk_Android-Apache-2.0"],
contents: ["framework-wifi"],
fragments: [
{
apex: "com.android.art",
module: "art-bootclasspath-fragment",
},
],
hidden_api: {
unsupported: ["hiddenapi/hiddenapi-unsupported.txt"],
max_target_r_low_priority: ["hiddenapi/hiddenapi-max-target-r-low-priority.txt"],
max_target_o_low_priority: ["hiddenapi/hiddenapi-max-target-o-low-priority.txt"],
annotation_flags: "hiddenapi/annotation-flags.csv",
metadata: "hiddenapi/metadata.csv",
index: "hiddenapi/index.csv",
signature_patterns: "hiddenapi/signature-patterns.csv",
filtered_stub_flags: "hiddenapi/filtered-stub-flags.csv",
filtered_flags: "hiddenapi/filtered-flags.csv",
},
}
java_sdk_library_import {
name: "framework-wifi",
// Do not prefer prebuilt if the Soong config variable "source_build" in namespace "wifi_module" is true.
use_source_config_var: {
config_namespace: "wifi_module",
var_name: "source_build",
},
visibility: ["//visibility:public"],
apex_available: [
"com.android.wifi",
"test_com.android.wifi",
],
licenses: ["wifi-module-sdk_Android-Apache-2.0"],
shared_library: false,
permitted_packages: [
"android.hardware.wifi",
"android.net.wifi",
"com.android.wifi.x",
],
public: {
jars: ["sdk_library/public/framework-wifi-stubs.jar"],
stub_srcs: ["sdk_library/public/framework-wifi_stub_sources"],
current_api: "sdk_library/public/framework-wifi.txt",
removed_api: "sdk_library/public/framework-wifi-removed.txt",
annotations: "sdk_library/public/framework-wifi_annotations.zip",
sdk_version: "module_current",
},
system: {
jars: ["sdk_library/system/framework-wifi-stubs.jar"],
stub_srcs: ["sdk_library/system/framework-wifi_stub_sources"],
current_api: "sdk_library/system/framework-wifi.txt",
removed_api: "sdk_library/system/framework-wifi-removed.txt",
annotations: "sdk_library/system/framework-wifi_annotations.zip",
sdk_version: "module_current",
},
module_lib: {
jars: ["sdk_library/module-lib/framework-wifi-stubs.jar"],
stub_srcs: ["sdk_library/module-lib/framework-wifi_stub_sources"],
current_api: "sdk_library/module-lib/framework-wifi.txt",
removed_api: "sdk_library/module-lib/framework-wifi-removed.txt",
annotations: "sdk_library/module-lib/framework-wifi_annotations.zip",
sdk_version: "module_current",
},
}
java_import {
name: "service-wifi",
// Do not prefer prebuilt if the Soong config variable "source_build" in namespace "wifi_module" is true.
use_source_config_var: {
config_namespace: "wifi_module",
var_name: "source_build",
},
visibility: [
"//frameworks/opt/net/wifi/service/apex",
"//frameworks/opt/net/wifi/tests/wifitests/apex",
"//packages/modules/Wifi/apex",
"//packages/modules/Wifi/service",
"//packages/modules/Wifi/service/tests/wifitests/apex",
],
apex_available: [
"com.android.wifi",
"test_com.android.wifi",
],
licenses: ["wifi-module-sdk_Android-Apache-2.0"],
jars: ["java_systemserver_libs/snapshot/jars/are/invalid/service-wifi.jar"],
}
license {
name: "wifi-module-sdk_Android-Apache-2.0",
visibility: ["//visibility:private"],
license_kinds: ["SPDX-license-identifier-Apache-2.0"],
license_text: ["licenses/build/soong/licenses/LICENSE"],
}
prebuilt_systemserverclasspath_fragment {
name: "com.android.wifi-systemserverclasspath-fragment",
// Do not prefer prebuilt if the Soong config variable "source_build" in namespace "wifi_module" is true.
use_source_config_var: {
config_namespace: "wifi_module",
var_name: "source_build",
},
visibility: ["//visibility:public"],
apex_available: ["com.android.wifi"],
licenses: ["wifi-module-sdk_Android-Apache-2.0"],
standalone_contents: ["service-wifi"],
}