Optional modules need a module specific soong config variable

Optional modules, i.e. those modules which may be provided by Google or
vendors depending on the vendor, need to have its own Soong config
variable that controls whether prebuilts are used or not. Without that
the build will always attempt to use the Google prebuilt module instead
of the vendor provided module.

This change:
1. Adds support for specifying which modules are optional and will
   generate a module specific soong_config_module_type that uses a
   module specific Soong config variable.

2. Generates the soong_config_module_type for optional modules inline
   in the snapshot Android.bp file (instead of importing from a
   manually curated definitions files). That simplifies the cost of
   adding optional modules.

3. Adds some extra tests to ensure that S and Tiramisu behave the
   same way.

Bug: 233965247
Test: atest mainline_modules_sdks_test
      packages/modules/common/build/mainline_modules_sdks.sh
      # Check the output to ensure that wifi uses the wifi specific
      # Soong config but ipsec (as a non-optional module) does not.
      # Unpack the wifi snapshot into prebuilts/module_sdk/Wifi
Change-Id: I6a85b6f9877fc251010ff2bbee75fe8fa99db9b4
This commit is contained in:
Paul Duffin
2022-06-08 11:06:00 +00:00
parent e363782a5c
commit d20edd6c69
4 changed files with 390 additions and 13 deletions

View File

@@ -0,0 +1,168 @@
// This is auto-generated. DO NOT EDIT.
// Soong config variable module type added by test_optional_mainline_module.
soong_config_module_type {
name: "wifi_prebuilt_java_import",
module_type: "java_import",
config_namespace: "wifi_module",
bool_variables: ["source_build"],
properties: ["prefer"],
}
// Soong config variable module type added by test_optional_mainline_module.
soong_config_module_type {
name: "wifi_prebuilt_java_sdk_library_import",
module_type: "java_sdk_library_import",
config_namespace: "wifi_module",
bool_variables: ["source_build"],
properties: ["prefer"],
}
// Soong config variable module type added by test_optional_mainline_module.
soong_config_module_type {
name: "wifi_prebuilt_prebuilt_bootclasspath_fragment",
module_type: "prebuilt_bootclasspath_fragment",
config_namespace: "wifi_module",
bool_variables: ["source_build"],
properties: ["prefer"],
}
// Soong config variable module type added by test_optional_mainline_module.
soong_config_module_type {
name: "wifi_prebuilt_prebuilt_systemserverclasspath_fragment",
module_type: "prebuilt_systemserverclasspath_fragment",
config_namespace: "wifi_module",
bool_variables: ["source_build"],
properties: ["prefer"],
}
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"],
}
wifi_prebuilt_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.
prefer: true,
soong_config_variables: {
source_build: {
prefer: false,
},
},
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",
},
}
wifi_prebuilt_java_sdk_library_import {
name: "framework-wifi",
// Do not prefer prebuilt if the Soong config variable "source_build" in namespace "wifi_module" is true.
prefer: true,
soong_config_variables: {
source_build: {
prefer: false,
},
},
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",
},
}
wifi_prebuilt_java_import {
name: "service-wifi",
// Do not prefer prebuilt if the Soong config variable "source_build" in namespace "wifi_module" is true.
prefer: true,
soong_config_variables: {
source_build: {
prefer: false,
},
},
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"],
}
wifi_prebuilt_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.
prefer: true,
soong_config_variables: {
source_build: {
prefer: false,
},
},
visibility: ["//visibility:public"],
apex_available: ["com.android.wifi"],
licenses: ["wifi-module-sdk_Android-Apache-2.0"],
standalone_contents: ["service-wifi"],
}

View File

@@ -0,0 +1,108 @@
// 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",
prefer: false,
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",
prefer: false,
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",
prefer: false,
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",
prefer: false,
visibility: ["//visibility:public"],
apex_available: ["com.android.wifi"],
licenses: ["wifi-module-sdk_Android-Apache-2.0"],
standalone_contents: ["service-wifi"],
}