|
@@ -21,6 +21,7 @@ import (
|
|
|
|
|
|
"android/soong/android"
|
|
|
"android/soong/android/allowlists"
|
|
|
+ "android/soong/bazel"
|
|
|
"android/soong/python"
|
|
|
)
|
|
|
|
|
@@ -1931,3 +1932,17 @@ func TestGenerateConfigSetting(t *testing.T) {
|
|
|
Description: "Generating API contribution Bazel targets for custom module",
|
|
|
})
|
|
|
}
|
|
|
+
|
|
|
+// If values of all keys in an axis are equal to //conditions:default, drop the axis and print the common value
|
|
|
+func TestPrettyPrintSelectMapEqualValues(t *testing.T) {
|
|
|
+ lla := bazel.LabelListAttribute{
|
|
|
+ Value: bazel.LabelList{},
|
|
|
+ }
|
|
|
+ libFooImplLabel := bazel.Label{
|
|
|
+ Label: ":libfoo.impl",
|
|
|
+ }
|
|
|
+ lla.SetSelectValue(bazel.OsAndInApexAxis, bazel.AndroidAndNonApex, bazel.MakeLabelList([]bazel.Label{libFooImplLabel}))
|
|
|
+ lla.SetSelectValue(bazel.OsAndInApexAxis, bazel.ConditionsDefaultConfigKey, bazel.MakeLabelList([]bazel.Label{libFooImplLabel}))
|
|
|
+ actual, _ := prettyPrintAttribute(lla, 0)
|
|
|
+ android.AssertStringEquals(t, "Print the common value if all keys in an axis have the same value", `[":libfoo.impl"]`, actual)
|
|
|
+}
|