xref: /aosp_15_r20/build/soong/android/variable.go (revision 333d2b3687b3a337dbcca9d65000bca186795e39)
1*333d2b36SAndroid Build Coastguard Worker// Copyright 2015 Google Inc. All rights reserved.
2*333d2b36SAndroid Build Coastguard Worker//
3*333d2b36SAndroid Build Coastguard Worker// Licensed under the Apache License, Version 2.0 (the "License");
4*333d2b36SAndroid Build Coastguard Worker// you may not use this file except in compliance with the License.
5*333d2b36SAndroid Build Coastguard Worker// You may obtain a copy of the License at
6*333d2b36SAndroid Build Coastguard Worker//
7*333d2b36SAndroid Build Coastguard Worker//     http://www.apache.org/licenses/LICENSE-2.0
8*333d2b36SAndroid Build Coastguard Worker//
9*333d2b36SAndroid Build Coastguard Worker// Unless required by applicable law or agreed to in writing, software
10*333d2b36SAndroid Build Coastguard Worker// distributed under the License is distributed on an "AS IS" BASIS,
11*333d2b36SAndroid Build Coastguard Worker// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12*333d2b36SAndroid Build Coastguard Worker// See the License for the specific language governing permissions and
13*333d2b36SAndroid Build Coastguard Worker// limitations under the License.
14*333d2b36SAndroid Build Coastguard Worker
15*333d2b36SAndroid Build Coastguard Workerpackage android
16*333d2b36SAndroid Build Coastguard Worker
17*333d2b36SAndroid Build Coastguard Workerimport (
18*333d2b36SAndroid Build Coastguard Worker	"fmt"
19*333d2b36SAndroid Build Coastguard Worker	"reflect"
20*333d2b36SAndroid Build Coastguard Worker	"runtime"
21*333d2b36SAndroid Build Coastguard Worker	"strings"
22*333d2b36SAndroid Build Coastguard Worker
23*333d2b36SAndroid Build Coastguard Worker	"github.com/google/blueprint/proptools"
24*333d2b36SAndroid Build Coastguard Worker)
25*333d2b36SAndroid Build Coastguard Worker
26*333d2b36SAndroid Build Coastguard Workerfunc init() {
27*333d2b36SAndroid Build Coastguard Worker	registerVariableBuildComponents(InitRegistrationContext)
28*333d2b36SAndroid Build Coastguard Worker}
29*333d2b36SAndroid Build Coastguard Worker
30*333d2b36SAndroid Build Coastguard Workerfunc registerVariableBuildComponents(ctx RegistrationContext) {
31*333d2b36SAndroid Build Coastguard Worker	ctx.PreDepsMutators(func(ctx RegisterMutatorsContext) {
32*333d2b36SAndroid Build Coastguard Worker		ctx.BottomUp("variable", VariableMutator)
33*333d2b36SAndroid Build Coastguard Worker	})
34*333d2b36SAndroid Build Coastguard Worker}
35*333d2b36SAndroid Build Coastguard Worker
36*333d2b36SAndroid Build Coastguard Workervar PrepareForTestWithVariables = FixtureRegisterWithContext(registerVariableBuildComponents)
37*333d2b36SAndroid Build Coastguard Worker
38*333d2b36SAndroid Build Coastguard Workertype variableProperties struct {
39*333d2b36SAndroid Build Coastguard Worker	Product_variables struct {
40*333d2b36SAndroid Build Coastguard Worker		Platform_sdk_version struct {
41*333d2b36SAndroid Build Coastguard Worker			Asflags []string
42*333d2b36SAndroid Build Coastguard Worker			Cflags  []string
43*333d2b36SAndroid Build Coastguard Worker			Cmd     *string
44*333d2b36SAndroid Build Coastguard Worker		}
45*333d2b36SAndroid Build Coastguard Worker
46*333d2b36SAndroid Build Coastguard Worker		Platform_sdk_version_or_codename struct {
47*333d2b36SAndroid Build Coastguard Worker			Java_resource_dirs []string
48*333d2b36SAndroid Build Coastguard Worker		}
49*333d2b36SAndroid Build Coastguard Worker
50*333d2b36SAndroid Build Coastguard Worker		Platform_sdk_extension_version struct {
51*333d2b36SAndroid Build Coastguard Worker			Cmd *string
52*333d2b36SAndroid Build Coastguard Worker		}
53*333d2b36SAndroid Build Coastguard Worker
54*333d2b36SAndroid Build Coastguard Worker		Platform_version_name struct {
55*333d2b36SAndroid Build Coastguard Worker			Base_dir *string
56*333d2b36SAndroid Build Coastguard Worker		}
57*333d2b36SAndroid Build Coastguard Worker
58*333d2b36SAndroid Build Coastguard Worker		Shipping_api_level struct {
59*333d2b36SAndroid Build Coastguard Worker			Cflags []string
60*333d2b36SAndroid Build Coastguard Worker		}
61*333d2b36SAndroid Build Coastguard Worker
62*333d2b36SAndroid Build Coastguard Worker		// unbundled_build is a catch-all property to annotate modules that don't build in one or
63*333d2b36SAndroid Build Coastguard Worker		// more unbundled branches, usually due to dependencies missing from the manifest.
64*333d2b36SAndroid Build Coastguard Worker		Unbundled_build struct {
65*333d2b36SAndroid Build Coastguard Worker			Enabled proptools.Configurable[bool] `android:"arch_variant,replace_instead_of_append"`
66*333d2b36SAndroid Build Coastguard Worker		} `android:"arch_variant"`
67*333d2b36SAndroid Build Coastguard Worker
68*333d2b36SAndroid Build Coastguard Worker		// similar to `Unbundled_build`, but `Always_use_prebuilt_sdks` means that it uses prebuilt
69*333d2b36SAndroid Build Coastguard Worker		// sdk specifically.
70*333d2b36SAndroid Build Coastguard Worker		Always_use_prebuilt_sdks struct {
71*333d2b36SAndroid Build Coastguard Worker			Enabled proptools.Configurable[bool] `android:"arch_variant,replace_instead_of_append"`
72*333d2b36SAndroid Build Coastguard Worker		} `android:"arch_variant"`
73*333d2b36SAndroid Build Coastguard Worker
74*333d2b36SAndroid Build Coastguard Worker		Malloc_low_memory struct {
75*333d2b36SAndroid Build Coastguard Worker			Cflags              []string `android:"arch_variant"`
76*333d2b36SAndroid Build Coastguard Worker			Shared_libs         []string `android:"arch_variant"`
77*333d2b36SAndroid Build Coastguard Worker			Whole_static_libs   []string `android:"arch_variant"`
78*333d2b36SAndroid Build Coastguard Worker			Static_libs         []string `android:"arch_variant"`
79*333d2b36SAndroid Build Coastguard Worker			Exclude_static_libs []string `android:"arch_variant"`
80*333d2b36SAndroid Build Coastguard Worker			Srcs                []string `android:"arch_variant"`
81*333d2b36SAndroid Build Coastguard Worker			Header_libs         []string `android:"arch_variant"`
82*333d2b36SAndroid Build Coastguard Worker		} `android:"arch_variant"`
83*333d2b36SAndroid Build Coastguard Worker
84*333d2b36SAndroid Build Coastguard Worker		Malloc_zero_contents struct {
85*333d2b36SAndroid Build Coastguard Worker			Cflags []string `android:"arch_variant"`
86*333d2b36SAndroid Build Coastguard Worker		} `android:"arch_variant"`
87*333d2b36SAndroid Build Coastguard Worker
88*333d2b36SAndroid Build Coastguard Worker		Malloc_pattern_fill_contents struct {
89*333d2b36SAndroid Build Coastguard Worker			Cflags []string `android:"arch_variant"`
90*333d2b36SAndroid Build Coastguard Worker		} `android:"arch_variant"`
91*333d2b36SAndroid Build Coastguard Worker
92*333d2b36SAndroid Build Coastguard Worker		Safestack struct {
93*333d2b36SAndroid Build Coastguard Worker			Cflags []string `android:"arch_variant"`
94*333d2b36SAndroid Build Coastguard Worker		} `android:"arch_variant"`
95*333d2b36SAndroid Build Coastguard Worker
96*333d2b36SAndroid Build Coastguard Worker		Binder32bit struct {
97*333d2b36SAndroid Build Coastguard Worker			Cflags []string
98*333d2b36SAndroid Build Coastguard Worker		}
99*333d2b36SAndroid Build Coastguard Worker
100*333d2b36SAndroid Build Coastguard Worker		Override_rs_driver struct {
101*333d2b36SAndroid Build Coastguard Worker			Cflags []string
102*333d2b36SAndroid Build Coastguard Worker		}
103*333d2b36SAndroid Build Coastguard Worker
104*333d2b36SAndroid Build Coastguard Worker		// treble_linker_namespaces is true when the system/vendor linker namespace separation is
105*333d2b36SAndroid Build Coastguard Worker		// enabled.
106*333d2b36SAndroid Build Coastguard Worker		Treble_linker_namespaces struct {
107*333d2b36SAndroid Build Coastguard Worker			Cflags []string
108*333d2b36SAndroid Build Coastguard Worker		}
109*333d2b36SAndroid Build Coastguard Worker		// enforce_vintf_manifest is true when a device is required to have a vintf manifest.
110*333d2b36SAndroid Build Coastguard Worker		Enforce_vintf_manifest struct {
111*333d2b36SAndroid Build Coastguard Worker			Cflags []string
112*333d2b36SAndroid Build Coastguard Worker		}
113*333d2b36SAndroid Build Coastguard Worker
114*333d2b36SAndroid Build Coastguard Worker		Build_from_text_stub struct {
115*333d2b36SAndroid Build Coastguard Worker			Static_libs         []string
116*333d2b36SAndroid Build Coastguard Worker			Exclude_static_libs []string
117*333d2b36SAndroid Build Coastguard Worker		}
118*333d2b36SAndroid Build Coastguard Worker
119*333d2b36SAndroid Build Coastguard Worker		// debuggable is true for eng and userdebug builds, and can be used to turn on additional
120*333d2b36SAndroid Build Coastguard Worker		// debugging features that don't significantly impact runtime behavior.  userdebug builds
121*333d2b36SAndroid Build Coastguard Worker		// are used for dogfooding and performance testing, and should be as similar to user builds
122*333d2b36SAndroid Build Coastguard Worker		// as possible.
123*333d2b36SAndroid Build Coastguard Worker		Debuggable struct {
124*333d2b36SAndroid Build Coastguard Worker			Apk             *string
125*333d2b36SAndroid Build Coastguard Worker			Cflags          []string
126*333d2b36SAndroid Build Coastguard Worker			Cppflags        []string
127*333d2b36SAndroid Build Coastguard Worker			Init_rc         []string
128*333d2b36SAndroid Build Coastguard Worker			Required        []string
129*333d2b36SAndroid Build Coastguard Worker			Host_required   []string
130*333d2b36SAndroid Build Coastguard Worker			Target_required []string
131*333d2b36SAndroid Build Coastguard Worker			Strip           struct {
132*333d2b36SAndroid Build Coastguard Worker				All                          *bool
133*333d2b36SAndroid Build Coastguard Worker				Keep_symbols                 *bool
134*333d2b36SAndroid Build Coastguard Worker				Keep_symbols_and_debug_frame *bool
135*333d2b36SAndroid Build Coastguard Worker			}
136*333d2b36SAndroid Build Coastguard Worker			Static_libs         []string
137*333d2b36SAndroid Build Coastguard Worker			Exclude_static_libs []string
138*333d2b36SAndroid Build Coastguard Worker			Whole_static_libs   []string
139*333d2b36SAndroid Build Coastguard Worker			Shared_libs         []string
140*333d2b36SAndroid Build Coastguard Worker			Jni_libs            []string
141*333d2b36SAndroid Build Coastguard Worker
142*333d2b36SAndroid Build Coastguard Worker			Cmdline []string
143*333d2b36SAndroid Build Coastguard Worker
144*333d2b36SAndroid Build Coastguard Worker			Srcs         []string
145*333d2b36SAndroid Build Coastguard Worker			Exclude_srcs []string
146*333d2b36SAndroid Build Coastguard Worker			Cmd          *string
147*333d2b36SAndroid Build Coastguard Worker
148*333d2b36SAndroid Build Coastguard Worker			Deps []string
149*333d2b36SAndroid Build Coastguard Worker		}
150*333d2b36SAndroid Build Coastguard Worker
151*333d2b36SAndroid Build Coastguard Worker		// eng is true for -eng builds, and can be used to turn on additional heavyweight debugging
152*333d2b36SAndroid Build Coastguard Worker		// features.
153*333d2b36SAndroid Build Coastguard Worker		Eng struct {
154*333d2b36SAndroid Build Coastguard Worker			Cflags   []string
155*333d2b36SAndroid Build Coastguard Worker			Cppflags []string
156*333d2b36SAndroid Build Coastguard Worker			Lto      struct {
157*333d2b36SAndroid Build Coastguard Worker				Never *bool
158*333d2b36SAndroid Build Coastguard Worker			}
159*333d2b36SAndroid Build Coastguard Worker			Sanitize struct {
160*333d2b36SAndroid Build Coastguard Worker				Address *bool
161*333d2b36SAndroid Build Coastguard Worker			}
162*333d2b36SAndroid Build Coastguard Worker			Optimize struct {
163*333d2b36SAndroid Build Coastguard Worker				Enabled *bool
164*333d2b36SAndroid Build Coastguard Worker			}
165*333d2b36SAndroid Build Coastguard Worker		}
166*333d2b36SAndroid Build Coastguard Worker
167*333d2b36SAndroid Build Coastguard Worker		Uml struct {
168*333d2b36SAndroid Build Coastguard Worker			Cppflags []string
169*333d2b36SAndroid Build Coastguard Worker		}
170*333d2b36SAndroid Build Coastguard Worker
171*333d2b36SAndroid Build Coastguard Worker		Arc struct {
172*333d2b36SAndroid Build Coastguard Worker			Cflags            []string `android:"arch_variant"`
173*333d2b36SAndroid Build Coastguard Worker			Exclude_srcs      []string `android:"arch_variant"`
174*333d2b36SAndroid Build Coastguard Worker			Header_libs       []string `android:"arch_variant"`
175*333d2b36SAndroid Build Coastguard Worker			Include_dirs      []string `android:"arch_variant"`
176*333d2b36SAndroid Build Coastguard Worker			Shared_libs       []string `android:"arch_variant"`
177*333d2b36SAndroid Build Coastguard Worker			Static_libs       []string `android:"arch_variant"`
178*333d2b36SAndroid Build Coastguard Worker			Srcs              []string `android:"arch_variant"`
179*333d2b36SAndroid Build Coastguard Worker			Whole_static_libs []string `android:"arch_variant"`
180*333d2b36SAndroid Build Coastguard Worker		} `android:"arch_variant"`
181*333d2b36SAndroid Build Coastguard Worker
182*333d2b36SAndroid Build Coastguard Worker		Native_coverage struct {
183*333d2b36SAndroid Build Coastguard Worker			Src          *string  `android:"arch_variant"`
184*333d2b36SAndroid Build Coastguard Worker			Srcs         []string `android:"arch_variant"`
185*333d2b36SAndroid Build Coastguard Worker			Exclude_srcs []string `android:"arch_variant"`
186*333d2b36SAndroid Build Coastguard Worker		} `android:"arch_variant"`
187*333d2b36SAndroid Build Coastguard Worker
188*333d2b36SAndroid Build Coastguard Worker		// release_aidl_use_unfrozen is "true" when a device can
189*333d2b36SAndroid Build Coastguard Worker		// use the unfrozen versions of AIDL interfaces.
190*333d2b36SAndroid Build Coastguard Worker		Release_aidl_use_unfrozen struct {
191*333d2b36SAndroid Build Coastguard Worker			Cflags                 []string
192*333d2b36SAndroid Build Coastguard Worker			Cmd                    *string
193*333d2b36SAndroid Build Coastguard Worker			Required               []string
194*333d2b36SAndroid Build Coastguard Worker			Vintf_fragment_modules []string
195*333d2b36SAndroid Build Coastguard Worker		}
196*333d2b36SAndroid Build Coastguard Worker		SelinuxIgnoreNeverallows struct {
197*333d2b36SAndroid Build Coastguard Worker			Required []string
198*333d2b36SAndroid Build Coastguard Worker		}
199*333d2b36SAndroid Build Coastguard Worker	} `android:"arch_variant"`
200*333d2b36SAndroid Build Coastguard Worker}
201*333d2b36SAndroid Build Coastguard Worker
202*333d2b36SAndroid Build Coastguard Workervar defaultProductVariables interface{} = variableProperties{}
203*333d2b36SAndroid Build Coastguard Worker
204*333d2b36SAndroid Build Coastguard Workertype ProductVariables struct {
205*333d2b36SAndroid Build Coastguard Worker	// Suffix to add to generated Makefiles
206*333d2b36SAndroid Build Coastguard Worker	Make_suffix *string `json:",omitempty"`
207*333d2b36SAndroid Build Coastguard Worker
208*333d2b36SAndroid Build Coastguard Worker	BuildId              *string `json:",omitempty"`
209*333d2b36SAndroid Build Coastguard Worker	BuildFingerprintFile *string `json:",omitempty"`
210*333d2b36SAndroid Build Coastguard Worker	BuildNumberFile      *string `json:",omitempty"`
211*333d2b36SAndroid Build Coastguard Worker	BuildHostnameFile    *string `json:",omitempty"`
212*333d2b36SAndroid Build Coastguard Worker	BuildThumbprintFile  *string `json:",omitempty"`
213*333d2b36SAndroid Build Coastguard Worker	DisplayBuildNumber   *bool   `json:",omitempty"`
214*333d2b36SAndroid Build Coastguard Worker
215*333d2b36SAndroid Build Coastguard Worker	Platform_display_version_name          *string  `json:",omitempty"`
216*333d2b36SAndroid Build Coastguard Worker	Platform_version_name                  *string  `json:",omitempty"`
217*333d2b36SAndroid Build Coastguard Worker	Platform_sdk_version                   *int     `json:",omitempty"`
218*333d2b36SAndroid Build Coastguard Worker	Platform_sdk_minor_version             *int     `json:",omitempty"`
219*333d2b36SAndroid Build Coastguard Worker	Platform_sdk_codename                  *string  `json:",omitempty"`
220*333d2b36SAndroid Build Coastguard Worker	Platform_sdk_version_or_codename       *string  `json:",omitempty"`
221*333d2b36SAndroid Build Coastguard Worker	Platform_sdk_final                     *bool    `json:",omitempty"`
222*333d2b36SAndroid Build Coastguard Worker	Platform_sdk_extension_version         *int     `json:",omitempty"`
223*333d2b36SAndroid Build Coastguard Worker	Platform_base_sdk_extension_version    *int     `json:",omitempty"`
224*333d2b36SAndroid Build Coastguard Worker	Platform_version_active_codenames      []string `json:",omitempty"`
225*333d2b36SAndroid Build Coastguard Worker	Platform_version_all_preview_codenames []string `json:",omitempty"`
226*333d2b36SAndroid Build Coastguard Worker	Platform_systemsdk_versions            []string `json:",omitempty"`
227*333d2b36SAndroid Build Coastguard Worker	Platform_security_patch                *string  `json:",omitempty"`
228*333d2b36SAndroid Build Coastguard Worker	Platform_preview_sdk_version           *string  `json:",omitempty"`
229*333d2b36SAndroid Build Coastguard Worker	Platform_base_os                       *string  `json:",omitempty"`
230*333d2b36SAndroid Build Coastguard Worker	Platform_version_last_stable           *string  `json:",omitempty"`
231*333d2b36SAndroid Build Coastguard Worker	Platform_version_known_codenames       *string  `json:",omitempty"`
232*333d2b36SAndroid Build Coastguard Worker
233*333d2b36SAndroid Build Coastguard Worker	DeviceName                            *string  `json:",omitempty"`
234*333d2b36SAndroid Build Coastguard Worker	DeviceProduct                         *string  `json:",omitempty"`
235*333d2b36SAndroid Build Coastguard Worker	DeviceArch                            *string  `json:",omitempty"`
236*333d2b36SAndroid Build Coastguard Worker	DeviceArchVariant                     *string  `json:",omitempty"`
237*333d2b36SAndroid Build Coastguard Worker	DeviceCpuVariant                      *string  `json:",omitempty"`
238*333d2b36SAndroid Build Coastguard Worker	DeviceAbi                             []string `json:",omitempty"`
239*333d2b36SAndroid Build Coastguard Worker	DeviceVndkVersion                     *string  `json:",omitempty"`
240*333d2b36SAndroid Build Coastguard Worker	DeviceCurrentApiLevelForVendorModules *string  `json:",omitempty"`
241*333d2b36SAndroid Build Coastguard Worker	DeviceSystemSdkVersions               []string `json:",omitempty"`
242*333d2b36SAndroid Build Coastguard Worker	DeviceMaxPageSizeSupported            *string  `json:",omitempty"`
243*333d2b36SAndroid Build Coastguard Worker	DeviceNoBionicPageSizeMacro           *bool    `json:",omitempty"`
244*333d2b36SAndroid Build Coastguard Worker
245*333d2b36SAndroid Build Coastguard Worker	VendorApiLevel             *string `json:",omitempty"`
246*333d2b36SAndroid Build Coastguard Worker	VendorApiLevelPropOverride *string `json:",omitempty"`
247*333d2b36SAndroid Build Coastguard Worker
248*333d2b36SAndroid Build Coastguard Worker	DeviceSecondaryArch        *string  `json:",omitempty"`
249*333d2b36SAndroid Build Coastguard Worker	DeviceSecondaryArchVariant *string  `json:",omitempty"`
250*333d2b36SAndroid Build Coastguard Worker	DeviceSecondaryCpuVariant  *string  `json:",omitempty"`
251*333d2b36SAndroid Build Coastguard Worker	DeviceSecondaryAbi         []string `json:",omitempty"`
252*333d2b36SAndroid Build Coastguard Worker
253*333d2b36SAndroid Build Coastguard Worker	NativeBridgeArch         *string  `json:",omitempty"`
254*333d2b36SAndroid Build Coastguard Worker	NativeBridgeArchVariant  *string  `json:",omitempty"`
255*333d2b36SAndroid Build Coastguard Worker	NativeBridgeCpuVariant   *string  `json:",omitempty"`
256*333d2b36SAndroid Build Coastguard Worker	NativeBridgeAbi          []string `json:",omitempty"`
257*333d2b36SAndroid Build Coastguard Worker	NativeBridgeRelativePath *string  `json:",omitempty"`
258*333d2b36SAndroid Build Coastguard Worker
259*333d2b36SAndroid Build Coastguard Worker	NativeBridgeSecondaryArch         *string  `json:",omitempty"`
260*333d2b36SAndroid Build Coastguard Worker	NativeBridgeSecondaryArchVariant  *string  `json:",omitempty"`
261*333d2b36SAndroid Build Coastguard Worker	NativeBridgeSecondaryCpuVariant   *string  `json:",omitempty"`
262*333d2b36SAndroid Build Coastguard Worker	NativeBridgeSecondaryAbi          []string `json:",omitempty"`
263*333d2b36SAndroid Build Coastguard Worker	NativeBridgeSecondaryRelativePath *string  `json:",omitempty"`
264*333d2b36SAndroid Build Coastguard Worker
265*333d2b36SAndroid Build Coastguard Worker	HostArch          *string `json:",omitempty"`
266*333d2b36SAndroid Build Coastguard Worker	HostSecondaryArch *string `json:",omitempty"`
267*333d2b36SAndroid Build Coastguard Worker	HostMusl          *bool   `json:",omitempty"`
268*333d2b36SAndroid Build Coastguard Worker
269*333d2b36SAndroid Build Coastguard Worker	CrossHost              *string `json:",omitempty"`
270*333d2b36SAndroid Build Coastguard Worker	CrossHostArch          *string `json:",omitempty"`
271*333d2b36SAndroid Build Coastguard Worker	CrossHostSecondaryArch *string `json:",omitempty"`
272*333d2b36SAndroid Build Coastguard Worker
273*333d2b36SAndroid Build Coastguard Worker	DeviceResourceOverlays     []string `json:",omitempty"`
274*333d2b36SAndroid Build Coastguard Worker	ProductResourceOverlays    []string `json:",omitempty"`
275*333d2b36SAndroid Build Coastguard Worker	EnforceRROTargets          []string `json:",omitempty"`
276*333d2b36SAndroid Build Coastguard Worker	EnforceRROExcludedOverlays []string `json:",omitempty"`
277*333d2b36SAndroid Build Coastguard Worker
278*333d2b36SAndroid Build Coastguard Worker	AAPTCharacteristics *string  `json:",omitempty"`
279*333d2b36SAndroid Build Coastguard Worker	AAPTConfig          []string `json:",omitempty"`
280*333d2b36SAndroid Build Coastguard Worker	AAPTPreferredConfig *string  `json:",omitempty"`
281*333d2b36SAndroid Build Coastguard Worker	AAPTPrebuiltDPI     []string `json:",omitempty"`
282*333d2b36SAndroid Build Coastguard Worker
283*333d2b36SAndroid Build Coastguard Worker	DefaultAppCertificate           *string  `json:",omitempty"`
284*333d2b36SAndroid Build Coastguard Worker	ExtraOtaKeys                    []string `json:",omitempty"`
285*333d2b36SAndroid Build Coastguard Worker	ExtraOtaRecoveryKeys            []string `json:",omitempty"`
286*333d2b36SAndroid Build Coastguard Worker	MainlineSepolicyDevCertificates *string  `json:",omitempty"`
287*333d2b36SAndroid Build Coastguard Worker
288*333d2b36SAndroid Build Coastguard Worker	AppsDefaultVersionName *string `json:",omitempty"`
289*333d2b36SAndroid Build Coastguard Worker
290*333d2b36SAndroid Build Coastguard Worker	Allow_missing_dependencies   *bool    `json:",omitempty"`
291*333d2b36SAndroid Build Coastguard Worker	Unbundled_build              *bool    `json:",omitempty"`
292*333d2b36SAndroid Build Coastguard Worker	Unbundled_build_apps         []string `json:",omitempty"`
293*333d2b36SAndroid Build Coastguard Worker	Unbundled_build_image        *bool    `json:",omitempty"`
294*333d2b36SAndroid Build Coastguard Worker	Always_use_prebuilt_sdks     *bool    `json:",omitempty"`
295*333d2b36SAndroid Build Coastguard Worker	Skip_boot_jars_check         *bool    `json:",omitempty"`
296*333d2b36SAndroid Build Coastguard Worker	Malloc_low_memory            *bool    `json:",omitempty"`
297*333d2b36SAndroid Build Coastguard Worker	Malloc_zero_contents         *bool    `json:",omitempty"`
298*333d2b36SAndroid Build Coastguard Worker	Malloc_pattern_fill_contents *bool    `json:",omitempty"`
299*333d2b36SAndroid Build Coastguard Worker	Safestack                    *bool    `json:",omitempty"`
300*333d2b36SAndroid Build Coastguard Worker	HostStaticBinaries           *bool    `json:",omitempty"`
301*333d2b36SAndroid Build Coastguard Worker	Binder32bit                  *bool    `json:",omitempty"`
302*333d2b36SAndroid Build Coastguard Worker	UseGoma                      *bool    `json:",omitempty"`
303*333d2b36SAndroid Build Coastguard Worker	UseABFS                      *bool    `json:",omitempty"`
304*333d2b36SAndroid Build Coastguard Worker	UseRBE                       *bool    `json:",omitempty"`
305*333d2b36SAndroid Build Coastguard Worker	UseRBEJAVAC                  *bool    `json:",omitempty"`
306*333d2b36SAndroid Build Coastguard Worker	UseRBER8                     *bool    `json:",omitempty"`
307*333d2b36SAndroid Build Coastguard Worker	UseRBED8                     *bool    `json:",omitempty"`
308*333d2b36SAndroid Build Coastguard Worker	Debuggable                   *bool    `json:",omitempty"`
309*333d2b36SAndroid Build Coastguard Worker	Eng                          *bool    `json:",omitempty"`
310*333d2b36SAndroid Build Coastguard Worker	Treble_linker_namespaces     *bool    `json:",omitempty"`
311*333d2b36SAndroid Build Coastguard Worker	Enforce_vintf_manifest       *bool    `json:",omitempty"`
312*333d2b36SAndroid Build Coastguard Worker	Uml                          *bool    `json:",omitempty"`
313*333d2b36SAndroid Build Coastguard Worker	Arc                          *bool    `json:",omitempty"`
314*333d2b36SAndroid Build Coastguard Worker	MinimizeJavaDebugInfo        *bool    `json:",omitempty"`
315*333d2b36SAndroid Build Coastguard Worker	Build_from_text_stub         *bool    `json:",omitempty"`
316*333d2b36SAndroid Build Coastguard Worker
317*333d2b36SAndroid Build Coastguard Worker	BuildType *string `json:",omitempty"`
318*333d2b36SAndroid Build Coastguard Worker
319*333d2b36SAndroid Build Coastguard Worker	Check_elf_files *bool `json:",omitempty"`
320*333d2b36SAndroid Build Coastguard Worker
321*333d2b36SAndroid Build Coastguard Worker	UncompressPrivAppDex             *bool    `json:",omitempty"`
322*333d2b36SAndroid Build Coastguard Worker	ModulesLoadedByPrivilegedModules []string `json:",omitempty"`
323*333d2b36SAndroid Build Coastguard Worker
324*333d2b36SAndroid Build Coastguard Worker	BootJars     ConfiguredJarList `json:",omitempty"`
325*333d2b36SAndroid Build Coastguard Worker	ApexBootJars ConfiguredJarList `json:",omitempty"`
326*333d2b36SAndroid Build Coastguard Worker
327*333d2b36SAndroid Build Coastguard Worker	IntegerOverflowExcludePaths []string `json:",omitempty"`
328*333d2b36SAndroid Build Coastguard Worker
329*333d2b36SAndroid Build Coastguard Worker	EnableCFI       *bool    `json:",omitempty"`
330*333d2b36SAndroid Build Coastguard Worker	CFIExcludePaths []string `json:",omitempty"`
331*333d2b36SAndroid Build Coastguard Worker	CFIIncludePaths []string `json:",omitempty"`
332*333d2b36SAndroid Build Coastguard Worker
333*333d2b36SAndroid Build Coastguard Worker	DisableScudo *bool `json:",omitempty"`
334*333d2b36SAndroid Build Coastguard Worker
335*333d2b36SAndroid Build Coastguard Worker	MemtagHeapExcludePaths      []string `json:",omitempty"`
336*333d2b36SAndroid Build Coastguard Worker	MemtagHeapAsyncIncludePaths []string `json:",omitempty"`
337*333d2b36SAndroid Build Coastguard Worker	MemtagHeapSyncIncludePaths  []string `json:",omitempty"`
338*333d2b36SAndroid Build Coastguard Worker
339*333d2b36SAndroid Build Coastguard Worker	HWASanIncludePaths []string `json:",omitempty"`
340*333d2b36SAndroid Build Coastguard Worker	HWASanExcludePaths []string `json:",omitempty"`
341*333d2b36SAndroid Build Coastguard Worker
342*333d2b36SAndroid Build Coastguard Worker	VendorPath            *string `json:",omitempty"`
343*333d2b36SAndroid Build Coastguard Worker	VendorDlkmPath        *string `json:",omitempty"`
344*333d2b36SAndroid Build Coastguard Worker	BuildingVendorImage   *bool   `json:",omitempty"`
345*333d2b36SAndroid Build Coastguard Worker	OdmPath               *string `json:",omitempty"`
346*333d2b36SAndroid Build Coastguard Worker	BuildingOdmImage      *bool   `json:",omitempty"`
347*333d2b36SAndroid Build Coastguard Worker	OdmDlkmPath           *string `json:",omitempty"`
348*333d2b36SAndroid Build Coastguard Worker	ProductPath           *string `json:",omitempty"`
349*333d2b36SAndroid Build Coastguard Worker	BuildingProductImage  *bool   `json:",omitempty"`
350*333d2b36SAndroid Build Coastguard Worker	SystemExtPath         *string `json:",omitempty"`
351*333d2b36SAndroid Build Coastguard Worker	SystemDlkmPath        *string `json:",omitempty"`
352*333d2b36SAndroid Build Coastguard Worker	OemPath               *string `json:",omitempty"`
353*333d2b36SAndroid Build Coastguard Worker	UserdataPath          *string `json:",omitempty"`
354*333d2b36SAndroid Build Coastguard Worker	BuildingUserdataImage *bool   `json:",omitempty"`
355*333d2b36SAndroid Build Coastguard Worker	RecoveryPath          *string `json:",omitempty"`
356*333d2b36SAndroid Build Coastguard Worker	BuildingRecoveryImage *bool   `json:",omitempty"`
357*333d2b36SAndroid Build Coastguard Worker
358*333d2b36SAndroid Build Coastguard Worker	ClangTidy  *bool   `json:",omitempty"`
359*333d2b36SAndroid Build Coastguard Worker	TidyChecks *string `json:",omitempty"`
360*333d2b36SAndroid Build Coastguard Worker
361*333d2b36SAndroid Build Coastguard Worker	JavaCoveragePaths        []string `json:",omitempty"`
362*333d2b36SAndroid Build Coastguard Worker	JavaCoverageExcludePaths []string `json:",omitempty"`
363*333d2b36SAndroid Build Coastguard Worker
364*333d2b36SAndroid Build Coastguard Worker	GcovCoverage                *bool    `json:",omitempty"`
365*333d2b36SAndroid Build Coastguard Worker	ClangCoverage               *bool    `json:",omitempty"`
366*333d2b36SAndroid Build Coastguard Worker	NativeCoveragePaths         []string `json:",omitempty"`
367*333d2b36SAndroid Build Coastguard Worker	NativeCoverageExcludePaths  []string `json:",omitempty"`
368*333d2b36SAndroid Build Coastguard Worker	ClangCoverageContinuousMode *bool    `json:",omitempty"`
369*333d2b36SAndroid Build Coastguard Worker
370*333d2b36SAndroid Build Coastguard Worker	// Set by NewConfig
371*333d2b36SAndroid Build Coastguard Worker	Native_coverage *bool `json:",omitempty"`
372*333d2b36SAndroid Build Coastguard Worker
373*333d2b36SAndroid Build Coastguard Worker	SanitizeHost       []string `json:",omitempty"`
374*333d2b36SAndroid Build Coastguard Worker	SanitizeDevice     []string `json:",omitempty"`
375*333d2b36SAndroid Build Coastguard Worker	SanitizeDeviceDiag []string `json:",omitempty"`
376*333d2b36SAndroid Build Coastguard Worker	SanitizeDeviceArch []string `json:",omitempty"`
377*333d2b36SAndroid Build Coastguard Worker
378*333d2b36SAndroid Build Coastguard Worker	ArtUseReadBarrier *bool `json:",omitempty"`
379*333d2b36SAndroid Build Coastguard Worker
380*333d2b36SAndroid Build Coastguard Worker	BtConfigIncludeDir *string `json:",omitempty"`
381*333d2b36SAndroid Build Coastguard Worker
382*333d2b36SAndroid Build Coastguard Worker	Override_rs_driver *string `json:",omitempty"`
383*333d2b36SAndroid Build Coastguard Worker
384*333d2b36SAndroid Build Coastguard Worker	DeviceKernelHeaders []string `json:",omitempty"`
385*333d2b36SAndroid Build Coastguard Worker
386*333d2b36SAndroid Build Coastguard Worker	ExtraVndkVersions []string `json:",omitempty"`
387*333d2b36SAndroid Build Coastguard Worker
388*333d2b36SAndroid Build Coastguard Worker	NamespacesToExport []string `json:",omitempty"`
389*333d2b36SAndroid Build Coastguard Worker
390*333d2b36SAndroid Build Coastguard Worker	PgoAdditionalProfileDirs []string `json:",omitempty"`
391*333d2b36SAndroid Build Coastguard Worker
392*333d2b36SAndroid Build Coastguard Worker	MultitreeUpdateMeta bool `json:",omitempty"`
393*333d2b36SAndroid Build Coastguard Worker
394*333d2b36SAndroid Build Coastguard Worker	BoardVendorSepolicyDirs      []string `json:",omitempty"`
395*333d2b36SAndroid Build Coastguard Worker	BoardOdmSepolicyDirs         []string `json:",omitempty"`
396*333d2b36SAndroid Build Coastguard Worker	SystemExtPublicSepolicyDirs  []string `json:",omitempty"`
397*333d2b36SAndroid Build Coastguard Worker	SystemExtPrivateSepolicyDirs []string `json:",omitempty"`
398*333d2b36SAndroid Build Coastguard Worker	BoardSepolicyM4Defs          []string `json:",omitempty"`
399*333d2b36SAndroid Build Coastguard Worker
400*333d2b36SAndroid Build Coastguard Worker	BoardPlatform           *string `json:",omitempty"`
401*333d2b36SAndroid Build Coastguard Worker	BoardSepolicyVers       *string `json:",omitempty"`
402*333d2b36SAndroid Build Coastguard Worker	PlatformSepolicyVersion *string `json:",omitempty"`
403*333d2b36SAndroid Build Coastguard Worker
404*333d2b36SAndroid Build Coastguard Worker	SystemExtSepolicyPrebuiltApiDir *string `json:",omitempty"`
405*333d2b36SAndroid Build Coastguard Worker	ProductSepolicyPrebuiltApiDir   *string `json:",omitempty"`
406*333d2b36SAndroid Build Coastguard Worker
407*333d2b36SAndroid Build Coastguard Worker	PlatformSepolicyCompatVersions []string `json:",omitempty"`
408*333d2b36SAndroid Build Coastguard Worker
409*333d2b36SAndroid Build Coastguard Worker	VendorVars     map[string]map[string]string `json:",omitempty"`
410*333d2b36SAndroid Build Coastguard Worker	VendorVarTypes map[string]map[string]string `json:",omitempty"`
411*333d2b36SAndroid Build Coastguard Worker
412*333d2b36SAndroid Build Coastguard Worker	Ndk_abis *bool `json:",omitempty"`
413*333d2b36SAndroid Build Coastguard Worker
414*333d2b36SAndroid Build Coastguard Worker	ForceApexSymlinkOptimization *bool   `json:",omitempty"`
415*333d2b36SAndroid Build Coastguard Worker	CompressedApex               *bool   `json:",omitempty"`
416*333d2b36SAndroid Build Coastguard Worker	DefaultApexPayloadType       *string `json:",omitempty"`
417*333d2b36SAndroid Build Coastguard Worker	Aml_abis                     *bool   `json:",omitempty"`
418*333d2b36SAndroid Build Coastguard Worker
419*333d2b36SAndroid Build Coastguard Worker	DexpreoptGlobalConfig *string `json:",omitempty"`
420*333d2b36SAndroid Build Coastguard Worker
421*333d2b36SAndroid Build Coastguard Worker	WithDexpreopt bool `json:",omitempty"`
422*333d2b36SAndroid Build Coastguard Worker
423*333d2b36SAndroid Build Coastguard Worker	ManifestPackageNameOverrides   []string `json:",omitempty"`
424*333d2b36SAndroid Build Coastguard Worker	CertificateOverrides           []string `json:",omitempty"`
425*333d2b36SAndroid Build Coastguard Worker	PackageNameOverrides           []string `json:",omitempty"`
426*333d2b36SAndroid Build Coastguard Worker	ConfiguredJarLocationOverrides []string `json:",omitempty"`
427*333d2b36SAndroid Build Coastguard Worker
428*333d2b36SAndroid Build Coastguard Worker	ApexGlobalMinSdkVersionOverride *string `json:",omitempty"`
429*333d2b36SAndroid Build Coastguard Worker
430*333d2b36SAndroid Build Coastguard Worker	EnforceSystemCertificate          *bool    `json:",omitempty"`
431*333d2b36SAndroid Build Coastguard Worker	EnforceSystemCertificateAllowList []string `json:",omitempty"`
432*333d2b36SAndroid Build Coastguard Worker
433*333d2b36SAndroid Build Coastguard Worker	ProductHiddenAPIStubs       []string `json:",omitempty"`
434*333d2b36SAndroid Build Coastguard Worker	ProductHiddenAPIStubsSystem []string `json:",omitempty"`
435*333d2b36SAndroid Build Coastguard Worker	ProductHiddenAPIStubsTest   []string `json:",omitempty"`
436*333d2b36SAndroid Build Coastguard Worker
437*333d2b36SAndroid Build Coastguard Worker	ProductPublicSepolicyDirs  []string `json:",omitempty"`
438*333d2b36SAndroid Build Coastguard Worker	ProductPrivateSepolicyDirs []string `json:",omitempty"`
439*333d2b36SAndroid Build Coastguard Worker
440*333d2b36SAndroid Build Coastguard Worker	TargetFSConfigGen []string `json:",omitempty"`
441*333d2b36SAndroid Build Coastguard Worker
442*333d2b36SAndroid Build Coastguard Worker	UseSoongSystemImage            *bool   `json:",omitempty"`
443*333d2b36SAndroid Build Coastguard Worker	ProductSoongDefinedSystemImage *string `json:",omitempty"`
444*333d2b36SAndroid Build Coastguard Worker
445*333d2b36SAndroid Build Coastguard Worker	EnforceProductPartitionInterface *bool `json:",omitempty"`
446*333d2b36SAndroid Build Coastguard Worker
447*333d2b36SAndroid Build Coastguard Worker	BoardUsesRecoveryAsBoot *bool `json:",omitempty"`
448*333d2b36SAndroid Build Coastguard Worker
449*333d2b36SAndroid Build Coastguard Worker	BoardKernelBinaries                []string `json:",omitempty"`
450*333d2b36SAndroid Build Coastguard Worker	BoardKernelModuleInterfaceVersions []string `json:",omitempty"`
451*333d2b36SAndroid Build Coastguard Worker
452*333d2b36SAndroid Build Coastguard Worker	BoardMoveRecoveryResourcesToVendorBoot *bool `json:",omitempty"`
453*333d2b36SAndroid Build Coastguard Worker
454*333d2b36SAndroid Build Coastguard Worker	PrebuiltHiddenApiDir *string `json:",omitempty"`
455*333d2b36SAndroid Build Coastguard Worker
456*333d2b36SAndroid Build Coastguard Worker	Shipping_api_level *string `json:",omitempty"`
457*333d2b36SAndroid Build Coastguard Worker
458*333d2b36SAndroid Build Coastguard Worker	BuildBrokenPluginValidation         []string `json:",omitempty"`
459*333d2b36SAndroid Build Coastguard Worker	BuildBrokenClangAsFlags             bool     `json:",omitempty"`
460*333d2b36SAndroid Build Coastguard Worker	BuildBrokenClangCFlags              bool     `json:",omitempty"`
461*333d2b36SAndroid Build Coastguard Worker	BuildBrokenClangProperty            bool     `json:",omitempty"`
462*333d2b36SAndroid Build Coastguard Worker	GenruleSandboxing                   *bool    `json:",omitempty"`
463*333d2b36SAndroid Build Coastguard Worker	BuildBrokenEnforceSyspropOwner      bool     `json:",omitempty"`
464*333d2b36SAndroid Build Coastguard Worker	BuildBrokenTrebleSyspropNeverallow  bool     `json:",omitempty"`
465*333d2b36SAndroid Build Coastguard Worker	BuildBrokenVendorPropertyNamespace  bool     `json:",omitempty"`
466*333d2b36SAndroid Build Coastguard Worker	BuildBrokenIncorrectPartitionImages bool     `json:",omitempty"`
467*333d2b36SAndroid Build Coastguard Worker	BuildBrokenInputDirModules          []string `json:",omitempty"`
468*333d2b36SAndroid Build Coastguard Worker	BuildBrokenDontCheckSystemSdk       bool     `json:",omitempty"`
469*333d2b36SAndroid Build Coastguard Worker	BuildBrokenDupSysprop               bool     `json:",omitempty"`
470*333d2b36SAndroid Build Coastguard Worker
471*333d2b36SAndroid Build Coastguard Worker	BuildWarningBadOptionalUsesLibsAllowlist []string `json:",omitempty"`
472*333d2b36SAndroid Build Coastguard Worker
473*333d2b36SAndroid Build Coastguard Worker	BuildDebugfsRestrictionsEnabled bool `json:",omitempty"`
474*333d2b36SAndroid Build Coastguard Worker
475*333d2b36SAndroid Build Coastguard Worker	RequiresInsecureExecmemForSwiftshader bool `json:",omitempty"`
476*333d2b36SAndroid Build Coastguard Worker
477*333d2b36SAndroid Build Coastguard Worker	SelinuxIgnoreNeverallows bool `json:",omitempty"`
478*333d2b36SAndroid Build Coastguard Worker
479*333d2b36SAndroid Build Coastguard Worker	Release_aidl_use_unfrozen *bool `json:",omitempty"`
480*333d2b36SAndroid Build Coastguard Worker
481*333d2b36SAndroid Build Coastguard Worker	SepolicyFreezeTestExtraDirs         []string `json:",omitempty"`
482*333d2b36SAndroid Build Coastguard Worker	SepolicyFreezeTestExtraPrebuiltDirs []string `json:",omitempty"`
483*333d2b36SAndroid Build Coastguard Worker
484*333d2b36SAndroid Build Coastguard Worker	GenerateAidlNdkPlatformBackend bool `json:",omitempty"`
485*333d2b36SAndroid Build Coastguard Worker
486*333d2b36SAndroid Build Coastguard Worker	IgnorePrefer32OnDevice bool `json:",omitempty"`
487*333d2b36SAndroid Build Coastguard Worker
488*333d2b36SAndroid Build Coastguard Worker	SourceRootDirs []string `json:",omitempty"`
489*333d2b36SAndroid Build Coastguard Worker
490*333d2b36SAndroid Build Coastguard Worker	AfdoProfiles []string `json:",omitempty"`
491*333d2b36SAndroid Build Coastguard Worker
492*333d2b36SAndroid Build Coastguard Worker	ProductManufacturer string `json:",omitempty"`
493*333d2b36SAndroid Build Coastguard Worker	ProductBrand        string `json:",omitempty"`
494*333d2b36SAndroid Build Coastguard Worker	ProductDevice       string `json:",omitempty"`
495*333d2b36SAndroid Build Coastguard Worker	ProductModel        string `json:",omitempty"`
496*333d2b36SAndroid Build Coastguard Worker
497*333d2b36SAndroid Build Coastguard Worker	ReleaseVersion          string   `json:",omitempty"`
498*333d2b36SAndroid Build Coastguard Worker	ReleaseAconfigValueSets []string `json:",omitempty"`
499*333d2b36SAndroid Build Coastguard Worker
500*333d2b36SAndroid Build Coastguard Worker	ReleaseAconfigFlagDefaultPermission string `json:",omitempty"`
501*333d2b36SAndroid Build Coastguard Worker
502*333d2b36SAndroid Build Coastguard Worker	ReleaseDefaultModuleBuildFromSource *bool `json:",omitempty"`
503*333d2b36SAndroid Build Coastguard Worker
504*333d2b36SAndroid Build Coastguard Worker	CheckVendorSeappViolations *bool `json:",omitempty"`
505*333d2b36SAndroid Build Coastguard Worker
506*333d2b36SAndroid Build Coastguard Worker	BuildFlags map[string]string `json:",omitempty"`
507*333d2b36SAndroid Build Coastguard Worker
508*333d2b36SAndroid Build Coastguard Worker	BuildFlagTypes map[string]string `json:",omitempty"`
509*333d2b36SAndroid Build Coastguard Worker
510*333d2b36SAndroid Build Coastguard Worker	BuildFromSourceStub *bool `json:",omitempty"`
511*333d2b36SAndroid Build Coastguard Worker
512*333d2b36SAndroid Build Coastguard Worker	BuildIgnoreApexContributionContents *bool `json:",omitempty"`
513*333d2b36SAndroid Build Coastguard Worker
514*333d2b36SAndroid Build Coastguard Worker	HiddenapiExportableStubs *bool `json:",omitempty"`
515*333d2b36SAndroid Build Coastguard Worker
516*333d2b36SAndroid Build Coastguard Worker	ExportRuntimeApis *bool `json:",omitempty"`
517*333d2b36SAndroid Build Coastguard Worker
518*333d2b36SAndroid Build Coastguard Worker	AconfigContainerValidation string `json:",omitempty"`
519*333d2b36SAndroid Build Coastguard Worker
520*333d2b36SAndroid Build Coastguard Worker	ProductLocales []string `json:",omitempty"`
521*333d2b36SAndroid Build Coastguard Worker
522*333d2b36SAndroid Build Coastguard Worker	ProductDefaultWifiChannels []string `json:",omitempty"`
523*333d2b36SAndroid Build Coastguard Worker
524*333d2b36SAndroid Build Coastguard Worker	BoardUseVbmetaDigestInFingerprint *bool `json:",omitempty"`
525*333d2b36SAndroid Build Coastguard Worker
526*333d2b36SAndroid Build Coastguard Worker	OemProperties []string `json:",omitempty"`
527*333d2b36SAndroid Build Coastguard Worker
528*333d2b36SAndroid Build Coastguard Worker	ArtTargetIncludeDebugBuild *bool `json:",omitempty"`
529*333d2b36SAndroid Build Coastguard Worker
530*333d2b36SAndroid Build Coastguard Worker	SystemPropFiles    []string `json:",omitempty"`
531*333d2b36SAndroid Build Coastguard Worker	SystemExtPropFiles []string `json:",omitempty"`
532*333d2b36SAndroid Build Coastguard Worker	ProductPropFiles   []string `json:",omitempty"`
533*333d2b36SAndroid Build Coastguard Worker	OdmPropFiles       []string `json:",omitempty"`
534*333d2b36SAndroid Build Coastguard Worker	VendorPropFiles    []string `json:",omitempty"`
535*333d2b36SAndroid Build Coastguard Worker
536*333d2b36SAndroid Build Coastguard Worker	EnableUffdGc *string `json:",omitempty"`
537*333d2b36SAndroid Build Coastguard Worker
538*333d2b36SAndroid Build Coastguard Worker	BoardAvbEnable                         *bool    `json:",omitempty"`
539*333d2b36SAndroid Build Coastguard Worker	BoardAvbSystemAddHashtreeFooterArgs    []string `json:",omitempty"`
540*333d2b36SAndroid Build Coastguard Worker	DeviceFrameworkCompatibilityMatrixFile []string `json:",omitempty"`
541*333d2b36SAndroid Build Coastguard Worker	DeviceProductCompatibilityMatrixFile   []string `json:",omitempty"`
542*333d2b36SAndroid Build Coastguard Worker
543*333d2b36SAndroid Build Coastguard Worker	PartitionVarsForSoongMigrationOnlyDoNotUse PartitionVariables
544*333d2b36SAndroid Build Coastguard Worker
545*333d2b36SAndroid Build Coastguard Worker	ExtraAllowedDepsTxt *string `json:",omitempty"`
546*333d2b36SAndroid Build Coastguard Worker
547*333d2b36SAndroid Build Coastguard Worker	AdbKeys *string `json:",omitempty"`
548*333d2b36SAndroid Build Coastguard Worker
549*333d2b36SAndroid Build Coastguard Worker	DeviceMatrixFile       []string `json:",omitempty"`
550*333d2b36SAndroid Build Coastguard Worker	ProductManifestFiles   []string `json:",omitempty"`
551*333d2b36SAndroid Build Coastguard Worker	SystemManifestFile     []string `json:",omitempty"`
552*333d2b36SAndroid Build Coastguard Worker	SystemExtManifestFiles []string `json:",omitempty"`
553*333d2b36SAndroid Build Coastguard Worker	DeviceManifestFiles    []string `json:",omitempty"`
554*333d2b36SAndroid Build Coastguard Worker	OdmManifestFiles       []string `json:",omitempty"`
555*333d2b36SAndroid Build Coastguard Worker}
556*333d2b36SAndroid Build Coastguard Worker
557*333d2b36SAndroid Build Coastguard Workertype PartitionQualifiedVariablesType struct {
558*333d2b36SAndroid Build Coastguard Worker	BuildingImage               bool   `json:",omitempty"`
559*333d2b36SAndroid Build Coastguard Worker	BoardErofsCompressor        string `json:",omitempty"`
560*333d2b36SAndroid Build Coastguard Worker	BoardErofsCompressHints     string `json:",omitempty"`
561*333d2b36SAndroid Build Coastguard Worker	BoardErofsPclusterSize      string `json:",omitempty"`
562*333d2b36SAndroid Build Coastguard Worker	BoardExtfsInodeCount        string `json:",omitempty"`
563*333d2b36SAndroid Build Coastguard Worker	BoardExtfsRsvPct            string `json:",omitempty"`
564*333d2b36SAndroid Build Coastguard Worker	BoardF2fsSloadCompressFlags string `json:",omitempty"`
565*333d2b36SAndroid Build Coastguard Worker	BoardFileSystemCompress     string `json:",omitempty"`
566*333d2b36SAndroid Build Coastguard Worker	BoardFileSystemType         string `json:",omitempty"`
567*333d2b36SAndroid Build Coastguard Worker	BoardJournalSize            string `json:",omitempty"`
568*333d2b36SAndroid Build Coastguard Worker	BoardPartitionReservedSize  string `json:",omitempty"`
569*333d2b36SAndroid Build Coastguard Worker	BoardPartitionSize          string `json:",omitempty"`
570*333d2b36SAndroid Build Coastguard Worker	BoardSquashfsBlockSize      string `json:",omitempty"`
571*333d2b36SAndroid Build Coastguard Worker	BoardSquashfsCompressor     string `json:",omitempty"`
572*333d2b36SAndroid Build Coastguard Worker	BoardSquashfsCompressorOpt  string `json:",omitempty"`
573*333d2b36SAndroid Build Coastguard Worker	BoardSquashfsDisable4kAlign string `json:",omitempty"`
574*333d2b36SAndroid Build Coastguard Worker	ProductBaseFsPath           string `json:",omitempty"`
575*333d2b36SAndroid Build Coastguard Worker	ProductHeadroom             string `json:",omitempty"`
576*333d2b36SAndroid Build Coastguard Worker	ProductVerityPartition      string `json:",omitempty"`
577*333d2b36SAndroid Build Coastguard Worker
578*333d2b36SAndroid Build Coastguard Worker	BoardAvbAddHashtreeFooterArgs string `json:",omitempty"`
579*333d2b36SAndroid Build Coastguard Worker	BoardAvbKeyPath               string `json:",omitempty"`
580*333d2b36SAndroid Build Coastguard Worker	BoardAvbAlgorithm             string `json:",omitempty"`
581*333d2b36SAndroid Build Coastguard Worker	BoardAvbRollbackIndex         string `json:",omitempty"`
582*333d2b36SAndroid Build Coastguard Worker	BoardAvbRollbackIndexLocation string `json:",omitempty"`
583*333d2b36SAndroid Build Coastguard Worker}
584*333d2b36SAndroid Build Coastguard Worker
585*333d2b36SAndroid Build Coastguard Workertype BoardSuperPartitionGroupProps struct {
586*333d2b36SAndroid Build Coastguard Worker	GroupSize     string   `json:",omitempty"`
587*333d2b36SAndroid Build Coastguard Worker	PartitionList []string `json:",omitempty"`
588*333d2b36SAndroid Build Coastguard Worker}
589*333d2b36SAndroid Build Coastguard Worker
590*333d2b36SAndroid Build Coastguard Workertype ChainedAvbPartitionProps struct {
591*333d2b36SAndroid Build Coastguard Worker	Partitions            []string `json:",omitempty"`
592*333d2b36SAndroid Build Coastguard Worker	Key                   string   `json:",omitempty"`
593*333d2b36SAndroid Build Coastguard Worker	Algorithm             string   `json:",omitempty"`
594*333d2b36SAndroid Build Coastguard Worker	RollbackIndex         string   `json:",omitempty"`
595*333d2b36SAndroid Build Coastguard Worker	RollbackIndexLocation string   `json:",omitempty"`
596*333d2b36SAndroid Build Coastguard Worker}
597*333d2b36SAndroid Build Coastguard Worker
598*333d2b36SAndroid Build Coastguard Workertype PartitionVariables struct {
599*333d2b36SAndroid Build Coastguard Worker	ProductDirectory            string `json:",omitempty"`
600*333d2b36SAndroid Build Coastguard Worker	PartitionQualifiedVariables map[string]PartitionQualifiedVariablesType
601*333d2b36SAndroid Build Coastguard Worker	TargetUserimagesUseExt2     bool `json:",omitempty"`
602*333d2b36SAndroid Build Coastguard Worker	TargetUserimagesUseExt3     bool `json:",omitempty"`
603*333d2b36SAndroid Build Coastguard Worker	TargetUserimagesUseExt4     bool `json:",omitempty"`
604*333d2b36SAndroid Build Coastguard Worker
605*333d2b36SAndroid Build Coastguard Worker	TargetUserimagesSparseExtDisabled      bool `json:",omitempty"`
606*333d2b36SAndroid Build Coastguard Worker	TargetUserimagesSparseErofsDisabled    bool `json:",omitempty"`
607*333d2b36SAndroid Build Coastguard Worker	TargetUserimagesSparseSquashfsDisabled bool `json:",omitempty"`
608*333d2b36SAndroid Build Coastguard Worker	TargetUserimagesSparseF2fsDisabled     bool `json:",omitempty"`
609*333d2b36SAndroid Build Coastguard Worker
610*333d2b36SAndroid Build Coastguard Worker	BoardErofsCompressor           string `json:",omitempty"`
611*333d2b36SAndroid Build Coastguard Worker	BoardErofsCompressorHints      string `json:",omitempty"`
612*333d2b36SAndroid Build Coastguard Worker	BoardErofsPclusterSize         string `json:",omitempty"`
613*333d2b36SAndroid Build Coastguard Worker	BoardErofsShareDupBlocks       string `json:",omitempty"`
614*333d2b36SAndroid Build Coastguard Worker	BoardErofsUseLegacyCompression string `json:",omitempty"`
615*333d2b36SAndroid Build Coastguard Worker	BoardExt4ShareDupBlocks        string `json:",omitempty"`
616*333d2b36SAndroid Build Coastguard Worker	BoardFlashLogicalBlockSize     string `json:",omitempty"`
617*333d2b36SAndroid Build Coastguard Worker	BoardFlashEraseBlockSize       string `json:",omitempty"`
618*333d2b36SAndroid Build Coastguard Worker	ProductUseDynamicPartitionSize bool   `json:",omitempty"`
619*333d2b36SAndroid Build Coastguard Worker	CopyImagesForTargetFilesZip    bool   `json:",omitempty"`
620*333d2b36SAndroid Build Coastguard Worker
621*333d2b36SAndroid Build Coastguard Worker	VendorSecurityPatch string `json:",omitempty"`
622*333d2b36SAndroid Build Coastguard Worker
623*333d2b36SAndroid Build Coastguard Worker	// Boot image stuff
624*333d2b36SAndroid Build Coastguard Worker	BuildingRamdiskImage            bool     `json:",omitempty"`
625*333d2b36SAndroid Build Coastguard Worker	ProductBuildBootImage           bool     `json:",omitempty"`
626*333d2b36SAndroid Build Coastguard Worker	ProductBuildVendorBootImage     string   `json:",omitempty"`
627*333d2b36SAndroid Build Coastguard Worker	ProductBuildInitBootImage       bool     `json:",omitempty"`
628*333d2b36SAndroid Build Coastguard Worker	BoardUsesRecoveryAsBoot         bool     `json:",omitempty"`
629*333d2b36SAndroid Build Coastguard Worker	BoardPrebuiltBootimage          string   `json:",omitempty"`
630*333d2b36SAndroid Build Coastguard Worker	BoardPrebuiltInitBootimage      string   `json:",omitempty"`
631*333d2b36SAndroid Build Coastguard Worker	BoardBootimagePartitionSize     string   `json:",omitempty"`
632*333d2b36SAndroid Build Coastguard Worker	BoardInitBootimagePartitionSize string   `json:",omitempty"`
633*333d2b36SAndroid Build Coastguard Worker	BoardBootHeaderVersion          string   `json:",omitempty"`
634*333d2b36SAndroid Build Coastguard Worker	TargetKernelPath                string   `json:",omitempty"`
635*333d2b36SAndroid Build Coastguard Worker	BoardUsesGenericKernelImage     bool     `json:",omitempty"`
636*333d2b36SAndroid Build Coastguard Worker	BootSecurityPatch               string   `json:",omitempty"`
637*333d2b36SAndroid Build Coastguard Worker	InitBootSecurityPatch           string   `json:",omitempty"`
638*333d2b36SAndroid Build Coastguard Worker	BoardIncludeDtbInBootimg        bool     `json:",omitempty"`
639*333d2b36SAndroid Build Coastguard Worker	InternalKernelCmdline           []string `json:",omitempty"`
640*333d2b36SAndroid Build Coastguard Worker	InternalBootconfig              []string `json:",omitempty"`
641*333d2b36SAndroid Build Coastguard Worker	InternalBootconfigFile          string   `json:",omitempty"`
642*333d2b36SAndroid Build Coastguard Worker
643*333d2b36SAndroid Build Coastguard Worker	// Super image stuff
644*333d2b36SAndroid Build Coastguard Worker	ProductUseDynamicPartitions       bool                                     `json:",omitempty"`
645*333d2b36SAndroid Build Coastguard Worker	ProductRetrofitDynamicPartitions  bool                                     `json:",omitempty"`
646*333d2b36SAndroid Build Coastguard Worker	ProductBuildSuperPartition        bool                                     `json:",omitempty"`
647*333d2b36SAndroid Build Coastguard Worker	BoardSuperPartitionSize           string                                   `json:",omitempty"`
648*333d2b36SAndroid Build Coastguard Worker	BoardSuperPartitionMetadataDevice string                                   `json:",omitempty"`
649*333d2b36SAndroid Build Coastguard Worker	BoardSuperPartitionBlockDevices   []string                                 `json:",omitempty"`
650*333d2b36SAndroid Build Coastguard Worker	BoardSuperPartitionGroups         map[string]BoardSuperPartitionGroupProps `json:",omitempty"`
651*333d2b36SAndroid Build Coastguard Worker	ProductVirtualAbOta               bool                                     `json:",omitempty"`
652*333d2b36SAndroid Build Coastguard Worker	ProductVirtualAbOtaRetrofit       bool                                     `json:",omitempty"`
653*333d2b36SAndroid Build Coastguard Worker	AbOtaUpdater                      bool                                     `json:",omitempty"`
654*333d2b36SAndroid Build Coastguard Worker
655*333d2b36SAndroid Build Coastguard Worker	// Avb (android verified boot) stuff
656*333d2b36SAndroid Build Coastguard Worker	BoardAvbEnable          bool                                `json:",omitempty"`
657*333d2b36SAndroid Build Coastguard Worker	BoardAvbAlgorithm       string                              `json:",omitempty"`
658*333d2b36SAndroid Build Coastguard Worker	BoardAvbKeyPath         string                              `json:",omitempty"`
659*333d2b36SAndroid Build Coastguard Worker	BoardAvbRollbackIndex   string                              `json:",omitempty"`
660*333d2b36SAndroid Build Coastguard Worker	BuildingVbmetaImage     bool                                `json:",omitempty"`
661*333d2b36SAndroid Build Coastguard Worker	ChainedVbmetaPartitions map[string]ChainedAvbPartitionProps `json:",omitempty"`
662*333d2b36SAndroid Build Coastguard Worker
663*333d2b36SAndroid Build Coastguard Worker	ProductPackages         []string `json:",omitempty"`
664*333d2b36SAndroid Build Coastguard Worker	ProductPackagesDebug    []string `json:",omitempty"`
665*333d2b36SAndroid Build Coastguard Worker	VendorLinkerConfigSrcs  []string `json:",omitempty"`
666*333d2b36SAndroid Build Coastguard Worker	ProductLinkerConfigSrcs []string `json:",omitempty"`
667*333d2b36SAndroid Build Coastguard Worker
668*333d2b36SAndroid Build Coastguard Worker	BoardInfoFiles      []string `json:",omitempty"`
669*333d2b36SAndroid Build Coastguard Worker	BootLoaderBoardName string   `json:",omitempty"`
670*333d2b36SAndroid Build Coastguard Worker
671*333d2b36SAndroid Build Coastguard Worker	ProductCopyFiles []string `json:",omitempty"`
672*333d2b36SAndroid Build Coastguard Worker
673*333d2b36SAndroid Build Coastguard Worker	BuildingSystemDlkmImage   bool     `json:",omitempty"`
674*333d2b36SAndroid Build Coastguard Worker	SystemKernelModules       []string `json:",omitempty"`
675*333d2b36SAndroid Build Coastguard Worker	SystemKernelBlocklistFile string   `json:",omitempty"`
676*333d2b36SAndroid Build Coastguard Worker	SystemKernelLoadModules   []string `json:",omitempty"`
677*333d2b36SAndroid Build Coastguard Worker	BuildingVendorDlkmImage   bool     `json:",omitempty"`
678*333d2b36SAndroid Build Coastguard Worker	VendorKernelModules       []string `json:",omitempty"`
679*333d2b36SAndroid Build Coastguard Worker	VendorKernelBlocklistFile string   `json:",omitempty"`
680*333d2b36SAndroid Build Coastguard Worker	BuildingOdmDlkmImage      bool     `json:",omitempty"`
681*333d2b36SAndroid Build Coastguard Worker	OdmKernelModules          []string `json:",omitempty"`
682*333d2b36SAndroid Build Coastguard Worker	OdmKernelBlocklistFile    string   `json:",omitempty"`
683*333d2b36SAndroid Build Coastguard Worker
684*333d2b36SAndroid Build Coastguard Worker	VendorRamdiskKernelModules       []string `json:",omitempty"`
685*333d2b36SAndroid Build Coastguard Worker	VendorRamdiskKernelBlocklistFile string   `json:",omitempty"`
686*333d2b36SAndroid Build Coastguard Worker	VendorRamdiskKernelLoadModules   []string `json:",omitempty"`
687*333d2b36SAndroid Build Coastguard Worker	VendorRamdiskKernelOptionsFile   string   `json:",omitempty"`
688*333d2b36SAndroid Build Coastguard Worker
689*333d2b36SAndroid Build Coastguard Worker	ProductFsverityGenerateMetadata bool `json:",omitempty"`
690*333d2b36SAndroid Build Coastguard Worker
691*333d2b36SAndroid Build Coastguard Worker	TargetScreenDensity string `json:",omitempty"`
692*333d2b36SAndroid Build Coastguard Worker}
693*333d2b36SAndroid Build Coastguard Worker
694*333d2b36SAndroid Build Coastguard Workerfunc boolPtr(v bool) *bool {
695*333d2b36SAndroid Build Coastguard Worker	return &v
696*333d2b36SAndroid Build Coastguard Worker}
697*333d2b36SAndroid Build Coastguard Worker
698*333d2b36SAndroid Build Coastguard Workerfunc intPtr(v int) *int {
699*333d2b36SAndroid Build Coastguard Worker	return &v
700*333d2b36SAndroid Build Coastguard Worker}
701*333d2b36SAndroid Build Coastguard Worker
702*333d2b36SAndroid Build Coastguard Workerfunc stringPtr(v string) *string {
703*333d2b36SAndroid Build Coastguard Worker	return &v
704*333d2b36SAndroid Build Coastguard Worker}
705*333d2b36SAndroid Build Coastguard Worker
706*333d2b36SAndroid Build Coastguard Workerfunc (v *ProductVariables) SetDefaultConfig() {
707*333d2b36SAndroid Build Coastguard Worker	*v = ProductVariables{
708*333d2b36SAndroid Build Coastguard Worker		BuildNumberFile: stringPtr("build_number.txt"),
709*333d2b36SAndroid Build Coastguard Worker
710*333d2b36SAndroid Build Coastguard Worker		Platform_version_name:                  stringPtr("S"),
711*333d2b36SAndroid Build Coastguard Worker		Platform_base_sdk_extension_version:    intPtr(30),
712*333d2b36SAndroid Build Coastguard Worker		Platform_sdk_version:                   intPtr(30),
713*333d2b36SAndroid Build Coastguard Worker		Platform_sdk_codename:                  stringPtr("S"),
714*333d2b36SAndroid Build Coastguard Worker		Platform_sdk_final:                     boolPtr(false),
715*333d2b36SAndroid Build Coastguard Worker		Platform_version_active_codenames:      []string{"S"},
716*333d2b36SAndroid Build Coastguard Worker		Platform_version_all_preview_codenames: []string{"S"},
717*333d2b36SAndroid Build Coastguard Worker
718*333d2b36SAndroid Build Coastguard Worker		HostArch:                    stringPtr("x86_64"),
719*333d2b36SAndroid Build Coastguard Worker		HostSecondaryArch:           stringPtr("x86"),
720*333d2b36SAndroid Build Coastguard Worker		DeviceName:                  stringPtr("generic_arm64"),
721*333d2b36SAndroid Build Coastguard Worker		DeviceProduct:               stringPtr("aosp_arm-eng"),
722*333d2b36SAndroid Build Coastguard Worker		DeviceArch:                  stringPtr("arm64"),
723*333d2b36SAndroid Build Coastguard Worker		DeviceArchVariant:           stringPtr("armv8-a"),
724*333d2b36SAndroid Build Coastguard Worker		DeviceCpuVariant:            stringPtr("generic"),
725*333d2b36SAndroid Build Coastguard Worker		DeviceAbi:                   []string{"arm64-v8a"},
726*333d2b36SAndroid Build Coastguard Worker		DeviceSecondaryArch:         stringPtr("arm"),
727*333d2b36SAndroid Build Coastguard Worker		DeviceSecondaryArchVariant:  stringPtr("armv8-a"),
728*333d2b36SAndroid Build Coastguard Worker		DeviceSecondaryCpuVariant:   stringPtr("generic"),
729*333d2b36SAndroid Build Coastguard Worker		DeviceSecondaryAbi:          []string{"armeabi-v7a", "armeabi"},
730*333d2b36SAndroid Build Coastguard Worker		DeviceMaxPageSizeSupported:  stringPtr("4096"),
731*333d2b36SAndroid Build Coastguard Worker		DeviceNoBionicPageSizeMacro: boolPtr(false),
732*333d2b36SAndroid Build Coastguard Worker
733*333d2b36SAndroid Build Coastguard Worker		AAPTConfig:          []string{"normal", "large", "xlarge", "hdpi", "xhdpi", "xxhdpi"},
734*333d2b36SAndroid Build Coastguard Worker		AAPTPreferredConfig: stringPtr("xhdpi"),
735*333d2b36SAndroid Build Coastguard Worker		AAPTCharacteristics: stringPtr("nosdcard"),
736*333d2b36SAndroid Build Coastguard Worker		AAPTPrebuiltDPI:     []string{"xhdpi", "xxhdpi"},
737*333d2b36SAndroid Build Coastguard Worker
738*333d2b36SAndroid Build Coastguard Worker		Malloc_low_memory:            boolPtr(false),
739*333d2b36SAndroid Build Coastguard Worker		Malloc_zero_contents:         boolPtr(true),
740*333d2b36SAndroid Build Coastguard Worker		Malloc_pattern_fill_contents: boolPtr(false),
741*333d2b36SAndroid Build Coastguard Worker		Safestack:                    boolPtr(false),
742*333d2b36SAndroid Build Coastguard Worker		Build_from_text_stub:         boolPtr(false),
743*333d2b36SAndroid Build Coastguard Worker
744*333d2b36SAndroid Build Coastguard Worker		BootJars:     ConfiguredJarList{apexes: []string{}, jars: []string{}},
745*333d2b36SAndroid Build Coastguard Worker		ApexBootJars: ConfiguredJarList{apexes: []string{}, jars: []string{}},
746*333d2b36SAndroid Build Coastguard Worker	}
747*333d2b36SAndroid Build Coastguard Worker
748*333d2b36SAndroid Build Coastguard Worker	if runtime.GOOS == "linux" {
749*333d2b36SAndroid Build Coastguard Worker		v.CrossHost = stringPtr("windows")
750*333d2b36SAndroid Build Coastguard Worker		v.CrossHostArch = stringPtr("x86")
751*333d2b36SAndroid Build Coastguard Worker		v.CrossHostSecondaryArch = stringPtr("x86_64")
752*333d2b36SAndroid Build Coastguard Worker	}
753*333d2b36SAndroid Build Coastguard Worker}
754*333d2b36SAndroid Build Coastguard Worker
755*333d2b36SAndroid Build Coastguard Workerfunc (this *ProductVariables) GetBuildFlagBool(flag string) bool {
756*333d2b36SAndroid Build Coastguard Worker	val, ok := this.BuildFlags[flag]
757*333d2b36SAndroid Build Coastguard Worker	if !ok {
758*333d2b36SAndroid Build Coastguard Worker		return false
759*333d2b36SAndroid Build Coastguard Worker	}
760*333d2b36SAndroid Build Coastguard Worker	return val == "true"
761*333d2b36SAndroid Build Coastguard Worker}
762*333d2b36SAndroid Build Coastguard Worker
763*333d2b36SAndroid Build Coastguard Workerfunc VariableMutator(mctx BottomUpMutatorContext) {
764*333d2b36SAndroid Build Coastguard Worker	var module Module
765*333d2b36SAndroid Build Coastguard Worker	var ok bool
766*333d2b36SAndroid Build Coastguard Worker	if module, ok = mctx.Module().(Module); !ok {
767*333d2b36SAndroid Build Coastguard Worker		return
768*333d2b36SAndroid Build Coastguard Worker	}
769*333d2b36SAndroid Build Coastguard Worker
770*333d2b36SAndroid Build Coastguard Worker	// TODO: depend on config variable, create variants, propagate variants up tree
771*333d2b36SAndroid Build Coastguard Worker	a := module.base()
772*333d2b36SAndroid Build Coastguard Worker
773*333d2b36SAndroid Build Coastguard Worker	if a.variableProperties == nil {
774*333d2b36SAndroid Build Coastguard Worker		return
775*333d2b36SAndroid Build Coastguard Worker	}
776*333d2b36SAndroid Build Coastguard Worker
777*333d2b36SAndroid Build Coastguard Worker	variableValues := reflect.ValueOf(a.variableProperties).Elem().FieldByName("Product_variables")
778*333d2b36SAndroid Build Coastguard Worker
779*333d2b36SAndroid Build Coastguard Worker	productVariables := reflect.ValueOf(mctx.Config().productVariables)
780*333d2b36SAndroid Build Coastguard Worker
781*333d2b36SAndroid Build Coastguard Worker	for i := 0; i < variableValues.NumField(); i++ {
782*333d2b36SAndroid Build Coastguard Worker		variableValue := variableValues.Field(i)
783*333d2b36SAndroid Build Coastguard Worker		name := variableValues.Type().Field(i).Name
784*333d2b36SAndroid Build Coastguard Worker		property := "product_variables." + proptools.PropertyNameForField(name)
785*333d2b36SAndroid Build Coastguard Worker
786*333d2b36SAndroid Build Coastguard Worker		// Check that the variable was set for the product
787*333d2b36SAndroid Build Coastguard Worker		val := productVariables.FieldByName(name)
788*333d2b36SAndroid Build Coastguard Worker		if !val.IsValid() || val.Kind() != reflect.Ptr || val.IsNil() {
789*333d2b36SAndroid Build Coastguard Worker			continue
790*333d2b36SAndroid Build Coastguard Worker		}
791*333d2b36SAndroid Build Coastguard Worker
792*333d2b36SAndroid Build Coastguard Worker		val = val.Elem()
793*333d2b36SAndroid Build Coastguard Worker
794*333d2b36SAndroid Build Coastguard Worker		// For bools, check that the value is true
795*333d2b36SAndroid Build Coastguard Worker		if val.Kind() == reflect.Bool && val.Bool() == false {
796*333d2b36SAndroid Build Coastguard Worker			continue
797*333d2b36SAndroid Build Coastguard Worker		}
798*333d2b36SAndroid Build Coastguard Worker
799*333d2b36SAndroid Build Coastguard Worker		// Check if any properties were set for the module
800*333d2b36SAndroid Build Coastguard Worker		if variableValue.IsZero() {
801*333d2b36SAndroid Build Coastguard Worker			continue
802*333d2b36SAndroid Build Coastguard Worker		}
803*333d2b36SAndroid Build Coastguard Worker		a.setVariableProperties(mctx, property, variableValue, val.Interface())
804*333d2b36SAndroid Build Coastguard Worker	}
805*333d2b36SAndroid Build Coastguard Worker}
806*333d2b36SAndroid Build Coastguard Worker
807*333d2b36SAndroid Build Coastguard Workerfunc (m *ModuleBase) setVariableProperties(ctx BottomUpMutatorContext,
808*333d2b36SAndroid Build Coastguard Worker	prefix string, productVariablePropertyValue reflect.Value, variableValue interface{}) {
809*333d2b36SAndroid Build Coastguard Worker
810*333d2b36SAndroid Build Coastguard Worker	printfIntoProperties(ctx, prefix, productVariablePropertyValue, variableValue)
811*333d2b36SAndroid Build Coastguard Worker
812*333d2b36SAndroid Build Coastguard Worker	err := proptools.AppendMatchingProperties(m.GetProperties(),
813*333d2b36SAndroid Build Coastguard Worker		productVariablePropertyValue.Addr().Interface(), nil)
814*333d2b36SAndroid Build Coastguard Worker	if err != nil {
815*333d2b36SAndroid Build Coastguard Worker		if propertyErr, ok := err.(*proptools.ExtendPropertyError); ok {
816*333d2b36SAndroid Build Coastguard Worker			ctx.PropertyErrorf(propertyErr.Property, "%s", propertyErr.Err.Error())
817*333d2b36SAndroid Build Coastguard Worker		} else {
818*333d2b36SAndroid Build Coastguard Worker			panic(err)
819*333d2b36SAndroid Build Coastguard Worker		}
820*333d2b36SAndroid Build Coastguard Worker	}
821*333d2b36SAndroid Build Coastguard Worker}
822*333d2b36SAndroid Build Coastguard Worker
823*333d2b36SAndroid Build Coastguard Workerfunc printfIntoPropertiesError(ctx BottomUpMutatorContext, prefix string,
824*333d2b36SAndroid Build Coastguard Worker	productVariablePropertyValue reflect.Value, i int, err error) {
825*333d2b36SAndroid Build Coastguard Worker
826*333d2b36SAndroid Build Coastguard Worker	field := productVariablePropertyValue.Type().Field(i).Name
827*333d2b36SAndroid Build Coastguard Worker	property := prefix + "." + proptools.PropertyNameForField(field)
828*333d2b36SAndroid Build Coastguard Worker	ctx.PropertyErrorf(property, "%s", err)
829*333d2b36SAndroid Build Coastguard Worker}
830*333d2b36SAndroid Build Coastguard Worker
831*333d2b36SAndroid Build Coastguard Workerfunc printfIntoProperties(ctx BottomUpMutatorContext, prefix string,
832*333d2b36SAndroid Build Coastguard Worker	productVariablePropertyValue reflect.Value, variableValue interface{}) {
833*333d2b36SAndroid Build Coastguard Worker
834*333d2b36SAndroid Build Coastguard Worker	for i := 0; i < productVariablePropertyValue.NumField(); i++ {
835*333d2b36SAndroid Build Coastguard Worker		propertyValue := productVariablePropertyValue.Field(i)
836*333d2b36SAndroid Build Coastguard Worker		kind := propertyValue.Kind()
837*333d2b36SAndroid Build Coastguard Worker		if kind == reflect.Ptr {
838*333d2b36SAndroid Build Coastguard Worker			if propertyValue.IsNil() {
839*333d2b36SAndroid Build Coastguard Worker				continue
840*333d2b36SAndroid Build Coastguard Worker			}
841*333d2b36SAndroid Build Coastguard Worker			propertyValue = propertyValue.Elem()
842*333d2b36SAndroid Build Coastguard Worker		}
843*333d2b36SAndroid Build Coastguard Worker		switch propertyValue.Kind() {
844*333d2b36SAndroid Build Coastguard Worker		case reflect.String:
845*333d2b36SAndroid Build Coastguard Worker			err := printfIntoProperty(propertyValue, variableValue)
846*333d2b36SAndroid Build Coastguard Worker			if err != nil {
847*333d2b36SAndroid Build Coastguard Worker				printfIntoPropertiesError(ctx, prefix, productVariablePropertyValue, i, err)
848*333d2b36SAndroid Build Coastguard Worker			}
849*333d2b36SAndroid Build Coastguard Worker		case reflect.Slice:
850*333d2b36SAndroid Build Coastguard Worker			for j := 0; j < propertyValue.Len(); j++ {
851*333d2b36SAndroid Build Coastguard Worker				err := printfIntoProperty(propertyValue.Index(j), variableValue)
852*333d2b36SAndroid Build Coastguard Worker				if err != nil {
853*333d2b36SAndroid Build Coastguard Worker					printfIntoPropertiesError(ctx, prefix, productVariablePropertyValue, i, err)
854*333d2b36SAndroid Build Coastguard Worker				}
855*333d2b36SAndroid Build Coastguard Worker			}
856*333d2b36SAndroid Build Coastguard Worker		case reflect.Bool:
857*333d2b36SAndroid Build Coastguard Worker			// Nothing
858*333d2b36SAndroid Build Coastguard Worker		case reflect.Struct:
859*333d2b36SAndroid Build Coastguard Worker			printfIntoProperties(ctx, prefix, propertyValue, variableValue)
860*333d2b36SAndroid Build Coastguard Worker		default:
861*333d2b36SAndroid Build Coastguard Worker			panic(fmt.Errorf("unsupported field kind %q", propertyValue.Kind()))
862*333d2b36SAndroid Build Coastguard Worker		}
863*333d2b36SAndroid Build Coastguard Worker	}
864*333d2b36SAndroid Build Coastguard Worker}
865*333d2b36SAndroid Build Coastguard Worker
866*333d2b36SAndroid Build Coastguard Workerfunc printfIntoProperty(propertyValue reflect.Value, variableValue interface{}) error {
867*333d2b36SAndroid Build Coastguard Worker	s := propertyValue.String()
868*333d2b36SAndroid Build Coastguard Worker
869*333d2b36SAndroid Build Coastguard Worker	count := strings.Count(s, "%")
870*333d2b36SAndroid Build Coastguard Worker	if count == 0 {
871*333d2b36SAndroid Build Coastguard Worker		return nil
872*333d2b36SAndroid Build Coastguard Worker	}
873*333d2b36SAndroid Build Coastguard Worker
874*333d2b36SAndroid Build Coastguard Worker	if count > 1 {
875*333d2b36SAndroid Build Coastguard Worker		return fmt.Errorf("product variable properties only support a single '%%'")
876*333d2b36SAndroid Build Coastguard Worker	}
877*333d2b36SAndroid Build Coastguard Worker
878*333d2b36SAndroid Build Coastguard Worker	if strings.Contains(s, "%d") {
879*333d2b36SAndroid Build Coastguard Worker		switch v := variableValue.(type) {
880*333d2b36SAndroid Build Coastguard Worker		case int:
881*333d2b36SAndroid Build Coastguard Worker			// Nothing
882*333d2b36SAndroid Build Coastguard Worker		case bool:
883*333d2b36SAndroid Build Coastguard Worker			if v {
884*333d2b36SAndroid Build Coastguard Worker				variableValue = 1
885*333d2b36SAndroid Build Coastguard Worker			} else {
886*333d2b36SAndroid Build Coastguard Worker				variableValue = 0
887*333d2b36SAndroid Build Coastguard Worker			}
888*333d2b36SAndroid Build Coastguard Worker		default:
889*333d2b36SAndroid Build Coastguard Worker			return fmt.Errorf("unsupported type %T for %%d", variableValue)
890*333d2b36SAndroid Build Coastguard Worker		}
891*333d2b36SAndroid Build Coastguard Worker	} else if strings.Contains(s, "%s") {
892*333d2b36SAndroid Build Coastguard Worker		switch variableValue.(type) {
893*333d2b36SAndroid Build Coastguard Worker		case string:
894*333d2b36SAndroid Build Coastguard Worker			// Nothing
895*333d2b36SAndroid Build Coastguard Worker		default:
896*333d2b36SAndroid Build Coastguard Worker			return fmt.Errorf("unsupported type %T for %%s", variableValue)
897*333d2b36SAndroid Build Coastguard Worker		}
898*333d2b36SAndroid Build Coastguard Worker	} else {
899*333d2b36SAndroid Build Coastguard Worker		return fmt.Errorf("unsupported %% in product variable property")
900*333d2b36SAndroid Build Coastguard Worker	}
901*333d2b36SAndroid Build Coastguard Worker
902*333d2b36SAndroid Build Coastguard Worker	propertyValue.Set(reflect.ValueOf(fmt.Sprintf(s, variableValue)))
903*333d2b36SAndroid Build Coastguard Worker
904*333d2b36SAndroid Build Coastguard Worker	return nil
905*333d2b36SAndroid Build Coastguard Worker}
906*333d2b36SAndroid Build Coastguard Worker
907*333d2b36SAndroid Build Coastguard Workervar variablePropTypeMap OncePer
908*333d2b36SAndroid Build Coastguard Worker
909*333d2b36SAndroid Build Coastguard Worker// sliceToTypeArray takes a slice of property structs and returns a reflection created array containing the
910*333d2b36SAndroid Build Coastguard Worker// reflect.Types of each property struct.  The result can be used as a key in a map.
911*333d2b36SAndroid Build Coastguard Workerfunc sliceToTypeArray(s []interface{}) interface{} {
912*333d2b36SAndroid Build Coastguard Worker	// Create an array using reflection whose length is the length of the input slice
913*333d2b36SAndroid Build Coastguard Worker	ret := reflect.New(reflect.ArrayOf(len(s), reflect.TypeOf(reflect.TypeOf(0)))).Elem()
914*333d2b36SAndroid Build Coastguard Worker	for i, e := range s {
915*333d2b36SAndroid Build Coastguard Worker		ret.Index(i).Set(reflect.ValueOf(reflect.TypeOf(e)))
916*333d2b36SAndroid Build Coastguard Worker	}
917*333d2b36SAndroid Build Coastguard Worker	return ret.Interface()
918*333d2b36SAndroid Build Coastguard Worker}
919*333d2b36SAndroid Build Coastguard Worker
920*333d2b36SAndroid Build Coastguard Workerfunc initProductVariableModule(m Module) {
921*333d2b36SAndroid Build Coastguard Worker	base := m.base()
922*333d2b36SAndroid Build Coastguard Worker
923*333d2b36SAndroid Build Coastguard Worker	// Allow tests to override the default product variables
924*333d2b36SAndroid Build Coastguard Worker	if base.variableProperties == nil {
925*333d2b36SAndroid Build Coastguard Worker		base.variableProperties = defaultProductVariables
926*333d2b36SAndroid Build Coastguard Worker	}
927*333d2b36SAndroid Build Coastguard Worker	// Filter the product variables properties to the ones that exist on this module
928*333d2b36SAndroid Build Coastguard Worker	base.variableProperties = createVariableProperties(m.GetProperties(), base.variableProperties)
929*333d2b36SAndroid Build Coastguard Worker	if base.variableProperties != nil {
930*333d2b36SAndroid Build Coastguard Worker		m.AddProperties(base.variableProperties)
931*333d2b36SAndroid Build Coastguard Worker	}
932*333d2b36SAndroid Build Coastguard Worker}
933*333d2b36SAndroid Build Coastguard Worker
934*333d2b36SAndroid Build Coastguard Worker// createVariableProperties takes the list of property structs for a module and returns a property struct that
935*333d2b36SAndroid Build Coastguard Worker// contains the product variable properties that exist in the property structs, or nil if there are none.  It
936*333d2b36SAndroid Build Coastguard Worker// caches the result.
937*333d2b36SAndroid Build Coastguard Workerfunc createVariableProperties(moduleTypeProps []interface{}, productVariables interface{}) interface{} {
938*333d2b36SAndroid Build Coastguard Worker	// Convert the moduleTypeProps to an array of reflect.Types that can be used as a key in the OncePer.
939*333d2b36SAndroid Build Coastguard Worker	key := sliceToTypeArray(moduleTypeProps)
940*333d2b36SAndroid Build Coastguard Worker
941*333d2b36SAndroid Build Coastguard Worker	// Use the variablePropTypeMap OncePer to cache the result for each set of property struct types.
942*333d2b36SAndroid Build Coastguard Worker	typ, _ := variablePropTypeMap.Once(NewCustomOnceKey(key), func() interface{} {
943*333d2b36SAndroid Build Coastguard Worker		// Compute the filtered property struct type.
944*333d2b36SAndroid Build Coastguard Worker		return createVariablePropertiesType(moduleTypeProps, productVariables)
945*333d2b36SAndroid Build Coastguard Worker	}).(reflect.Type)
946*333d2b36SAndroid Build Coastguard Worker
947*333d2b36SAndroid Build Coastguard Worker	if typ == nil {
948*333d2b36SAndroid Build Coastguard Worker		return nil
949*333d2b36SAndroid Build Coastguard Worker	}
950*333d2b36SAndroid Build Coastguard Worker
951*333d2b36SAndroid Build Coastguard Worker	// Create a new pointer to a filtered property struct.
952*333d2b36SAndroid Build Coastguard Worker	return reflect.New(typ).Interface()
953*333d2b36SAndroid Build Coastguard Worker}
954*333d2b36SAndroid Build Coastguard Worker
955*333d2b36SAndroid Build Coastguard Worker// createVariablePropertiesType creates a new type that contains only the product variable properties that exist in
956*333d2b36SAndroid Build Coastguard Worker// a list of property structs.
957*333d2b36SAndroid Build Coastguard Workerfunc createVariablePropertiesType(moduleTypeProps []interface{}, productVariables interface{}) reflect.Type {
958*333d2b36SAndroid Build Coastguard Worker	typ, _ := proptools.FilterPropertyStruct(reflect.TypeOf(productVariables),
959*333d2b36SAndroid Build Coastguard Worker		func(field reflect.StructField, prefix string) (bool, reflect.StructField) {
960*333d2b36SAndroid Build Coastguard Worker			// Filter function, returns true if the field should be in the resulting struct
961*333d2b36SAndroid Build Coastguard Worker			if prefix == "" {
962*333d2b36SAndroid Build Coastguard Worker				// Keep the top level Product_variables field
963*333d2b36SAndroid Build Coastguard Worker				return true, field
964*333d2b36SAndroid Build Coastguard Worker			}
965*333d2b36SAndroid Build Coastguard Worker			_, rest := splitPrefix(prefix)
966*333d2b36SAndroid Build Coastguard Worker			if rest == "" {
967*333d2b36SAndroid Build Coastguard Worker				// Keep the 2nd level field (i.e. Product_variables.Eng)
968*333d2b36SAndroid Build Coastguard Worker				return true, field
969*333d2b36SAndroid Build Coastguard Worker			}
970*333d2b36SAndroid Build Coastguard Worker
971*333d2b36SAndroid Build Coastguard Worker			// Strip off the first 2 levels of the prefix
972*333d2b36SAndroid Build Coastguard Worker			_, prefix = splitPrefix(rest)
973*333d2b36SAndroid Build Coastguard Worker
974*333d2b36SAndroid Build Coastguard Worker			for _, p := range moduleTypeProps {
975*333d2b36SAndroid Build Coastguard Worker				if fieldExistsByNameRecursive(reflect.TypeOf(p).Elem(), prefix, field.Name) {
976*333d2b36SAndroid Build Coastguard Worker					// Keep any fields that exist in one of the property structs
977*333d2b36SAndroid Build Coastguard Worker					return true, field
978*333d2b36SAndroid Build Coastguard Worker				}
979*333d2b36SAndroid Build Coastguard Worker			}
980*333d2b36SAndroid Build Coastguard Worker
981*333d2b36SAndroid Build Coastguard Worker			return false, field
982*333d2b36SAndroid Build Coastguard Worker		})
983*333d2b36SAndroid Build Coastguard Worker	return typ
984*333d2b36SAndroid Build Coastguard Worker}
985*333d2b36SAndroid Build Coastguard Worker
986*333d2b36SAndroid Build Coastguard Workerfunc splitPrefix(prefix string) (first, rest string) {
987*333d2b36SAndroid Build Coastguard Worker	index := strings.IndexByte(prefix, '.')
988*333d2b36SAndroid Build Coastguard Worker	if index == -1 {
989*333d2b36SAndroid Build Coastguard Worker		return prefix, ""
990*333d2b36SAndroid Build Coastguard Worker	}
991*333d2b36SAndroid Build Coastguard Worker	return prefix[:index], prefix[index+1:]
992*333d2b36SAndroid Build Coastguard Worker}
993*333d2b36SAndroid Build Coastguard Worker
994*333d2b36SAndroid Build Coastguard Workerfunc fieldExistsByNameRecursive(t reflect.Type, prefix, name string) bool {
995*333d2b36SAndroid Build Coastguard Worker	if t.Kind() != reflect.Struct {
996*333d2b36SAndroid Build Coastguard Worker		panic(fmt.Errorf("fieldExistsByNameRecursive can only be called on a reflect.Struct"))
997*333d2b36SAndroid Build Coastguard Worker	}
998*333d2b36SAndroid Build Coastguard Worker
999*333d2b36SAndroid Build Coastguard Worker	if prefix != "" {
1000*333d2b36SAndroid Build Coastguard Worker		split := strings.SplitN(prefix, ".", 2)
1001*333d2b36SAndroid Build Coastguard Worker		firstPrefix := split[0]
1002*333d2b36SAndroid Build Coastguard Worker		rest := ""
1003*333d2b36SAndroid Build Coastguard Worker		if len(split) > 1 {
1004*333d2b36SAndroid Build Coastguard Worker			rest = split[1]
1005*333d2b36SAndroid Build Coastguard Worker		}
1006*333d2b36SAndroid Build Coastguard Worker		f, exists := t.FieldByName(firstPrefix)
1007*333d2b36SAndroid Build Coastguard Worker		if !exists {
1008*333d2b36SAndroid Build Coastguard Worker			return false
1009*333d2b36SAndroid Build Coastguard Worker		}
1010*333d2b36SAndroid Build Coastguard Worker		ft := f.Type
1011*333d2b36SAndroid Build Coastguard Worker		if ft.Kind() == reflect.Ptr {
1012*333d2b36SAndroid Build Coastguard Worker			ft = ft.Elem()
1013*333d2b36SAndroid Build Coastguard Worker		}
1014*333d2b36SAndroid Build Coastguard Worker		if ft.Kind() != reflect.Struct {
1015*333d2b36SAndroid Build Coastguard Worker			panic(fmt.Errorf("field %q in %q is not a struct", firstPrefix, t))
1016*333d2b36SAndroid Build Coastguard Worker		}
1017*333d2b36SAndroid Build Coastguard Worker		return fieldExistsByNameRecursive(ft, rest, name)
1018*333d2b36SAndroid Build Coastguard Worker	} else {
1019*333d2b36SAndroid Build Coastguard Worker		_, exists := t.FieldByName(name)
1020*333d2b36SAndroid Build Coastguard Worker		return exists
1021*333d2b36SAndroid Build Coastguard Worker	}
1022*333d2b36SAndroid Build Coastguard Worker}
1023