Merge "Update select tests for optionals" into main am: 4ab1563fe5 am: fd4249510d
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/3094707
Change-Id: Ie3fe41647e20b5b14b439e28eee84390b0660ca2
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
diff --git a/android/selects_test.go b/android/selects_test.go
index 7091566..42a8941 100644
--- a/android/selects_test.go
+++ b/android/selects_test.go
@@ -815,13 +815,21 @@
properties selectsMockModuleProperties
}
+func optionalToPtr[T any](o proptools.ConfigurableOptional[T]) *T {
+ if o.IsEmpty() {
+ return nil
+ }
+ x := o.Get()
+ return &x
+}
+
func (p *selectsMockModule) GenerateAndroidBuildActions(ctx ModuleContext) {
SetProvider(ctx, selectsTestProviderKey, selectsTestProvider{
- my_bool: p.properties.My_bool.Get(ctx),
- my_string: p.properties.My_string.Get(ctx),
- my_string_list: p.properties.My_string_list.Get(ctx),
- my_paths: p.properties.My_paths.Get(ctx),
- replacing_string_list: p.properties.Replacing_string_list.Get(ctx),
+ my_bool: optionalToPtr(p.properties.My_bool.Get(ctx)),
+ my_string: optionalToPtr(p.properties.My_string.Get(ctx)),
+ my_string_list: optionalToPtr(p.properties.My_string_list.Get(ctx)),
+ my_paths: optionalToPtr(p.properties.My_paths.Get(ctx)),
+ replacing_string_list: optionalToPtr(p.properties.Replacing_string_list.Get(ctx)),
my_nonconfigurable_bool: p.properties.My_nonconfigurable_bool,
my_nonconfigurable_string: p.properties.My_nonconfigurable_string,
my_nonconfigurable_string_list: p.properties.My_nonconfigurable_string_list,