Use module specific soong variable when last_optional_release is set.
The original idea of using module specific soong variable was for the modules when they start off as optional module (before transition to mandatory). However, practically at build time, it can remain optional. For now, we will keep self.last_optional_release as the condition and the module can have their specific variable (for enabling/disabling prebuilts) by setting last_optional_release.
Bug: 301183608
Test: atest mainline_modules_sdks_test --host
packages/modules/common/build/mainline_modules_sdks.sh
Change-Id: I8af5d3dd8733d244c2ade1d9b5118308b3c00622
This commit is contained in:
@@ -922,8 +922,7 @@ class MainlineModule:
|
|||||||
|
|
||||||
# If the module is optional then it needs its own Soong config
|
# If the module is optional then it needs its own Soong config
|
||||||
# variable to allow it to be managed separately from other modules.
|
# variable to allow it to be managed separately from other modules.
|
||||||
if (self.last_optional_release and
|
if self.last_optional_release:
|
||||||
self.last_optional_release > build_release):
|
|
||||||
config_var = ConfigVar(
|
config_var = ConfigVar(
|
||||||
namespace=f"{self.short_name}_module",
|
namespace=f"{self.short_name}_module",
|
||||||
name="source_build",
|
name="source_build",
|
||||||
|
|||||||
@@ -607,6 +607,21 @@ class TestAndroidBpTransformations(unittest.TestCase):
|
|||||||
|
|
||||||
self.apply_transformations(src, transformations, mm.Tiramisu, expected)
|
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):
|
def test_art(self):
|
||||||
"""Tests the transformations applied to a the ART mainline module.
|
"""Tests the transformations applied to a the ART mainline module.
|
||||||
|
|
||||||
|
|||||||
@@ -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"],
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user