| Cole Faust | a963b94 | 2024-04-11 17:43:00 -0700 | [diff] [blame] | 1 | package android | 
|  | 2 |  | 
|  | 3 | import "github.com/google/blueprint/proptools" | 
|  | 4 |  | 
|  | 5 | // CreateSelectOsToBool is a utility function that makes it easy to create a | 
|  | 6 | // Configurable property value that maps from os to a bool. Use an empty string | 
|  | 7 | // to indicate a "default" case. | 
|  | 8 | func CreateSelectOsToBool(cases map[string]*bool) proptools.Configurable[bool] { | 
|  | 9 | var resultCases []proptools.ConfigurableCase[bool] | 
|  | 10 | for pattern, value := range cases { | 
|  | 11 | if pattern == "" { | 
|  | 12 | resultCases = append(resultCases, proptools.NewConfigurableCase( | 
|  | 13 | []proptools.ConfigurablePattern{proptools.NewDefaultConfigurablePattern()}, | 
|  | 14 | value, | 
|  | 15 | )) | 
|  | 16 | } else { | 
|  | 17 | resultCases = append(resultCases, proptools.NewConfigurableCase( | 
|  | 18 | []proptools.ConfigurablePattern{proptools.NewStringConfigurablePattern(pattern)}, | 
|  | 19 | value, | 
|  | 20 | )) | 
|  | 21 | } | 
|  | 22 | } | 
|  | 23 |  | 
|  | 24 | return proptools.NewConfigurable( | 
|  | 25 | []proptools.ConfigurableCondition{proptools.NewConfigurableCondition("os", nil)}, | 
|  | 26 | resultCases, | 
|  | 27 | ) | 
|  | 28 | } |