Replace soong config module types with selects
select statements are a new syntax for conditionals in bp files
that require less boilerplate and expose the opportunity for
configuring the modules two different ways in a single build.
See go/soong-selects for more information.
Flag: EXEMPT refactor
Bug: 342006386
Test: Presubmits
Change-Id: I6f9e27224c239702764101025fe6ed1f2c93b46a
diff --git a/wpa_supplicant/Android.bp b/wpa_supplicant/Android.bp
index e6ba165..c0835ae 100644
--- a/wpa_supplicant/Android.bp
+++ b/wpa_supplicant/Android.bp
@@ -91,37 +91,8 @@
],
}
-soong_config_module_type {
- name: "wpa_supplicant_cflags_cc_defaults",
- module_type: "cc_defaults",
- config_namespace: "wpa_supplicant",
- value_variables: [
- "platform_version",
- "nl80211_driver",
- ],
- properties: ["cflags"],
-}
-
-wpa_supplicant_cflags_cc_defaults {
+cc_defaults {
name: "wpa_supplicant_cflags_defaults",
- soong_config_variables: {
- // Devices that include this module should set these soong config vars appropriately.
- // For example:
- // $(call add_soong_config_namespace, wpa_supplicant)
- // $(call add_soong_config_var_value, wpa_supplicant, platform_version, $(PLATFORM_VERSION))
- // $(call add_soong_config_var_value, wpa_supplicant, nl80211_driver, CONFIG_DRIVER_NL80211_QCA)
- platform_version: {
- cflags: ["-DVERSION_STR_POSTFIX=\"-%s\""],
- conditions_default: {
- // Default value
- cflags: ["-DVERSION_STR_POSTFIX=\"-Android\""],
- },
- },
- nl80211_driver: {
- cflags: ["-D%s"],
- // Flag is optional, so no default value provided.
- },
- },
// Generated by building wpa_supplicant and printing LOCAL_CFLAGS.
cflags: [
"-DANDROID_LOG_NAME=\"wpa_supplicant\"",
@@ -215,7 +186,20 @@
"-Wno-unused-function",
"-Wno-unused-parameter",
"-Wno-unused-variable",
- ],
+ ] +
+ // Devices that include this module should set these soong config vars appropriately.
+ // For example:
+ // $(call soong_config_set, wpa_supplicant, platform_version, $(PLATFORM_VERSION))
+ // $(call soong_config_set, wpa_supplicant, nl80211_driver, CONFIG_DRIVER_NL80211_QCA)
+ select(soong_config_variable("wpa_supplicant", "platform_version"), {
+ any @ version: ["-DVERSION_STR_POSTFIX=\"-" + version + "\""],
+ default: ["-DVERSION_STR_POSTFIX=\"-Android\""],
+ }) +
+ select(soong_config_variable("wpa_supplicant", "nl80211_driver"), {
+ any @ driver: ["-D" + driver],
+ // Flag is optional, so no default value provided.
+ default: [],
+ }),
// Similar to suppressing clang compiler warnings, here we
// suppress clang-tidy warnings to reduce noises in Android build.log.
tidy_checks: [