| Colin Cross | 7f64b6d | 2015-07-09 13:57:48 -0700 | [diff] [blame] | 1 | // Copyright 2015 Google Inc. All rights reserved. | 
|  | 2 | // | 
|  | 3 | // Licensed under the Apache License, Version 2.0 (the "License"); | 
|  | 4 | // you may not use this file except in compliance with the License. | 
|  | 5 | // You may obtain a copy of the License at | 
|  | 6 | // | 
|  | 7 | //     http://www.apache.org/licenses/LICENSE-2.0 | 
|  | 8 | // | 
|  | 9 | // Unless required by applicable law or agreed to in writing, software | 
|  | 10 | // distributed under the License is distributed on an "AS IS" BASIS, | 
|  | 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | 
|  | 12 | // See the License for the specific language governing permissions and | 
|  | 13 | // limitations under the License. | 
|  | 14 |  | 
| Colin Cross | 635c3b0 | 2016-05-18 15:37:25 -0700 | [diff] [blame] | 15 | package android | 
| Colin Cross | 7f64b6d | 2015-07-09 13:57:48 -0700 | [diff] [blame] | 16 |  | 
|  | 17 | import ( | 
|  | 18 | "fmt" | 
|  | 19 | "reflect" | 
| Dan Willemsen | 490fd49 | 2015-11-24 17:53:15 -0800 | [diff] [blame] | 20 | "runtime" | 
| Colin Cross | 7f64b6d | 2015-07-09 13:57:48 -0700 | [diff] [blame] | 21 | "strings" | 
|  | 22 |  | 
| Colin Cross | 7f64b6d | 2015-07-09 13:57:48 -0700 | [diff] [blame] | 23 | "github.com/google/blueprint/proptools" | 
|  | 24 | ) | 
|  | 25 |  | 
|  | 26 | func init() { | 
| Paul Duffin | e7a055c | 2021-03-07 15:46:33 +0000 | [diff] [blame] | 27 | registerVariableBuildComponents(InitRegistrationContext) | 
|  | 28 | } | 
|  | 29 |  | 
|  | 30 | func registerVariableBuildComponents(ctx RegistrationContext) { | 
|  | 31 | ctx.PreDepsMutators(func(ctx RegisterMutatorsContext) { | 
| Colin Cross | eabaedd | 2020-02-06 17:01:55 -0800 | [diff] [blame] | 32 | ctx.BottomUp("variable", VariableMutator).Parallel() | 
| Colin Cross | 1e676be | 2016-10-12 14:38:15 -0700 | [diff] [blame] | 33 | }) | 
| Colin Cross | 7f64b6d | 2015-07-09 13:57:48 -0700 | [diff] [blame] | 34 | } | 
|  | 35 |  | 
| Paul Duffin | e7a055c | 2021-03-07 15:46:33 +0000 | [diff] [blame] | 36 | var PrepareForTestWithVariables = FixtureRegisterWithContext(registerVariableBuildComponents) | 
|  | 37 |  | 
| Colin Cross | 7f64b6d | 2015-07-09 13:57:48 -0700 | [diff] [blame] | 38 | type variableProperties struct { | 
|  | 39 | Product_variables struct { | 
| Dan Willemsen | 47cf66b | 2015-09-16 16:48:54 -0700 | [diff] [blame] | 40 | Platform_sdk_version struct { | 
|  | 41 | Asflags []string | 
| Colin Cross | ceeff0f | 2017-05-08 13:43:00 -0700 | [diff] [blame] | 42 | Cflags  []string | 
| Dan Willemsen | 9fe1410 | 2021-07-13 21:52:04 -0700 | [diff] [blame] | 43 | Cmd     *string | 
| Dan Willemsen | 47cf66b | 2015-09-16 16:48:54 -0700 | [diff] [blame] | 44 | } | 
| Colin Cross | 8316319 | 2015-12-01 16:31:16 -0800 | [diff] [blame] | 45 |  | 
| Yuntao Xu | 402e9b0 | 2021-08-09 15:44:44 -0700 | [diff] [blame] | 46 | Platform_sdk_version_or_codename struct { | 
|  | 47 | Java_resource_dirs []string | 
|  | 48 | } | 
|  | 49 |  | 
| Anton Hansson | b021bf8 | 2021-08-27 17:35:40 +0100 | [diff] [blame] | 50 | Platform_sdk_extension_version struct { | 
|  | 51 | Cmd *string | 
|  | 52 | } | 
|  | 53 |  | 
| Dan Willemsen | 9fe1410 | 2021-07-13 21:52:04 -0700 | [diff] [blame] | 54 | Platform_version_name struct { | 
|  | 55 | Base_dir *string | 
|  | 56 | } | 
|  | 57 |  | 
| Steven Moreland | a48df2b | 2024-06-03 22:29:38 +0000 | [diff] [blame] | 58 | Shipping_api_level struct { | 
|  | 59 | Cflags []string | 
|  | 60 | } | 
|  | 61 |  | 
| Colin Cross | 8316319 | 2015-12-01 16:31:16 -0800 | [diff] [blame] | 62 | // unbundled_build is a catch-all property to annotate modules that don't build in one or | 
|  | 63 | // more unbundled branches, usually due to dependencies missing from the manifest. | 
|  | 64 | Unbundled_build struct { | 
| Cole Faust | a963b94 | 2024-04-11 17:43:00 -0700 | [diff] [blame] | 65 | Enabled proptools.Configurable[bool] `android:"arch_variant,replace_instead_of_append"` | 
| Colin Cross | 8316319 | 2015-12-01 16:31:16 -0800 | [diff] [blame] | 66 | } `android:"arch_variant"` | 
| Dan Willemsen | 496e395 | 2016-01-05 14:27:55 -0800 | [diff] [blame] | 67 |  | 
| Jeongik Cha | f08e59c | 2023-02-09 10:47:59 +0900 | [diff] [blame] | 68 | // similar to `Unbundled_build`, but `Always_use_prebuilt_sdks` means that it uses prebuilt | 
|  | 69 | // sdk specifically. | 
|  | 70 | Always_use_prebuilt_sdks struct { | 
| Cole Faust | a963b94 | 2024-04-11 17:43:00 -0700 | [diff] [blame] | 71 | Enabled proptools.Configurable[bool] `android:"arch_variant,replace_instead_of_append"` | 
| Jeongik Cha | f08e59c | 2023-02-09 10:47:59 +0900 | [diff] [blame] | 72 | } `android:"arch_variant"` | 
|  | 73 |  | 
| Christopher Ferris | a5a6b9c | 2024-04-23 17:17:49 -0700 | [diff] [blame] | 74 | Malloc_low_memory struct { | 
| Christopher Ferris | c71193a | 2019-12-16 09:55:10 -0800 | [diff] [blame] | 75 | Cflags              []string `android:"arch_variant"` | 
|  | 76 | Shared_libs         []string `android:"arch_variant"` | 
|  | 77 | Whole_static_libs   []string `android:"arch_variant"` | 
| Florian Mayer | ca2854e | 2024-01-16 16:42:34 -0800 | [diff] [blame] | 78 | Static_libs         []string `android:"arch_variant"` | 
| Christopher Ferris | c71193a | 2019-12-16 09:55:10 -0800 | [diff] [blame] | 79 | Exclude_static_libs []string `android:"arch_variant"` | 
| Christopher Ferris | dea6617 | 2021-09-24 00:07:53 -0700 | [diff] [blame] | 80 | Srcs                []string `android:"arch_variant"` | 
|  | 81 | Header_libs         []string `android:"arch_variant"` | 
| Sasha Smundak | 61ebf8d | 2018-08-31 16:56:05 -0700 | [diff] [blame] | 82 | } `android:"arch_variant"` | 
| Evgenii Stepanov | 8391efa | 2016-05-12 18:04:18 -0700 | [diff] [blame] | 83 |  | 
| Evgenii Stepanov | 19ff3c9 | 2020-04-29 14:57:30 -0700 | [diff] [blame] | 84 | Malloc_zero_contents struct { | 
|  | 85 | Cflags []string `android:"arch_variant"` | 
|  | 86 | } `android:"arch_variant"` | 
|  | 87 |  | 
|  | 88 | Malloc_pattern_fill_contents struct { | 
|  | 89 | Cflags []string `android:"arch_variant"` | 
|  | 90 | } `android:"arch_variant"` | 
|  | 91 |  | 
| Evgenii Stepanov | 8391efa | 2016-05-12 18:04:18 -0700 | [diff] [blame] | 92 | Safestack struct { | 
|  | 93 | Cflags []string `android:"arch_variant"` | 
|  | 94 | } `android:"arch_variant"` | 
| Dan Willemsen | a6f7d15 | 2016-07-12 14:57:40 -0700 | [diff] [blame] | 95 |  | 
| Dan Willemsen | 1be3538 | 2016-07-25 17:42:18 -0700 | [diff] [blame] | 96 | Binder32bit struct { | 
|  | 97 | Cflags []string | 
|  | 98 | } | 
| Dan Willemsen | fcebcd5 | 2016-09-22 14:49:10 -0700 | [diff] [blame] | 99 |  | 
| Colin Cross | 9543642 | 2017-05-04 13:57:05 -0700 | [diff] [blame] | 100 | Override_rs_driver struct { | 
|  | 101 | Cflags []string | 
|  | 102 | } | 
|  | 103 |  | 
| Steven Moreland | c2b9f06 | 2017-12-13 14:06:20 -0800 | [diff] [blame] | 104 | // treble_linker_namespaces is true when the system/vendor linker namespace separation is | 
|  | 105 | // enabled. | 
|  | 106 | Treble_linker_namespaces struct { | 
|  | 107 | Cflags []string | 
|  | 108 | } | 
| Steven Moreland | c2b9f06 | 2017-12-13 14:06:20 -0800 | [diff] [blame] | 109 | // enforce_vintf_manifest is true when a device is required to have a vintf manifest. | 
|  | 110 | Enforce_vintf_manifest struct { | 
|  | 111 | Cflags []string | 
|  | 112 | } | 
|  | 113 |  | 
| Jihoon Kang | cbcad7c | 2023-06-01 22:31:52 +0000 | [diff] [blame] | 114 | Build_from_text_stub struct { | 
|  | 115 | Static_libs         []string | 
|  | 116 | Exclude_static_libs []string | 
|  | 117 | } | 
|  | 118 |  | 
| Colin Cross | 6bc59ef | 2016-12-08 09:46:35 -0800 | [diff] [blame] | 119 | // debuggable is true for eng and userdebug builds, and can be used to turn on additional | 
|  | 120 | // debugging features that don't significantly impact runtime behavior.  userdebug builds | 
|  | 121 | // are used for dogfooding and performance testing, and should be as similar to user builds | 
|  | 122 | // as possible. | 
| Dan Willemsen | fcebcd5 | 2016-09-22 14:49:10 -0700 | [diff] [blame] | 123 | Debuggable struct { | 
| Jim Tang | 9148324 | 2024-09-10 18:04:28 +0800 | [diff] [blame] | 124 | Apk             *string | 
| Sasha Smundak | b6d2305 | 2019-04-01 18:37:36 -0700 | [diff] [blame] | 125 | Cflags          []string | 
|  | 126 | Cppflags        []string | 
|  | 127 | Init_rc         []string | 
|  | 128 | Required        []string | 
|  | 129 | Host_required   []string | 
|  | 130 | Target_required []string | 
| Philip Cuadra | 328e0bf | 2020-10-19 22:01:29 -0700 | [diff] [blame] | 131 | Strip           struct { | 
|  | 132 | All                          *bool | 
|  | 133 | Keep_symbols                 *bool | 
|  | 134 | Keep_symbols_and_debug_frame *bool | 
|  | 135 | } | 
| Herbert Xue | 3817832 | 2024-07-16 17:28:15 +0800 | [diff] [blame] | 136 | Static_libs         []string | 
|  | 137 | Exclude_static_libs []string | 
|  | 138 | Whole_static_libs   []string | 
|  | 139 | Shared_libs         []string | 
|  | 140 | Jni_libs            []string | 
| Jiyong Park | 16e77a9 | 2021-08-30 18:43:19 +0900 | [diff] [blame] | 141 |  | 
|  | 142 | Cmdline []string | 
| Inseob Kim | f5ed300 | 2022-01-07 19:17:29 +0900 | [diff] [blame] | 143 |  | 
| Jay Aliomer | 2599d1d | 2021-09-23 15:49:54 -0400 | [diff] [blame] | 144 | Srcs         []string | 
|  | 145 | Exclude_srcs []string | 
| Cole Faust | ed94000 | 2023-08-15 11:59:24 -0700 | [diff] [blame] | 146 | Cmd          *string | 
| Jiyong Park | 62532d7 | 2024-04-12 16:16:28 +0900 | [diff] [blame] | 147 |  | 
|  | 148 | Deps []string | 
| Dan Willemsen | fcebcd5 | 2016-09-22 14:49:10 -0700 | [diff] [blame] | 149 | } | 
| Colin Cross | 6bc59ef | 2016-12-08 09:46:35 -0800 | [diff] [blame] | 150 |  | 
| Usta Shrestha | c725f47 | 2022-01-11 02:44:21 -0500 | [diff] [blame] | 151 | // eng is true for -eng builds, and can be used to turn on additional heavyweight debugging | 
| Colin Cross | 6bc59ef | 2016-12-08 09:46:35 -0800 | [diff] [blame] | 152 | // features. | 
|  | 153 | Eng struct { | 
|  | 154 | Cflags   []string | 
|  | 155 | Cppflags []string | 
| John Reck | 1d2b7ee | 2018-07-11 11:01:59 -0700 | [diff] [blame] | 156 | Lto      struct { | 
|  | 157 | Never *bool | 
|  | 158 | } | 
| Colin Cross | 3273cc2 | 2018-10-26 23:58:42 -0700 | [diff] [blame] | 159 | Sanitize struct { | 
|  | 160 | Address *bool | 
|  | 161 | } | 
| Felka Chang | f13642e | 2019-06-21 20:58:27 +0800 | [diff] [blame] | 162 | Optimize struct { | 
|  | 163 | Enabled *bool | 
|  | 164 | } | 
| Colin Cross | 6bc59ef | 2016-12-08 09:46:35 -0800 | [diff] [blame] | 165 | } | 
| Colin Cross | b2123aa | 2017-05-05 13:37:11 -0700 | [diff] [blame] | 166 |  | 
| Dmitry Shmidt | dba5419 | 2017-08-23 14:58:37 -0700 | [diff] [blame] | 167 | Uml struct { | 
|  | 168 | Cppflags []string | 
|  | 169 | } | 
| Risan | ea004dd | 2017-11-27 18:14:46 +0900 | [diff] [blame] | 170 |  | 
|  | 171 | Arc struct { | 
| Satoshi Niwa | 54f4826 | 2020-12-18 09:53:26 +0900 | [diff] [blame] | 172 | Cflags            []string `android:"arch_variant"` | 
|  | 173 | Exclude_srcs      []string `android:"arch_variant"` | 
| Jasmine Chen | acace42 | 2021-03-05 00:56:40 +0800 | [diff] [blame] | 174 | Header_libs       []string `android:"arch_variant"` | 
| Satoshi Niwa | 54f4826 | 2020-12-18 09:53:26 +0900 | [diff] [blame] | 175 | Include_dirs      []string `android:"arch_variant"` | 
|  | 176 | Shared_libs       []string `android:"arch_variant"` | 
|  | 177 | Static_libs       []string `android:"arch_variant"` | 
|  | 178 | Srcs              []string `android:"arch_variant"` | 
|  | 179 | Whole_static_libs []string `android:"arch_variant"` | 
|  | 180 | } `android:"arch_variant"` | 
| Roland Levillain | 2879d41 | 2019-08-13 15:00:18 +0100 | [diff] [blame] | 181 |  | 
| Colin Cross | d9a121b | 2020-01-27 13:26:42 -0800 | [diff] [blame] | 182 | Native_coverage struct { | 
| Colin Cross | 2b10ba0 | 2020-02-05 16:23:21 -0800 | [diff] [blame] | 183 | Src          *string  `android:"arch_variant"` | 
| Colin Cross | d9a121b | 2020-01-27 13:26:42 -0800 | [diff] [blame] | 184 | Srcs         []string `android:"arch_variant"` | 
|  | 185 | Exclude_srcs []string `android:"arch_variant"` | 
|  | 186 | } `android:"arch_variant"` | 
| Devin Moore | c381e10 | 2023-07-06 22:03:58 +0000 | [diff] [blame] | 187 |  | 
|  | 188 | // release_aidl_use_unfrozen is "true" when a device can | 
|  | 189 | // use the unfrozen versions of AIDL interfaces. | 
|  | 190 | Release_aidl_use_unfrozen struct { | 
| Kiyoung Kim | a0523da | 2024-08-19 10:15:30 +0900 | [diff] [blame] | 191 | Cflags                 []string | 
|  | 192 | Cmd                    *string | 
|  | 193 | Required               []string | 
|  | 194 | Vintf_fragment_modules []string | 
| Devin Moore | c381e10 | 2023-07-06 22:03:58 +0000 | [diff] [blame] | 195 | } | 
| Colin Cross | 8316319 | 2015-12-01 16:31:16 -0800 | [diff] [blame] | 196 | } `android:"arch_variant"` | 
| Colin Cross | 7f64b6d | 2015-07-09 13:57:48 -0700 | [diff] [blame] | 197 | } | 
|  | 198 |  | 
| Colin Cross | 6961a49 | 2020-02-06 16:57:45 -0800 | [diff] [blame] | 199 | var defaultProductVariables interface{} = variableProperties{} | 
| Colin Cross | 7f64b6d | 2015-07-09 13:57:48 -0700 | [diff] [blame] | 200 |  | 
| Cole Faust | f8231dd | 2023-04-21 17:37:11 -0700 | [diff] [blame] | 201 | type ProductVariables struct { | 
| Dan Willemsen | 174978c | 2016-05-11 00:27:49 -0700 | [diff] [blame] | 202 | // Suffix to add to generated Makefiles | 
|  | 203 | Make_suffix *string `json:",omitempty"` | 
|  | 204 |  | 
| Inseob Kim | 2da72af | 2024-06-18 11:09:12 +0900 | [diff] [blame] | 205 | BuildId              *string `json:",omitempty"` | 
|  | 206 | BuildFingerprintFile *string `json:",omitempty"` | 
|  | 207 | BuildNumberFile      *string `json:",omitempty"` | 
|  | 208 | BuildHostnameFile    *string `json:",omitempty"` | 
|  | 209 | BuildThumbprintFile  *string `json:",omitempty"` | 
|  | 210 | DisplayBuildNumber   *bool   `json:",omitempty"` | 
| Nan Zhang | 581fd21 | 2018-01-10 16:06:12 -0800 | [diff] [blame] | 211 |  | 
| Linus Tufvesson | ba270c5 | 2024-04-12 13:06:22 +0200 | [diff] [blame] | 212 | Platform_display_version_name          *string  `json:",omitempty"` | 
|  | 213 | Platform_version_name                  *string  `json:",omitempty"` | 
|  | 214 | Platform_sdk_version                   *int     `json:",omitempty"` | 
|  | 215 | Platform_sdk_codename                  *string  `json:",omitempty"` | 
|  | 216 | Platform_sdk_version_or_codename       *string  `json:",omitempty"` | 
|  | 217 | Platform_sdk_final                     *bool    `json:",omitempty"` | 
|  | 218 | Platform_sdk_extension_version         *int     `json:",omitempty"` | 
|  | 219 | Platform_base_sdk_extension_version    *int     `json:",omitempty"` | 
|  | 220 | Platform_version_active_codenames      []string `json:",omitempty"` | 
|  | 221 | Platform_version_all_preview_codenames []string `json:",omitempty"` | 
|  | 222 | Platform_systemsdk_versions            []string `json:",omitempty"` | 
|  | 223 | Platform_security_patch                *string  `json:",omitempty"` | 
|  | 224 | Platform_preview_sdk_version           *string  `json:",omitempty"` | 
|  | 225 | Platform_base_os                       *string  `json:",omitempty"` | 
|  | 226 | Platform_version_last_stable           *string  `json:",omitempty"` | 
|  | 227 | Platform_version_known_codenames       *string  `json:",omitempty"` | 
| Colin Cross | 4225f65 | 2015-09-17 14:33:42 -0700 | [diff] [blame] | 228 |  | 
| Jeongik Cha | 219141c | 2020-08-06 23:00:37 +0900 | [diff] [blame] | 229 | DeviceName                            *string  `json:",omitempty"` | 
| Trevor Radcliffe | 90727f4 | 2022-03-21 19:34:02 +0000 | [diff] [blame] | 230 | DeviceProduct                         *string  `json:",omitempty"` | 
| Jeongik Cha | 219141c | 2020-08-06 23:00:37 +0900 | [diff] [blame] | 231 | DeviceArch                            *string  `json:",omitempty"` | 
|  | 232 | DeviceArchVariant                     *string  `json:",omitempty"` | 
|  | 233 | DeviceCpuVariant                      *string  `json:",omitempty"` | 
|  | 234 | DeviceAbi                             []string `json:",omitempty"` | 
|  | 235 | DeviceVndkVersion                     *string  `json:",omitempty"` | 
|  | 236 | DeviceCurrentApiLevelForVendorModules *string  `json:",omitempty"` | 
|  | 237 | DeviceSystemSdkVersions               []string `json:",omitempty"` | 
| Juan Yescas | 05d4d90 | 2023-04-07 10:35:35 -0700 | [diff] [blame] | 238 | DeviceMaxPageSizeSupported            *string  `json:",omitempty"` | 
| Vilas Bhat | b3d2d22 | 2023-12-04 22:51:20 +0000 | [diff] [blame] | 239 | DeviceNoBionicPageSizeMacro           *bool    `json:",omitempty"` | 
| Colin Cross | 4225f65 | 2015-09-17 14:33:42 -0700 | [diff] [blame] | 240 |  | 
| Justin Yun | 41cbb5e | 2023-11-29 17:58:16 +0900 | [diff] [blame] | 241 | VendorApiLevel *string `json:",omitempty"` | 
|  | 242 |  | 
| Colin Cross | a74ca04 | 2019-01-31 14:31:51 -0800 | [diff] [blame] | 243 | DeviceSecondaryArch        *string  `json:",omitempty"` | 
|  | 244 | DeviceSecondaryArchVariant *string  `json:",omitempty"` | 
|  | 245 | DeviceSecondaryCpuVariant  *string  `json:",omitempty"` | 
|  | 246 | DeviceSecondaryAbi         []string `json:",omitempty"` | 
| Colin Cross | 4225f65 | 2015-09-17 14:33:42 -0700 | [diff] [blame] | 247 |  | 
| dimitry | 8d6dde8 | 2019-07-11 10:23:53 +0200 | [diff] [blame] | 248 | NativeBridgeArch         *string  `json:",omitempty"` | 
|  | 249 | NativeBridgeArchVariant  *string  `json:",omitempty"` | 
|  | 250 | NativeBridgeCpuVariant   *string  `json:",omitempty"` | 
|  | 251 | NativeBridgeAbi          []string `json:",omitempty"` | 
|  | 252 | NativeBridgeRelativePath *string  `json:",omitempty"` | 
| dimitry | 1f33e40 | 2019-03-26 12:39:31 +0100 | [diff] [blame] | 253 |  | 
| dimitry | 8d6dde8 | 2019-07-11 10:23:53 +0200 | [diff] [blame] | 254 | NativeBridgeSecondaryArch         *string  `json:",omitempty"` | 
|  | 255 | NativeBridgeSecondaryArchVariant  *string  `json:",omitempty"` | 
|  | 256 | NativeBridgeSecondaryCpuVariant   *string  `json:",omitempty"` | 
|  | 257 | NativeBridgeSecondaryAbi          []string `json:",omitempty"` | 
|  | 258 | NativeBridgeSecondaryRelativePath *string  `json:",omitempty"` | 
| dimitry | 1f33e40 | 2019-03-26 12:39:31 +0100 | [diff] [blame] | 259 |  | 
| Colin Cross | 4225f65 | 2015-09-17 14:33:42 -0700 | [diff] [blame] | 260 | HostArch          *string `json:",omitempty"` | 
|  | 261 | HostSecondaryArch *string `json:",omitempty"` | 
| Colin Cross | 528d67e | 2021-07-23 22:23:07 +0000 | [diff] [blame] | 262 | HostMusl          *bool   `json:",omitempty"` | 
| Dan Willemsen | 490fd49 | 2015-11-24 17:53:15 -0800 | [diff] [blame] | 263 |  | 
|  | 264 | CrossHost              *string `json:",omitempty"` | 
|  | 265 | CrossHostArch          *string `json:",omitempty"` | 
|  | 266 | CrossHostSecondaryArch *string `json:",omitempty"` | 
| Colin Cross | 8316319 | 2015-12-01 16:31:16 -0800 | [diff] [blame] | 267 |  | 
| Jeongik Cha | cee5ba9 | 2021-02-19 12:11:51 +0900 | [diff] [blame] | 268 | DeviceResourceOverlays     []string `json:",omitempty"` | 
|  | 269 | ProductResourceOverlays    []string `json:",omitempty"` | 
|  | 270 | EnforceRROTargets          []string `json:",omitempty"` | 
| Colin Cross | a74ca04 | 2019-01-31 14:31:51 -0800 | [diff] [blame] | 271 | EnforceRROExcludedOverlays []string `json:",omitempty"` | 
| Colin Cross | face4e4 | 2017-10-30 17:32:15 -0700 | [diff] [blame] | 272 |  | 
| Colin Cross | a74ca04 | 2019-01-31 14:31:51 -0800 | [diff] [blame] | 273 | AAPTCharacteristics *string  `json:",omitempty"` | 
|  | 274 | AAPTConfig          []string `json:",omitempty"` | 
|  | 275 | AAPTPreferredConfig *string  `json:",omitempty"` | 
|  | 276 | AAPTPrebuiltDPI     []string `json:",omitempty"` | 
| Colin Cross | face4e4 | 2017-10-30 17:32:15 -0700 | [diff] [blame] | 277 |  | 
| Justin Yun | 635e788 | 2024-07-04 14:50:57 +0900 | [diff] [blame] | 278 | DefaultAppCertificate           *string  `json:",omitempty"` | 
|  | 279 | ExtraOtaKeys                    []string `json:",omitempty"` | 
|  | 280 | ExtraOtaRecoveryKeys            []string `json:",omitempty"` | 
|  | 281 | MainlineSepolicyDevCertificates *string  `json:",omitempty"` | 
| Colin Cross | 61ae0b7 | 2017-12-01 17:16:02 -0800 | [diff] [blame] | 282 |  | 
| Colin Cross | face4e4 | 2017-10-30 17:32:15 -0700 | [diff] [blame] | 283 | AppsDefaultVersionName *string `json:",omitempty"` | 
|  | 284 |  | 
| Cole Faust | 701ca25 | 2021-11-23 19:02:08 -0800 | [diff] [blame] | 285 | Allow_missing_dependencies   *bool    `json:",omitempty"` | 
|  | 286 | Unbundled_build              *bool    `json:",omitempty"` | 
|  | 287 | Unbundled_build_apps         []string `json:",omitempty"` | 
|  | 288 | Unbundled_build_image        *bool    `json:",omitempty"` | 
|  | 289 | Always_use_prebuilt_sdks     *bool    `json:",omitempty"` | 
|  | 290 | Skip_boot_jars_check         *bool    `json:",omitempty"` | 
| Christopher Ferris | a5a6b9c | 2024-04-23 17:17:49 -0700 | [diff] [blame] | 291 | Malloc_low_memory            *bool    `json:",omitempty"` | 
| Cole Faust | 701ca25 | 2021-11-23 19:02:08 -0800 | [diff] [blame] | 292 | Malloc_zero_contents         *bool    `json:",omitempty"` | 
|  | 293 | Malloc_pattern_fill_contents *bool    `json:",omitempty"` | 
|  | 294 | Safestack                    *bool    `json:",omitempty"` | 
|  | 295 | HostStaticBinaries           *bool    `json:",omitempty"` | 
|  | 296 | Binder32bit                  *bool    `json:",omitempty"` | 
|  | 297 | UseGoma                      *bool    `json:",omitempty"` | 
| Taylor Santiago | 3c16e61 | 2024-05-30 14:41:31 -0700 | [diff] [blame] | 298 | UseABFS                      *bool    `json:",omitempty"` | 
| Cole Faust | 701ca25 | 2021-11-23 19:02:08 -0800 | [diff] [blame] | 299 | UseRBE                       *bool    `json:",omitempty"` | 
|  | 300 | UseRBEJAVAC                  *bool    `json:",omitempty"` | 
|  | 301 | UseRBER8                     *bool    `json:",omitempty"` | 
|  | 302 | UseRBED8                     *bool    `json:",omitempty"` | 
|  | 303 | Debuggable                   *bool    `json:",omitempty"` | 
|  | 304 | Eng                          *bool    `json:",omitempty"` | 
|  | 305 | Treble_linker_namespaces     *bool    `json:",omitempty"` | 
|  | 306 | Enforce_vintf_manifest       *bool    `json:",omitempty"` | 
|  | 307 | Uml                          *bool    `json:",omitempty"` | 
|  | 308 | Arc                          *bool    `json:",omitempty"` | 
|  | 309 | MinimizeJavaDebugInfo        *bool    `json:",omitempty"` | 
| Jihoon Kang | cbcad7c | 2023-06-01 22:31:52 +0000 | [diff] [blame] | 310 | Build_from_text_stub         *bool    `json:",omitempty"` | 
| Colin Cross | 16b2349 | 2016-01-06 14:41:07 -0800 | [diff] [blame] | 311 |  | 
| Inseob Kim | 8fa54da | 2024-03-19 16:48:59 +0900 | [diff] [blame] | 312 | BuildType *string `json:",omitempty"` | 
|  | 313 |  | 
| Logan Chien | 4fcea3d | 2018-11-20 11:59:08 +0800 | [diff] [blame] | 314 | Check_elf_files *bool `json:",omitempty"` | 
|  | 315 |  | 
| Colin Cross | 5a0dcd5 | 2018-10-05 14:20:06 -0700 | [diff] [blame] | 316 | UncompressPrivAppDex             *bool    `json:",omitempty"` | 
|  | 317 | ModulesLoadedByPrivilegedModules []string `json:",omitempty"` | 
| Colin Cross | 43f08db | 2018-11-12 10:13:39 -0800 | [diff] [blame] | 318 |  | 
| satayev | d604b21 | 2021-07-21 14:23:52 +0100 | [diff] [blame] | 319 | BootJars     ConfiguredJarList `json:",omitempty"` | 
|  | 320 | ApexBootJars ConfiguredJarList `json:",omitempty"` | 
| Vladimir Marko | e8b00d6 | 2018-12-21 15:54:16 +0000 | [diff] [blame] | 321 |  | 
| Colin Cross | a74ca04 | 2019-01-31 14:31:51 -0800 | [diff] [blame] | 322 | IntegerOverflowExcludePaths []string `json:",omitempty"` | 
| Ivan Lozano | 5f59553 | 2017-07-13 14:46:05 -0700 | [diff] [blame] | 323 |  | 
| Colin Cross | a74ca04 | 2019-01-31 14:31:51 -0800 | [diff] [blame] | 324 | EnableCFI       *bool    `json:",omitempty"` | 
|  | 325 | CFIExcludePaths []string `json:",omitempty"` | 
|  | 326 | CFIIncludePaths []string `json:",omitempty"` | 
| Vishwath Mohan | 1fa3ac5 | 2017-10-31 02:26:14 -0700 | [diff] [blame] | 327 |  | 
| Kostya Kortchinsky | d5275c8 | 2019-02-01 08:42:56 -0800 | [diff] [blame] | 328 | DisableScudo *bool `json:",omitempty"` | 
|  | 329 |  | 
| Evgenii Stepanov | 4beaa0c | 2021-01-05 16:41:26 -0800 | [diff] [blame] | 330 | MemtagHeapExcludePaths      []string `json:",omitempty"` | 
|  | 331 | MemtagHeapAsyncIncludePaths []string `json:",omitempty"` | 
|  | 332 | MemtagHeapSyncIncludePaths  []string `json:",omitempty"` | 
|  | 333 |  | 
| Hang Lu | a98aab9 | 2023-03-17 13:17:22 +0800 | [diff] [blame] | 334 | HWASanIncludePaths []string `json:",omitempty"` | 
| Tomislav Novak | f734f00 | 2023-08-22 10:51:44 -0700 | [diff] [blame] | 335 | HWASanExcludePaths []string `json:",omitempty"` | 
| Hang Lu | a98aab9 | 2023-03-17 13:17:22 +0800 | [diff] [blame] | 336 |  | 
| Justin Yun | d5f6c82 | 2019-06-25 16:47:17 +0900 | [diff] [blame] | 337 | VendorPath    *string `json:",omitempty"` | 
|  | 338 | OdmPath       *string `json:",omitempty"` | 
|  | 339 | ProductPath   *string `json:",omitempty"` | 
|  | 340 | SystemExtPath *string `json:",omitempty"` | 
| Dan Willemsen | 4353bc4 | 2016-12-05 17:16:02 -0800 | [diff] [blame] | 341 |  | 
| Dan Willemsen | a03cf6d | 2016-09-26 15:45:04 -0700 | [diff] [blame] | 342 | ClangTidy  *bool   `json:",omitempty"` | 
|  | 343 | TidyChecks *string `json:",omitempty"` | 
|  | 344 |  | 
| Roland Levillain | ada1270 | 2020-06-09 13:07:36 +0100 | [diff] [blame] | 345 | JavaCoveragePaths        []string `json:",omitempty"` | 
|  | 346 | JavaCoverageExcludePaths []string `json:",omitempty"` | 
|  | 347 |  | 
| Pirama Arumuga Nainar | b37ae58 | 2022-01-26 22:14:32 -0800 | [diff] [blame] | 348 | GcovCoverage                *bool    `json:",omitempty"` | 
|  | 349 | ClangCoverage               *bool    `json:",omitempty"` | 
|  | 350 | NativeCoveragePaths         []string `json:",omitempty"` | 
|  | 351 | NativeCoverageExcludePaths  []string `json:",omitempty"` | 
|  | 352 | ClangCoverageContinuousMode *bool    `json:",omitempty"` | 
| Dan Willemsen | 581341d | 2017-02-09 16:16:31 -0800 | [diff] [blame] | 353 |  | 
| Colin Cross | 1a6acd4 | 2020-06-16 17:51:46 -0700 | [diff] [blame] | 354 | // Set by NewConfig | 
| Liz Kammer | 09f947d | 2021-05-12 14:51:49 -0400 | [diff] [blame] | 355 | Native_coverage *bool `json:",omitempty"` | 
| Colin Cross | 1a6acd4 | 2020-06-16 17:51:46 -0700 | [diff] [blame] | 356 |  | 
| Colin Cross | 23ae82a | 2016-11-02 14:34:39 -0700 | [diff] [blame] | 357 | SanitizeHost       []string `json:",omitempty"` | 
|  | 358 | SanitizeDevice     []string `json:",omitempty"` | 
| Ivan Lozano | 0c3a1ef | 2017-06-28 09:10:48 -0700 | [diff] [blame] | 359 | SanitizeDeviceDiag []string `json:",omitempty"` | 
| Colin Cross | 23ae82a | 2016-11-02 14:34:39 -0700 | [diff] [blame] | 360 | SanitizeDeviceArch []string `json:",omitempty"` | 
| Hiroshi Yamauchi | e2a1063 | 2016-12-19 13:44:41 -0800 | [diff] [blame] | 361 |  | 
|  | 362 | ArtUseReadBarrier *bool `json:",omitempty"` | 
| Jack He | 8cc7143 | 2016-12-08 15:45:07 -0800 | [diff] [blame] | 363 |  | 
|  | 364 | BtConfigIncludeDir *string `json:",omitempty"` | 
| Colin Cross | 9543642 | 2017-05-04 13:57:05 -0700 | [diff] [blame] | 365 |  | 
|  | 366 | Override_rs_driver *string `json:",omitempty"` | 
| Jiyong Park | d773eb3 | 2017-07-03 13:18:12 +0900 | [diff] [blame] | 367 |  | 
|  | 368 | DeviceKernelHeaders []string `json:",omitempty"` | 
| Justin Yun | 7154928 | 2017-11-17 12:10:28 +0900 | [diff] [blame] | 369 |  | 
|  | 370 | ExtraVndkVersions []string `json:",omitempty"` | 
| Jeff Gaston | 088e29e | 2017-11-29 16:47:17 -0800 | [diff] [blame] | 371 |  | 
|  | 372 | NamespacesToExport []string `json:",omitempty"` | 
| Pirama Arumuga Nainar | 4954080 | 2018-01-29 23:11:42 -0800 | [diff] [blame] | 373 |  | 
| Vinh Tran | 7a8362c | 2022-11-01 15:33:51 -0400 | [diff] [blame] | 374 | PgoAdditionalProfileDirs []string `json:",omitempty"` | 
| Dan Willemsen | 0fe7866 | 2018-03-26 12:41:18 -0700 | [diff] [blame] | 375 |  | 
| Inseob Kim | 5eb7ee9 | 2022-04-27 10:30:34 +0900 | [diff] [blame] | 376 | MultitreeUpdateMeta bool `json:",omitempty"` | 
|  | 377 |  | 
| Inseob Kim | 6077b23 | 2023-08-31 16:49:59 +0900 | [diff] [blame] | 378 | BoardVendorSepolicyDirs      []string `json:",omitempty"` | 
|  | 379 | BoardOdmSepolicyDirs         []string `json:",omitempty"` | 
|  | 380 | SystemExtPublicSepolicyDirs  []string `json:",omitempty"` | 
|  | 381 | SystemExtPrivateSepolicyDirs []string `json:",omitempty"` | 
|  | 382 | BoardSepolicyM4Defs          []string `json:",omitempty"` | 
| Tri Vo | 35a5143 | 2018-03-25 20:00:00 -0700 | [diff] [blame] | 383 |  | 
| Herbert Xue | 0fc8abe | 2024-08-21 13:03:01 +0800 | [diff] [blame] | 384 | BoardPlatform           *string `json:",omitempty"` | 
| Inseob Kim | 16ebd5a | 2020-12-09 23:08:17 +0900 | [diff] [blame] | 385 | BoardSepolicyVers       *string `json:",omitempty"` | 
|  | 386 | PlatformSepolicyVersion *string `json:",omitempty"` | 
|  | 387 |  | 
| Inseob Kim | 1a0afcc | 2022-02-14 23:10:51 +0900 | [diff] [blame] | 388 | SystemExtSepolicyPrebuiltApiDir *string `json:",omitempty"` | 
|  | 389 | ProductSepolicyPrebuiltApiDir   *string `json:",omitempty"` | 
|  | 390 |  | 
| Inseob Kim | 843f664 | 2022-01-07 09:11:23 +0900 | [diff] [blame] | 391 | PlatformSepolicyCompatVersions []string `json:",omitempty"` | 
|  | 392 |  | 
| Cole Faust | 46f6e2f | 2024-06-20 12:57:43 -0700 | [diff] [blame] | 393 | VendorVars     map[string]map[string]string `json:",omitempty"` | 
|  | 394 | VendorVarTypes map[string]map[string]string `json:",omitempty"` | 
| Colin Cross | 395f2cf | 2018-10-24 16:10:32 -0700 | [diff] [blame] | 395 |  | 
| Dan Albert | d05ba00 | 2021-04-13 15:55:47 -0700 | [diff] [blame] | 396 | Ndk_abis *bool `json:",omitempty"` | 
| Jiyong Park | 8fd6192 | 2018-11-08 02:50:25 +0900 | [diff] [blame] | 397 |  | 
| Dennis Shen | e2ed70c | 2023-01-11 14:15:43 +0000 | [diff] [blame] | 398 | TrimmedApex                  *bool `json:",omitempty"` | 
| Jiyong Park | 4da0797 | 2021-01-05 21:01:11 +0900 | [diff] [blame] | 399 | ForceApexSymlinkOptimization *bool `json:",omitempty"` | 
|  | 400 | CompressedApex               *bool `json:",omitempty"` | 
|  | 401 | Aml_abis                     *bool `json:",omitempty"` | 
| Colin Cross | 43f08db | 2018-11-12 10:13:39 -0800 | [diff] [blame] | 402 |  | 
|  | 403 | DexpreoptGlobalConfig *string `json:",omitempty"` | 
| Jiyong Park | 7f67f48 | 2019-01-05 12:57:48 +0900 | [diff] [blame] | 404 |  | 
| Inseob Kim | 7b85eeb | 2021-03-23 20:52:24 +0900 | [diff] [blame] | 405 | WithDexpreopt bool `json:",omitempty"` | 
|  | 406 |  | 
| Jiakai Zhang | 4d90da2 | 2023-07-12 16:51:48 +0100 | [diff] [blame] | 407 | ManifestPackageNameOverrides   []string `json:",omitempty"` | 
|  | 408 | CertificateOverrides           []string `json:",omitempty"` | 
|  | 409 | PackageNameOverrides           []string `json:",omitempty"` | 
|  | 410 | ConfiguredJarLocationOverrides []string `json:",omitempty"` | 
| Jeongik Cha | c946414 | 2019-01-07 12:07:27 +0900 | [diff] [blame] | 411 |  | 
| Albert Martin | eefabcf | 2022-03-21 20:11:16 +0000 | [diff] [blame] | 412 | ApexGlobalMinSdkVersionOverride *string `json:",omitempty"` | 
|  | 413 |  | 
| Jeongik Cha | c946414 | 2019-01-07 12:07:27 +0900 | [diff] [blame] | 414 | EnforceSystemCertificate          *bool    `json:",omitempty"` | 
| Colin Cross | 440e0d0 | 2020-06-11 11:32:11 -0700 | [diff] [blame] | 415 | EnforceSystemCertificateAllowList []string `json:",omitempty"` | 
| Colin Cross | 8faf8fc | 2019-01-16 15:15:52 -0800 | [diff] [blame] | 416 |  | 
| Colin Cross | f24a22a | 2019-01-31 14:12:44 -0800 | [diff] [blame] | 417 | ProductHiddenAPIStubs       []string `json:",omitempty"` | 
|  | 418 | ProductHiddenAPIStubsSystem []string `json:",omitempty"` | 
|  | 419 | ProductHiddenAPIStubsTest   []string `json:",omitempty"` | 
| Dan Willemsen | 71c7460 | 2019-04-10 12:27:35 -0700 | [diff] [blame] | 420 |  | 
| Inseob Kim | 0866b00 | 2019-04-15 20:21:29 +0900 | [diff] [blame] | 421 | ProductPublicSepolicyDirs  []string `json:",omitempty"` | 
|  | 422 | ProductPrivateSepolicyDirs []string `json:",omitempty"` | 
| Inseob Kim | 0866b00 | 2019-04-15 20:21:29 +0900 | [diff] [blame] | 423 |  | 
| Dan Willemsen | 54879d1 | 2019-04-18 10:08:46 -0700 | [diff] [blame] | 424 | TargetFSConfigGen []string `json:",omitempty"` | 
| Colin Cross | 50ddcc4 | 2019-05-16 12:28:22 -0700 | [diff] [blame] | 425 |  | 
| Justin Yun | 2cc4250 | 2024-09-11 14:10:20 +0900 | [diff] [blame] | 426 | UseSoongSystemImage            *bool   `json:",omitempty"` | 
|  | 427 | ProductSoongDefinedSystemImage *string `json:",omitempty"` | 
|  | 428 |  | 
| Jeongik Cha | 2cc570d | 2019-10-29 15:44:45 +0900 | [diff] [blame] | 429 | EnforceProductPartitionInterface *bool `json:",omitempty"` | 
| Jooyung Han | 3ab2c3e | 2019-12-05 16:27:44 +0900 | [diff] [blame] | 430 |  | 
| Yifan Hong | 82db735 | 2020-01-21 16:12:26 -0800 | [diff] [blame] | 431 | BoardUsesRecoveryAsBoot *bool `json:",omitempty"` | 
| Yifan Hong | 97365ee | 2020-07-29 09:51:57 -0700 | [diff] [blame] | 432 |  | 
| Yifan Hong | 42bef8d | 2020-08-05 14:36:09 -0700 | [diff] [blame] | 433 | BoardKernelBinaries                []string `json:",omitempty"` | 
|  | 434 | BoardKernelModuleInterfaceVersions []string `json:",omitempty"` | 
| Yifan Hong | dd8dacc | 2020-10-21 15:40:17 -0700 | [diff] [blame] | 435 |  | 
|  | 436 | BoardMoveRecoveryResourcesToVendorBoot *bool `json:",omitempty"` | 
| Bill Peckham | bae4749 | 2021-01-08 09:34:44 -0800 | [diff] [blame] | 437 |  | 
|  | 438 | PrebuiltHiddenApiDir *string `json:",omitempty"` | 
| Inseob Kim | 60c32f0 | 2020-12-21 22:53:05 +0900 | [diff] [blame] | 439 |  | 
| Steven Moreland | a48df2b | 2024-06-03 22:29:38 +0000 | [diff] [blame] | 440 | Shipping_api_level *string `json:",omitempty"` | 
| Inseob Kim | 0cac7b4 | 2021-02-03 18:16:46 +0900 | [diff] [blame] | 441 |  | 
| Cole Faust | ded7960 | 2023-09-05 17:48:11 -0700 | [diff] [blame] | 442 | BuildBrokenPluginValidation         []string `json:",omitempty"` | 
|  | 443 | BuildBrokenClangAsFlags             bool     `json:",omitempty"` | 
|  | 444 | BuildBrokenClangCFlags              bool     `json:",omitempty"` | 
|  | 445 | BuildBrokenClangProperty            bool     `json:",omitempty"` | 
|  | 446 | GenruleSandboxing                   *bool    `json:",omitempty"` | 
|  | 447 | BuildBrokenEnforceSyspropOwner      bool     `json:",omitempty"` | 
|  | 448 | BuildBrokenTrebleSyspropNeverallow  bool     `json:",omitempty"` | 
| Cole Faust | ded7960 | 2023-09-05 17:48:11 -0700 | [diff] [blame] | 449 | BuildBrokenVendorPropertyNamespace  bool     `json:",omitempty"` | 
|  | 450 | BuildBrokenIncorrectPartitionImages bool     `json:",omitempty"` | 
|  | 451 | BuildBrokenInputDirModules          []string `json:",omitempty"` | 
| Jiyong Park | 3bb9924 | 2024-01-04 23:21:26 +0000 | [diff] [blame] | 452 | BuildBrokenDontCheckSystemSdk       bool     `json:",omitempty"` | 
| Inseob Kim | 2da72af | 2024-06-18 11:09:12 +0900 | [diff] [blame] | 453 | BuildBrokenDupSysprop               bool     `json:",omitempty"` | 
| Inseob Kim | 67e5add19 | 2021-03-17 18:05:33 +0900 | [diff] [blame] | 454 |  | 
| Jiakai Zhang | 48203e3 | 2023-06-02 23:42:21 +0100 | [diff] [blame] | 455 | BuildWarningBadOptionalUsesLibsAllowlist []string `json:",omitempty"` | 
|  | 456 |  | 
| Hridya Valsaraju | 5a5c7d5 | 2021-04-02 16:45:24 -0700 | [diff] [blame] | 457 | BuildDebugfsRestrictionsEnabled bool `json:",omitempty"` | 
|  | 458 |  | 
| Inseob Kim | 67e5add19 | 2021-03-17 18:05:33 +0900 | [diff] [blame] | 459 | RequiresInsecureExecmemForSwiftshader bool `json:",omitempty"` | 
|  | 460 |  | 
|  | 461 | SelinuxIgnoreNeverallows bool `json:",omitempty"` | 
|  | 462 |  | 
| Devin Moore | c381e10 | 2023-07-06 22:03:58 +0000 | [diff] [blame] | 463 | Release_aidl_use_unfrozen *bool `json:",omitempty"` | 
|  | 464 |  | 
| Inseob Kim | a10ef27 | 2021-09-15 03:04:53 +0000 | [diff] [blame] | 465 | SepolicyFreezeTestExtraDirs         []string `json:",omitempty"` | 
|  | 466 | SepolicyFreezeTestExtraPrebuiltDirs []string `json:",omitempty"` | 
| Jiyong Park | d163d4d | 2021-10-12 16:47:43 +0900 | [diff] [blame] | 467 |  | 
|  | 468 | GenerateAidlNdkPlatformBackend bool `json:",omitempty"` | 
| Christopher Ferris | 98f1022 | 2022-07-13 23:16:52 -0700 | [diff] [blame] | 469 |  | 
|  | 470 | IgnorePrefer32OnDevice bool `json:",omitempty"` | 
| Spandan Das | c576383 | 2022-11-08 18:42:16 +0000 | [diff] [blame] | 471 |  | 
| Sam Delmerico | 98a7329 | 2023-02-21 11:50:29 -0500 | [diff] [blame] | 472 | SourceRootDirs []string `json:",omitempty"` | 
| Vinh Tran | 44cb78c | 2023-03-09 22:07:19 -0500 | [diff] [blame] | 473 |  | 
|  | 474 | AfdoProfiles []string `json:",omitempty"` | 
| Wei Li | c642d68 | 2023-05-04 09:06:06 -0700 | [diff] [blame] | 475 |  | 
| Inseob Kim | 8fa54da | 2024-03-19 16:48:59 +0900 | [diff] [blame] | 476 | ProductManufacturer string `json:",omitempty"` | 
|  | 477 | ProductBrand        string `json:",omitempty"` | 
| Joe Onorato | fee845a | 2023-05-09 08:14:14 -0700 | [diff] [blame] | 478 |  | 
| Yu Liu | eebb259 | 2023-10-12 20:31:27 -0700 | [diff] [blame] | 479 | ReleaseVersion          string   `json:",omitempty"` | 
|  | 480 | ReleaseAconfigValueSets []string `json:",omitempty"` | 
| Kiyoung Kim | e623c58 | 2023-07-06 16:43:44 +0900 | [diff] [blame] | 481 |  | 
| Zhi Dou | 3f65a41 | 2023-08-10 21:47:40 +0000 | [diff] [blame] | 482 | ReleaseAconfigFlagDefaultPermission string `json:",omitempty"` | 
|  | 483 |  | 
| Alyssa Ketpreechasawat | 34ab879 | 2023-10-06 07:01:22 +0000 | [diff] [blame] | 484 | ReleaseDefaultModuleBuildFromSource *bool `json:",omitempty"` | 
|  | 485 |  | 
| Inseob Kim | 5bac3b6 | 2023-08-25 21:29:46 +0900 | [diff] [blame] | 486 | CheckVendorSeappViolations *bool `json:",omitempty"` | 
| Cole Faust | b4cb0c8 | 2023-09-14 15:16:58 -0700 | [diff] [blame] | 487 |  | 
| Inseob Kim | e4e85d5 | 2023-10-25 23:53:58 +0900 | [diff] [blame] | 488 | BuildFlags map[string]string `json:",omitempty"` | 
| Jihoon Kang | c1b04d6 | 2023-11-16 19:07:04 +0000 | [diff] [blame] | 489 |  | 
| Cole Faust | 751a4a5 | 2024-05-21 16:51:59 -0700 | [diff] [blame] | 490 | BuildFlagTypes map[string]string `json:",omitempty"` | 
|  | 491 |  | 
| Jihoon Kang | c1b04d6 | 2023-11-16 19:07:04 +0000 | [diff] [blame] | 492 | BuildFromSourceStub *bool `json:",omitempty"` | 
| Spandan Das | 8ab28dd | 2024-02-17 03:31:45 +0000 | [diff] [blame] | 493 |  | 
| Spandan Das | 0d24ade | 2024-03-08 04:20:15 +0000 | [diff] [blame] | 494 | BuildIgnoreApexContributionContents *bool `json:",omitempty"` | 
| Jihoon Kang | b36fc54 | 2024-02-22 19:35:26 +0000 | [diff] [blame] | 495 |  | 
|  | 496 | HiddenapiExportableStubs *bool `json:",omitempty"` | 
| Jihoon Kang | 3534946 | 2024-02-22 19:52:46 +0000 | [diff] [blame] | 497 |  | 
|  | 498 | ExportRuntimeApis *bool `json:",omitempty"` | 
| Yu Liu | 67a2842 | 2024-03-05 00:36:31 +0000 | [diff] [blame] | 499 |  | 
|  | 500 | AconfigContainerValidation string `json:",omitempty"` | 
| Inseob Kim | 8fa54da | 2024-03-19 16:48:59 +0900 | [diff] [blame] | 501 |  | 
|  | 502 | ProductLocales []string `json:",omitempty"` | 
|  | 503 |  | 
|  | 504 | ProductDefaultWifiChannels []string `json:",omitempty"` | 
|  | 505 |  | 
|  | 506 | BoardUseVbmetaDigestInFingerprint *bool `json:",omitempty"` | 
|  | 507 |  | 
|  | 508 | OemProperties []string `json:",omitempty"` | 
| Kiyoung Kim | 881e465 | 2024-07-08 11:02:23 +0900 | [diff] [blame] | 509 |  | 
|  | 510 | ArtTargetIncludeDebugBuild *bool `json:",omitempty"` | 
| Inseob Kim | d8538e5 | 2024-07-31 02:00:41 +0000 | [diff] [blame] | 511 |  | 
| Inseob Kim | acf9174 | 2024-08-05 12:51:05 +0900 | [diff] [blame] | 512 | SystemPropFiles    []string `json:",omitempty"` | 
|  | 513 | SystemExtPropFiles []string `json:",omitempty"` | 
| Inseob Kim | 01d4f8b | 2024-08-08 17:47:14 +0900 | [diff] [blame] | 514 | ProductPropFiles   []string `json:",omitempty"` | 
| Inseob Kim | 9a22c7e | 2024-08-26 15:58:09 +0900 | [diff] [blame] | 515 | OdmPropFiles       []string `json:",omitempty"` | 
| Inseob Kim | 6bd92d5 | 2024-07-31 02:01:03 +0000 | [diff] [blame] | 516 |  | 
|  | 517 | EnableUffdGc *string `json:",omitempty"` | 
| Bill Yang | 3b3aac0 | 2024-09-05 09:22:09 +0000 | [diff] [blame] | 518 |  | 
|  | 519 | BoardAvbEnable                         *bool    `json:",omitempty"` | 
|  | 520 | BoardAvbSystemAddHashtreeFooterArgs    []string `json:",omitempty"` | 
|  | 521 | DeviceFrameworkCompatibilityMatrixFile []string `json:",omitempty"` | 
|  | 522 | DeviceProductCompatibilityMatrixFile   []string `json:",omitempty"` | 
| Cole Faust | cb193ec | 2023-09-20 16:01:18 -0700 | [diff] [blame] | 523 | } | 
|  | 524 |  | 
| Cole Faust | 11edf55 | 2023-10-13 11:32:14 -0700 | [diff] [blame] | 525 | type PartitionQualifiedVariablesType struct { | 
|  | 526 | BuildingImage               bool   `json:",omitempty"` | 
|  | 527 | BoardErofsCompressor        string `json:",omitempty"` | 
|  | 528 | BoardErofsCompressHints     string `json:",omitempty"` | 
|  | 529 | BoardErofsPclusterSize      string `json:",omitempty"` | 
|  | 530 | BoardExtfsInodeCount        string `json:",omitempty"` | 
|  | 531 | BoardExtfsRsvPct            string `json:",omitempty"` | 
|  | 532 | BoardF2fsSloadCompressFlags string `json:",omitempty"` | 
|  | 533 | BoardFileSystemCompress     string `json:",omitempty"` | 
|  | 534 | BoardFileSystemType         string `json:",omitempty"` | 
|  | 535 | BoardJournalSize            string `json:",omitempty"` | 
|  | 536 | BoardPartitionReservedSize  string `json:",omitempty"` | 
|  | 537 | BoardPartitionSize          string `json:",omitempty"` | 
|  | 538 | BoardSquashfsBlockSize      string `json:",omitempty"` | 
|  | 539 | BoardSquashfsCompressor     string `json:",omitempty"` | 
|  | 540 | BoardSquashfsCompressorOpt  string `json:",omitempty"` | 
|  | 541 | BoardSquashfsDisable4kAlign string `json:",omitempty"` | 
|  | 542 | ProductBaseFsPath           string `json:",omitempty"` | 
|  | 543 | ProductHeadroom             string `json:",omitempty"` | 
|  | 544 | ProductVerityPartition      string `json:",omitempty"` | 
|  | 545 |  | 
|  | 546 | BoardAvbAddHashtreeFooterArgs string `json:",omitempty"` | 
|  | 547 | BoardAvbKeyPath               string `json:",omitempty"` | 
|  | 548 | BoardAvbAlgorithm             string `json:",omitempty"` | 
|  | 549 | BoardAvbRollbackIndex         string `json:",omitempty"` | 
|  | 550 | BoardAvbRollbackIndexLocation string `json:",omitempty"` | 
|  | 551 | } | 
|  | 552 |  | 
| Cole Faust | cb193ec | 2023-09-20 16:01:18 -0700 | [diff] [blame] | 553 | type PartitionVariables struct { | 
|  | 554 | ProductDirectory            string `json:",omitempty"` | 
| Cole Faust | 11edf55 | 2023-10-13 11:32:14 -0700 | [diff] [blame] | 555 | PartitionQualifiedVariables map[string]PartitionQualifiedVariablesType | 
|  | 556 | TargetUserimagesUseExt2     bool `json:",omitempty"` | 
|  | 557 | TargetUserimagesUseExt3     bool `json:",omitempty"` | 
|  | 558 | TargetUserimagesUseExt4     bool `json:",omitempty"` | 
| Cole Faust | cb193ec | 2023-09-20 16:01:18 -0700 | [diff] [blame] | 559 |  | 
|  | 560 | TargetUserimagesSparseExtDisabled      bool `json:",omitempty"` | 
|  | 561 | TargetUserimagesSparseErofsDisabled    bool `json:",omitempty"` | 
|  | 562 | TargetUserimagesSparseSquashfsDisabled bool `json:",omitempty"` | 
|  | 563 | TargetUserimagesSparseF2fsDisabled     bool `json:",omitempty"` | 
|  | 564 |  | 
| Yi-Yo Chiang | 939fe1a | 2023-11-24 14:58:50 +0800 | [diff] [blame] | 565 | BoardErofsCompressor           string `json:",omitempty"` | 
|  | 566 | BoardErofsCompressorHints      string `json:",omitempty"` | 
|  | 567 | BoardErofsPclusterSize         string `json:",omitempty"` | 
|  | 568 | BoardErofsShareDupBlocks       string `json:",omitempty"` | 
|  | 569 | BoardErofsUseLegacyCompression string `json:",omitempty"` | 
|  | 570 | BoardExt4ShareDupBlocks        string `json:",omitempty"` | 
|  | 571 | BoardFlashLogicalBlockSize     string `json:",omitempty"` | 
|  | 572 | BoardFlashEraseBlockSize       string `json:",omitempty"` | 
|  | 573 | BoardUsesRecoveryAsBoot        bool   `json:",omitempty"` | 
|  | 574 | ProductUseDynamicPartitionSize bool   `json:",omitempty"` | 
|  | 575 | CopyImagesForTargetFilesZip    bool   `json:",omitempty"` | 
| Cole Faust | b505539 | 2023-09-27 13:44:40 -0700 | [diff] [blame] | 576 |  | 
|  | 577 | BoardAvbEnable bool `json:",omitempty"` | 
| Cole Faust | 11edf55 | 2023-10-13 11:32:14 -0700 | [diff] [blame] | 578 |  | 
|  | 579 | ProductPackages []string `json:",omitempty"` | 
| Colin Cross | a6bc19e | 2015-09-16 13:53:42 -0700 | [diff] [blame] | 580 | } | 
|  | 581 |  | 
|  | 582 | func boolPtr(v bool) *bool { | 
|  | 583 | return &v | 
| Colin Cross | 485e572 | 2015-08-27 13:28:01 -0700 | [diff] [blame] | 584 | } | 
|  | 585 |  | 
| Dan Willemsen | 47cf66b | 2015-09-16 16:48:54 -0700 | [diff] [blame] | 586 | func intPtr(v int) *int { | 
|  | 587 | return &v | 
|  | 588 | } | 
|  | 589 |  | 
| Colin Cross | 4225f65 | 2015-09-17 14:33:42 -0700 | [diff] [blame] | 590 | func stringPtr(v string) *string { | 
|  | 591 | return &v | 
|  | 592 | } | 
|  | 593 |  | 
| Cole Faust | f8231dd | 2023-04-21 17:37:11 -0700 | [diff] [blame] | 594 | func (v *ProductVariables) SetDefaultConfig() { | 
|  | 595 | *v = ProductVariables{ | 
| Colin Cross | 2a2e0db | 2020-02-21 16:55:46 -0800 | [diff] [blame] | 596 | BuildNumberFile: stringPtr("build_number.txt"), | 
| Dan Willemsen | b6d171b | 2019-04-07 09:41:44 -0700 | [diff] [blame] | 597 |  | 
| Dan Albert | 8c7a994 | 2023-03-27 20:34:01 +0000 | [diff] [blame] | 598 | Platform_version_name:                  stringPtr("S"), | 
|  | 599 | Platform_base_sdk_extension_version:    intPtr(30), | 
|  | 600 | Platform_sdk_version:                   intPtr(30), | 
|  | 601 | Platform_sdk_codename:                  stringPtr("S"), | 
|  | 602 | Platform_sdk_final:                     boolPtr(false), | 
|  | 603 | Platform_version_active_codenames:      []string{"S"}, | 
|  | 604 | Platform_version_all_preview_codenames: []string{"S"}, | 
| Dan Willemsen | cbf9e82 | 2017-11-13 14:34:56 -0800 | [diff] [blame] | 605 |  | 
| Vilas Bhat | b3d2d22 | 2023-12-04 22:51:20 +0000 | [diff] [blame] | 606 | HostArch:                    stringPtr("x86_64"), | 
|  | 607 | HostSecondaryArch:           stringPtr("x86"), | 
|  | 608 | DeviceName:                  stringPtr("generic_arm64"), | 
|  | 609 | DeviceProduct:               stringPtr("aosp_arm-eng"), | 
|  | 610 | DeviceArch:                  stringPtr("arm64"), | 
|  | 611 | DeviceArchVariant:           stringPtr("armv8-a"), | 
|  | 612 | DeviceCpuVariant:            stringPtr("generic"), | 
|  | 613 | DeviceAbi:                   []string{"arm64-v8a"}, | 
|  | 614 | DeviceSecondaryArch:         stringPtr("arm"), | 
|  | 615 | DeviceSecondaryArchVariant:  stringPtr("armv8-a"), | 
|  | 616 | DeviceSecondaryCpuVariant:   stringPtr("generic"), | 
|  | 617 | DeviceSecondaryAbi:          []string{"armeabi-v7a", "armeabi"}, | 
|  | 618 | DeviceMaxPageSizeSupported:  stringPtr("4096"), | 
|  | 619 | DeviceNoBionicPageSizeMacro: boolPtr(false), | 
| Colin Cross | face4e4 | 2017-10-30 17:32:15 -0700 | [diff] [blame] | 620 |  | 
| Colin Cross | a74ca04 | 2019-01-31 14:31:51 -0800 | [diff] [blame] | 621 | AAPTConfig:          []string{"normal", "large", "xlarge", "hdpi", "xhdpi", "xxhdpi"}, | 
| Colin Cross | face4e4 | 2017-10-30 17:32:15 -0700 | [diff] [blame] | 622 | AAPTPreferredConfig: stringPtr("xhdpi"), | 
|  | 623 | AAPTCharacteristics: stringPtr("nosdcard"), | 
| Colin Cross | a74ca04 | 2019-01-31 14:31:51 -0800 | [diff] [blame] | 624 | AAPTPrebuiltDPI:     []string{"xhdpi", "xxhdpi"}, | 
| Colin Cross | face4e4 | 2017-10-30 17:32:15 -0700 | [diff] [blame] | 625 |  | 
| Christopher Ferris | a5a6b9c | 2024-04-23 17:17:49 -0700 | [diff] [blame] | 626 | Malloc_low_memory:            boolPtr(false), | 
| Steven Moreland | d134201 | 2020-07-30 20:38:49 +0000 | [diff] [blame] | 627 | Malloc_zero_contents:         boolPtr(true), | 
| Evgenii Stepanov | 19ff3c9 | 2020-04-29 14:57:30 -0700 | [diff] [blame] | 628 | Malloc_pattern_fill_contents: boolPtr(false), | 
|  | 629 | Safestack:                    boolPtr(false), | 
| Dennis Shen | e2ed70c | 2023-01-11 14:15:43 +0000 | [diff] [blame] | 630 | TrimmedApex:                  boolPtr(false), | 
| Jihoon Kang | cbcad7c | 2023-06-01 22:31:52 +0000 | [diff] [blame] | 631 | Build_from_text_stub:         boolPtr(false), | 
| Lukacs T. Berki | 720b396 | 2021-03-17 13:34:30 +0100 | [diff] [blame] | 632 |  | 
| satayev | d604b21 | 2021-07-21 14:23:52 +0100 | [diff] [blame] | 633 | BootJars:     ConfiguredJarList{apexes: []string{}, jars: []string{}}, | 
|  | 634 | ApexBootJars: ConfiguredJarList{apexes: []string{}, jars: []string{}}, | 
| Colin Cross | 485e572 | 2015-08-27 13:28:01 -0700 | [diff] [blame] | 635 | } | 
| Dan Willemsen | 490fd49 | 2015-11-24 17:53:15 -0800 | [diff] [blame] | 636 |  | 
|  | 637 | if runtime.GOOS == "linux" { | 
|  | 638 | v.CrossHost = stringPtr("windows") | 
|  | 639 | v.CrossHostArch = stringPtr("x86") | 
| Dan Willemsen | 07cd051 | 2016-02-03 23:16:33 -0800 | [diff] [blame] | 640 | v.CrossHostSecondaryArch = stringPtr("x86_64") | 
| Dan Willemsen | 490fd49 | 2015-11-24 17:53:15 -0800 | [diff] [blame] | 641 | } | 
| Colin Cross | 7f64b6d | 2015-07-09 13:57:48 -0700 | [diff] [blame] | 642 | } | 
|  | 643 |  | 
| Joe Onorato | 3fefc23 | 2023-12-04 17:35:15 +0000 | [diff] [blame] | 644 | func (this *ProductVariables) GetBuildFlagBool(flag string) bool { | 
|  | 645 | val, ok := this.BuildFlags[flag] | 
|  | 646 | if !ok { | 
|  | 647 | return false | 
|  | 648 | } | 
|  | 649 | return val == "true" | 
|  | 650 | } | 
|  | 651 |  | 
| Colin Cross | eabaedd | 2020-02-06 17:01:55 -0800 | [diff] [blame] | 652 | func VariableMutator(mctx BottomUpMutatorContext) { | 
| Colin Cross | 635c3b0 | 2016-05-18 15:37:25 -0700 | [diff] [blame] | 653 | var module Module | 
| Colin Cross | 7f64b6d | 2015-07-09 13:57:48 -0700 | [diff] [blame] | 654 | var ok bool | 
| Colin Cross | 635c3b0 | 2016-05-18 15:37:25 -0700 | [diff] [blame] | 655 | if module, ok = mctx.Module().(Module); !ok { | 
| Colin Cross | 7f64b6d | 2015-07-09 13:57:48 -0700 | [diff] [blame] | 656 | return | 
|  | 657 | } | 
|  | 658 |  | 
|  | 659 | // TODO: depend on config variable, create variants, propagate variants up tree | 
|  | 660 | a := module.base() | 
| Colin Cross | 18c4680 | 2019-09-24 22:19:02 -0700 | [diff] [blame] | 661 |  | 
|  | 662 | if a.variableProperties == nil { | 
|  | 663 | return | 
|  | 664 | } | 
|  | 665 |  | 
|  | 666 | variableValues := reflect.ValueOf(a.variableProperties).Elem().FieldByName("Product_variables") | 
| Colin Cross | 7f64b6d | 2015-07-09 13:57:48 -0700 | [diff] [blame] | 667 |  | 
| Colin Cross | 0cec312 | 2021-01-20 11:27:32 -0800 | [diff] [blame] | 668 | productVariables := reflect.ValueOf(mctx.Config().productVariables) | 
|  | 669 |  | 
| Colin Cross | 7f64b6d | 2015-07-09 13:57:48 -0700 | [diff] [blame] | 670 | for i := 0; i < variableValues.NumField(); i++ { | 
|  | 671 | variableValue := variableValues.Field(i) | 
| Colin Cross | 485e572 | 2015-08-27 13:28:01 -0700 | [diff] [blame] | 672 | name := variableValues.Type().Field(i).Name | 
|  | 673 | property := "product_variables." + proptools.PropertyNameForField(name) | 
| Colin Cross | 7f64b6d | 2015-07-09 13:57:48 -0700 | [diff] [blame] | 674 |  | 
| Colin Cross | a6bc19e | 2015-09-16 13:53:42 -0700 | [diff] [blame] | 675 | // Check that the variable was set for the product | 
| Colin Cross | 0cec312 | 2021-01-20 11:27:32 -0800 | [diff] [blame] | 676 | val := productVariables.FieldByName(name) | 
| Colin Cross | a6bc19e | 2015-09-16 13:53:42 -0700 | [diff] [blame] | 677 | if !val.IsValid() || val.Kind() != reflect.Ptr || val.IsNil() { | 
|  | 678 | continue | 
| Colin Cross | 7f64b6d | 2015-07-09 13:57:48 -0700 | [diff] [blame] | 679 | } | 
| Colin Cross | a6bc19e | 2015-09-16 13:53:42 -0700 | [diff] [blame] | 680 |  | 
|  | 681 | val = val.Elem() | 
|  | 682 |  | 
|  | 683 | // For bools, check that the value is true | 
|  | 684 | if val.Kind() == reflect.Bool && val.Bool() == false { | 
|  | 685 | continue | 
|  | 686 | } | 
|  | 687 |  | 
|  | 688 | // Check if any properties were set for the module | 
| Colin Cross | 6961a49 | 2020-02-06 16:57:45 -0800 | [diff] [blame] | 689 | if variableValue.IsZero() { | 
| Colin Cross | a6bc19e | 2015-09-16 13:53:42 -0700 | [diff] [blame] | 690 | continue | 
|  | 691 | } | 
| Colin Cross | a6bc19e | 2015-09-16 13:53:42 -0700 | [diff] [blame] | 692 | a.setVariableProperties(mctx, property, variableValue, val.Interface()) | 
| Colin Cross | 7f64b6d | 2015-07-09 13:57:48 -0700 | [diff] [blame] | 693 | } | 
|  | 694 | } | 
|  | 695 |  | 
| Colin Cross | 4157e88 | 2019-06-06 16:57:04 -0700 | [diff] [blame] | 696 | func (m *ModuleBase) setVariableProperties(ctx BottomUpMutatorContext, | 
| Colin Cross | 7f64b6d | 2015-07-09 13:57:48 -0700 | [diff] [blame] | 697 | prefix string, productVariablePropertyValue reflect.Value, variableValue interface{}) { | 
|  | 698 |  | 
| Colin Cross | 7e0eaf1 | 2017-05-05 16:16:24 -0700 | [diff] [blame] | 699 | printfIntoProperties(ctx, prefix, productVariablePropertyValue, variableValue) | 
| Colin Cross | 7f64b6d | 2015-07-09 13:57:48 -0700 | [diff] [blame] | 700 |  | 
| Usta | 851a327 | 2022-01-05 23:42:33 -0500 | [diff] [blame] | 701 | err := proptools.AppendMatchingProperties(m.GetProperties(), | 
| Colin Cross | 06a931b | 2015-10-28 17:23:31 -0700 | [diff] [blame] | 702 | productVariablePropertyValue.Addr().Interface(), nil) | 
|  | 703 | if err != nil { | 
|  | 704 | if propertyErr, ok := err.(*proptools.ExtendPropertyError); ok { | 
|  | 705 | ctx.PropertyErrorf(propertyErr.Property, "%s", propertyErr.Err.Error()) | 
|  | 706 | } else { | 
|  | 707 | panic(err) | 
|  | 708 | } | 
|  | 709 | } | 
| Colin Cross | 7f64b6d | 2015-07-09 13:57:48 -0700 | [diff] [blame] | 710 | } | 
|  | 711 |  | 
| Colin Cross | 7e0eaf1 | 2017-05-05 16:16:24 -0700 | [diff] [blame] | 712 | func printfIntoPropertiesError(ctx BottomUpMutatorContext, prefix string, | 
|  | 713 | productVariablePropertyValue reflect.Value, i int, err error) { | 
|  | 714 |  | 
|  | 715 | field := productVariablePropertyValue.Type().Field(i).Name | 
|  | 716 | property := prefix + "." + proptools.PropertyNameForField(field) | 
|  | 717 | ctx.PropertyErrorf(property, "%s", err) | 
|  | 718 | } | 
|  | 719 |  | 
|  | 720 | func printfIntoProperties(ctx BottomUpMutatorContext, prefix string, | 
|  | 721 | productVariablePropertyValue reflect.Value, variableValue interface{}) { | 
|  | 722 |  | 
| Colin Cross | 7f64b6d | 2015-07-09 13:57:48 -0700 | [diff] [blame] | 723 | for i := 0; i < productVariablePropertyValue.NumField(); i++ { | 
|  | 724 | propertyValue := productVariablePropertyValue.Field(i) | 
| Colin Cross | dd0dbe6 | 2015-12-02 15:24:38 -0800 | [diff] [blame] | 725 | kind := propertyValue.Kind() | 
|  | 726 | if kind == reflect.Ptr { | 
|  | 727 | if propertyValue.IsNil() { | 
|  | 728 | continue | 
|  | 729 | } | 
|  | 730 | propertyValue = propertyValue.Elem() | 
|  | 731 | } | 
| Colin Cross | 7f64b6d | 2015-07-09 13:57:48 -0700 | [diff] [blame] | 732 | switch propertyValue.Kind() { | 
|  | 733 | case reflect.String: | 
| Colin Cross | 7e0eaf1 | 2017-05-05 16:16:24 -0700 | [diff] [blame] | 734 | err := printfIntoProperty(propertyValue, variableValue) | 
|  | 735 | if err != nil { | 
|  | 736 | printfIntoPropertiesError(ctx, prefix, productVariablePropertyValue, i, err) | 
|  | 737 | } | 
| Colin Cross | 7f64b6d | 2015-07-09 13:57:48 -0700 | [diff] [blame] | 738 | case reflect.Slice: | 
|  | 739 | for j := 0; j < propertyValue.Len(); j++ { | 
| Colin Cross | 7e0eaf1 | 2017-05-05 16:16:24 -0700 | [diff] [blame] | 740 | err := printfIntoProperty(propertyValue.Index(j), variableValue) | 
|  | 741 | if err != nil { | 
|  | 742 | printfIntoPropertiesError(ctx, prefix, productVariablePropertyValue, i, err) | 
|  | 743 | } | 
| Colin Cross | 7f64b6d | 2015-07-09 13:57:48 -0700 | [diff] [blame] | 744 | } | 
| Colin Cross | dd0dbe6 | 2015-12-02 15:24:38 -0800 | [diff] [blame] | 745 | case reflect.Bool: | 
|  | 746 | // Nothing | 
| Colin Cross | 7f64b6d | 2015-07-09 13:57:48 -0700 | [diff] [blame] | 747 | case reflect.Struct: | 
| Colin Cross | 7e0eaf1 | 2017-05-05 16:16:24 -0700 | [diff] [blame] | 748 | printfIntoProperties(ctx, prefix, propertyValue, variableValue) | 
| Colin Cross | 7f64b6d | 2015-07-09 13:57:48 -0700 | [diff] [blame] | 749 | default: | 
|  | 750 | panic(fmt.Errorf("unsupported field kind %q", propertyValue.Kind())) | 
|  | 751 | } | 
|  | 752 | } | 
|  | 753 | } | 
|  | 754 |  | 
| Colin Cross | 7e0eaf1 | 2017-05-05 16:16:24 -0700 | [diff] [blame] | 755 | func printfIntoProperty(propertyValue reflect.Value, variableValue interface{}) error { | 
| Colin Cross | 7f64b6d | 2015-07-09 13:57:48 -0700 | [diff] [blame] | 756 | s := propertyValue.String() | 
| Colin Cross | 7e0eaf1 | 2017-05-05 16:16:24 -0700 | [diff] [blame] | 757 |  | 
|  | 758 | count := strings.Count(s, "%") | 
|  | 759 | if count == 0 { | 
|  | 760 | return nil | 
|  | 761 | } | 
|  | 762 |  | 
|  | 763 | if count > 1 { | 
|  | 764 | return fmt.Errorf("product variable properties only support a single '%%'") | 
|  | 765 | } | 
|  | 766 |  | 
| Colin Cross | 7f64b6d | 2015-07-09 13:57:48 -0700 | [diff] [blame] | 767 | if strings.Contains(s, "%d") { | 
|  | 768 | switch v := variableValue.(type) { | 
|  | 769 | case int: | 
| Colin Cross | 7e0eaf1 | 2017-05-05 16:16:24 -0700 | [diff] [blame] | 770 | // Nothing | 
| Colin Cross | 7f64b6d | 2015-07-09 13:57:48 -0700 | [diff] [blame] | 771 | case bool: | 
|  | 772 | if v { | 
| Colin Cross | 7e0eaf1 | 2017-05-05 16:16:24 -0700 | [diff] [blame] | 773 | variableValue = 1 | 
|  | 774 | } else { | 
|  | 775 | variableValue = 0 | 
| Colin Cross | 7f64b6d | 2015-07-09 13:57:48 -0700 | [diff] [blame] | 776 | } | 
|  | 777 | default: | 
| Colin Cross | 7e0eaf1 | 2017-05-05 16:16:24 -0700 | [diff] [blame] | 778 | return fmt.Errorf("unsupported type %T for %%d", variableValue) | 
| Colin Cross | 7f64b6d | 2015-07-09 13:57:48 -0700 | [diff] [blame] | 779 | } | 
| Colin Cross | 7e0eaf1 | 2017-05-05 16:16:24 -0700 | [diff] [blame] | 780 | } else if strings.Contains(s, "%s") { | 
|  | 781 | switch variableValue.(type) { | 
|  | 782 | case string: | 
|  | 783 | // Nothing | 
|  | 784 | default: | 
|  | 785 | return fmt.Errorf("unsupported type %T for %%s", variableValue) | 
|  | 786 | } | 
|  | 787 | } else { | 
|  | 788 | return fmt.Errorf("unsupported %% in product variable property") | 
| Colin Cross | 7f64b6d | 2015-07-09 13:57:48 -0700 | [diff] [blame] | 789 | } | 
| Colin Cross | 7e0eaf1 | 2017-05-05 16:16:24 -0700 | [diff] [blame] | 790 |  | 
|  | 791 | propertyValue.Set(reflect.ValueOf(fmt.Sprintf(s, variableValue))) | 
|  | 792 |  | 
|  | 793 | return nil | 
| Colin Cross | 7f64b6d | 2015-07-09 13:57:48 -0700 | [diff] [blame] | 794 | } | 
| Colin Cross | 18c4680 | 2019-09-24 22:19:02 -0700 | [diff] [blame] | 795 |  | 
|  | 796 | var variablePropTypeMap OncePer | 
|  | 797 |  | 
|  | 798 | // sliceToTypeArray takes a slice of property structs and returns a reflection created array containing the | 
|  | 799 | // reflect.Types of each property struct.  The result can be used as a key in a map. | 
|  | 800 | func sliceToTypeArray(s []interface{}) interface{} { | 
|  | 801 | // Create an array using reflection whose length is the length of the input slice | 
|  | 802 | ret := reflect.New(reflect.ArrayOf(len(s), reflect.TypeOf(reflect.TypeOf(0)))).Elem() | 
|  | 803 | for i, e := range s { | 
|  | 804 | ret.Index(i).Set(reflect.ValueOf(reflect.TypeOf(e))) | 
|  | 805 | } | 
|  | 806 | return ret.Interface() | 
|  | 807 | } | 
|  | 808 |  | 
| Colin Cross | eabaedd | 2020-02-06 17:01:55 -0800 | [diff] [blame] | 809 | func initProductVariableModule(m Module) { | 
|  | 810 | base := m.base() | 
|  | 811 |  | 
|  | 812 | // Allow tests to override the default product variables | 
|  | 813 | if base.variableProperties == nil { | 
|  | 814 | base.variableProperties = defaultProductVariables | 
|  | 815 | } | 
|  | 816 | // Filter the product variables properties to the ones that exist on this module | 
|  | 817 | base.variableProperties = createVariableProperties(m.GetProperties(), base.variableProperties) | 
|  | 818 | if base.variableProperties != nil { | 
|  | 819 | m.AddProperties(base.variableProperties) | 
|  | 820 | } | 
|  | 821 | } | 
|  | 822 |  | 
| Colin Cross | 18c4680 | 2019-09-24 22:19:02 -0700 | [diff] [blame] | 823 | // createVariableProperties takes the list of property structs for a module and returns a property struct that | 
|  | 824 | // contains the product variable properties that exist in the property structs, or nil if there are none.  It | 
|  | 825 | // caches the result. | 
|  | 826 | func createVariableProperties(moduleTypeProps []interface{}, productVariables interface{}) interface{} { | 
|  | 827 | // Convert the moduleTypeProps to an array of reflect.Types that can be used as a key in the OncePer. | 
|  | 828 | key := sliceToTypeArray(moduleTypeProps) | 
|  | 829 |  | 
|  | 830 | // Use the variablePropTypeMap OncePer to cache the result for each set of property struct types. | 
|  | 831 | typ, _ := variablePropTypeMap.Once(NewCustomOnceKey(key), func() interface{} { | 
|  | 832 | // Compute the filtered property struct type. | 
|  | 833 | return createVariablePropertiesType(moduleTypeProps, productVariables) | 
|  | 834 | }).(reflect.Type) | 
|  | 835 |  | 
|  | 836 | if typ == nil { | 
|  | 837 | return nil | 
|  | 838 | } | 
|  | 839 |  | 
|  | 840 | // Create a new pointer to a filtered property struct. | 
|  | 841 | return reflect.New(typ).Interface() | 
|  | 842 | } | 
|  | 843 |  | 
|  | 844 | // createVariablePropertiesType creates a new type that contains only the product variable properties that exist in | 
|  | 845 | // a list of property structs. | 
|  | 846 | func createVariablePropertiesType(moduleTypeProps []interface{}, productVariables interface{}) reflect.Type { | 
|  | 847 | typ, _ := proptools.FilterPropertyStruct(reflect.TypeOf(productVariables), | 
|  | 848 | func(field reflect.StructField, prefix string) (bool, reflect.StructField) { | 
|  | 849 | // Filter function, returns true if the field should be in the resulting struct | 
|  | 850 | if prefix == "" { | 
|  | 851 | // Keep the top level Product_variables field | 
|  | 852 | return true, field | 
|  | 853 | } | 
|  | 854 | _, rest := splitPrefix(prefix) | 
|  | 855 | if rest == "" { | 
|  | 856 | // Keep the 2nd level field (i.e. Product_variables.Eng) | 
|  | 857 | return true, field | 
|  | 858 | } | 
|  | 859 |  | 
|  | 860 | // Strip off the first 2 levels of the prefix | 
|  | 861 | _, prefix = splitPrefix(rest) | 
|  | 862 |  | 
|  | 863 | for _, p := range moduleTypeProps { | 
|  | 864 | if fieldExistsByNameRecursive(reflect.TypeOf(p).Elem(), prefix, field.Name) { | 
|  | 865 | // Keep any fields that exist in one of the property structs | 
|  | 866 | return true, field | 
|  | 867 | } | 
|  | 868 | } | 
|  | 869 |  | 
|  | 870 | return false, field | 
|  | 871 | }) | 
|  | 872 | return typ | 
|  | 873 | } | 
|  | 874 |  | 
|  | 875 | func splitPrefix(prefix string) (first, rest string) { | 
|  | 876 | index := strings.IndexByte(prefix, '.') | 
|  | 877 | if index == -1 { | 
|  | 878 | return prefix, "" | 
|  | 879 | } | 
|  | 880 | return prefix[:index], prefix[index+1:] | 
|  | 881 | } | 
|  | 882 |  | 
|  | 883 | func fieldExistsByNameRecursive(t reflect.Type, prefix, name string) bool { | 
|  | 884 | if t.Kind() != reflect.Struct { | 
|  | 885 | panic(fmt.Errorf("fieldExistsByNameRecursive can only be called on a reflect.Struct")) | 
|  | 886 | } | 
|  | 887 |  | 
|  | 888 | if prefix != "" { | 
|  | 889 | split := strings.SplitN(prefix, ".", 2) | 
|  | 890 | firstPrefix := split[0] | 
|  | 891 | rest := "" | 
|  | 892 | if len(split) > 1 { | 
|  | 893 | rest = split[1] | 
|  | 894 | } | 
|  | 895 | f, exists := t.FieldByName(firstPrefix) | 
|  | 896 | if !exists { | 
|  | 897 | return false | 
|  | 898 | } | 
|  | 899 | ft := f.Type | 
|  | 900 | if ft.Kind() == reflect.Ptr { | 
|  | 901 | ft = ft.Elem() | 
|  | 902 | } | 
|  | 903 | if ft.Kind() != reflect.Struct { | 
|  | 904 | panic(fmt.Errorf("field %q in %q is not a struct", firstPrefix, t)) | 
|  | 905 | } | 
|  | 906 | return fieldExistsByNameRecursive(ft, rest, name) | 
|  | 907 | } else { | 
|  | 908 | _, exists := t.FieldByName(name) | 
|  | 909 | return exists | 
|  | 910 | } | 
|  | 911 | } |