blob: ec0edfd73adc7d30d1475e609fe8174cdcb463b0 [file] [log] [blame]
Colin Cross9d34f352019-11-22 16:03:51 -08001// Copyright 2019 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
15package android
16
17// This file provides module types that implement wrapper module types that add conditionals on
18// Soong config variables.
19
20import (
21 "fmt"
22 "path/filepath"
Paul Duffine8b47682023-01-09 15:42:57 +000023 "reflect"
Colin Cross9d34f352019-11-22 16:03:51 -080024 "strings"
Paul Duffine8b47682023-01-09 15:42:57 +000025 "sync"
Colin Cross9d34f352019-11-22 16:03:51 -080026 "text/scanner"
27
28 "github.com/google/blueprint"
29 "github.com/google/blueprint/parser"
30 "github.com/google/blueprint/proptools"
31
32 "android/soong/android/soongconfig"
33)
34
35func init() {
Paul Duffin32299982023-01-09 14:02:06 +000036 RegisterSoongConfigModuleBuildComponents(InitRegistrationContext)
Colin Cross9d34f352019-11-22 16:03:51 -080037}
38
Paul Duffin32299982023-01-09 14:02:06 +000039func RegisterSoongConfigModuleBuildComponents(ctx RegistrationContext) {
40 ctx.RegisterModuleType("soong_config_module_type_import", SoongConfigModuleTypeImportFactory)
41 ctx.RegisterModuleType("soong_config_module_type", SoongConfigModuleTypeFactory)
42 ctx.RegisterModuleType("soong_config_string_variable", SoongConfigStringVariableDummyFactory)
43 ctx.RegisterModuleType("soong_config_bool_variable", SoongConfigBoolVariableDummyFactory)
44}
45
46var PrepareForTestWithSoongConfigModuleBuildComponents = FixtureRegisterWithContext(RegisterSoongConfigModuleBuildComponents)
47
Colin Cross9d34f352019-11-22 16:03:51 -080048type soongConfigModuleTypeImport struct {
49 ModuleBase
50 properties soongConfigModuleTypeImportProperties
51}
52
53type soongConfigModuleTypeImportProperties struct {
54 From string
55 Module_types []string
56}
57
58// soong_config_module_type_import imports module types with conditionals on Soong config
59// variables from another Android.bp file. The imported module type will exist for all
60// modules after the import in the Android.bp file.
61//
Liz Kammer432bd592020-12-16 12:42:02 -080062// Each soong_config_variable supports an additional value `conditions_default`. The properties
63// specified in `conditions_default` will only be used under the following conditions:
64// bool variable: the variable is unspecified or not set to a true value
65// value variable: the variable is unspecified
66// string variable: the variable is unspecified or the variable is set to a string unused in the
67// given module. For example, string variable `test` takes values: "a" and "b",
68// if the module contains a property `a` and `conditions_default`, when test=b,
69// the properties under `conditions_default` will be used. To specify that no
70// properties should be amended for `b`, you can set `b: {},`.
71//
Colin Cross9d34f352019-11-22 16:03:51 -080072// For example, an Android.bp file could have:
73//
74// soong_config_module_type_import {
Bill Peckhamc93258b2020-02-04 13:17:24 -080075// from: "device/acme/Android.bp",
Colin Cross9d34f352019-11-22 16:03:51 -080076// module_types: ["acme_cc_defaults"],
77// }
78//
79// acme_cc_defaults {
80// name: "acme_defaults",
81// cflags: ["-DGENERIC"],
82// soong_config_variables: {
83// board: {
84// soc_a: {
85// cflags: ["-DSOC_A"],
86// },
87// soc_b: {
88// cflags: ["-DSOC_B"],
89// },
Liz Kammer432bd592020-12-16 12:42:02 -080090// conditions_default: {
91// cflags: ["-DSOC_DEFAULT"],
92// },
Colin Cross9d34f352019-11-22 16:03:51 -080093// },
94// feature: {
95// cflags: ["-DFEATURE"],
Liz Kammer432bd592020-12-16 12:42:02 -080096// conditions_default: {
97// cflags: ["-DFEATURE_DEFAULT"],
98// },
Colin Cross9d34f352019-11-22 16:03:51 -080099// },
Dan Willemsenb0935db2020-03-23 19:42:18 -0700100// width: {
101// cflags: ["-DWIDTH=%s"],
Liz Kammer432bd592020-12-16 12:42:02 -0800102// conditions_default: {
103// cflags: ["-DWIDTH=DEFAULT"],
104// },
Dan Willemsenb0935db2020-03-23 19:42:18 -0700105// },
Colin Cross9d34f352019-11-22 16:03:51 -0800106// },
107// }
108//
109// cc_library {
110// name: "libacme_foo",
111// defaults: ["acme_defaults"],
112// srcs: ["*.cpp"],
113// }
114//
115// And device/acme/Android.bp could have:
116//
117// soong_config_module_type {
118// name: "acme_cc_defaults",
119// module_type: "cc_defaults",
120// config_namespace: "acme",
Dan Willemsen2b8b89c2020-03-23 19:39:34 -0700121// variables: ["board"],
122// bool_variables: ["feature"],
Dan Willemsenb0935db2020-03-23 19:42:18 -0700123// value_variables: ["width"],
Colin Cross9d34f352019-11-22 16:03:51 -0800124// properties: ["cflags", "srcs"],
125// }
126//
127// soong_config_string_variable {
128// name: "board",
Liz Kammer432bd592020-12-16 12:42:02 -0800129// values: ["soc_a", "soc_b", "soc_c"],
Colin Cross9d34f352019-11-22 16:03:51 -0800130// }
131//
Colin Cross9d34f352019-11-22 16:03:51 -0800132// If an acme BoardConfig.mk file contained:
Sasha Smundak18fd0992021-08-24 14:05:19 -0700133// $(call add_sonng_config_namespace, acme)
134// $(call add_soong_config_var_value, acme, board, soc_a)
135// $(call add_soong_config_var_value, acme, feature, true)
136// $(call add_soong_config_var_value, acme, width, 200)
Colin Cross9d34f352019-11-22 16:03:51 -0800137//
Dan Willemsenb0935db2020-03-23 19:42:18 -0700138// Then libacme_foo would build with cflags "-DGENERIC -DSOC_A -DFEATURE -DWIDTH=200".
Liz Kammer432bd592020-12-16 12:42:02 -0800139//
140// Alternatively, if acme BoardConfig.mk file contained:
141//
142// SOONG_CONFIG_NAMESPACES += acme
143// SOONG_CONFIG_acme += \
144// board \
145// feature \
146//
147// SOONG_CONFIG_acme_feature := false
148//
149// Then libacme_foo would build with cflags:
150// "-DGENERIC -DSOC_DEFAULT -DFEATURE_DEFAULT -DSIZE=DEFAULT".
151//
152// Similarly, if acme BoardConfig.mk file contained:
153//
154// SOONG_CONFIG_NAMESPACES += acme
155// SOONG_CONFIG_acme += \
156// board \
157// feature \
158//
159// SOONG_CONFIG_acme_board := soc_c
160//
161// Then libacme_foo would build with cflags:
162// "-DGENERIC -DSOC_DEFAULT -DFEATURE_DEFAULT -DSIZE=DEFAULT".
163
Jingwen Chena47f28d2021-11-02 16:43:57 +0000164func SoongConfigModuleTypeImportFactory() Module {
Colin Cross9d34f352019-11-22 16:03:51 -0800165 module := &soongConfigModuleTypeImport{}
166
167 module.AddProperties(&module.properties)
168 AddLoadHook(module, func(ctx LoadHookContext) {
169 importModuleTypes(ctx, module.properties.From, module.properties.Module_types...)
170 })
171
172 initAndroidModuleBase(module)
173 return module
174}
175
176func (m *soongConfigModuleTypeImport) Name() string {
Sasha Smundak116ec922020-03-10 16:10:06 -0700177 // The generated name is non-deterministic, but it does not
178 // matter because this module does not emit any rules.
179 return soongconfig.CanonicalizeToProperty(m.properties.From) +
180 "soong_config_module_type_import_" + fmt.Sprintf("%p", m)
Colin Cross9d34f352019-11-22 16:03:51 -0800181}
182
Colin Crossa6389e92022-06-22 16:44:07 -0700183func (*soongConfigModuleTypeImport) Namespaceless() {}
Colin Cross9d34f352019-11-22 16:03:51 -0800184func (*soongConfigModuleTypeImport) GenerateAndroidBuildActions(ModuleContext) {}
185
186// Create dummy modules for soong_config_module_type and soong_config_*_variable
187
188type soongConfigModuleTypeModule struct {
189 ModuleBase
190 properties soongconfig.ModuleTypeProperties
191}
192
193// soong_config_module_type defines module types with conditionals on Soong config
Bill Peckhamc93258b2020-02-04 13:17:24 -0800194// variables. The new module type will exist for all modules after the definition
195// in an Android.bp file, and can be imported into other Android.bp files using
196// soong_config_module_type_import.
Colin Cross9d34f352019-11-22 16:03:51 -0800197//
Liz Kammer432bd592020-12-16 12:42:02 -0800198// Each soong_config_variable supports an additional value `conditions_default`. The properties
199// specified in `conditions_default` will only be used under the following conditions:
Colin Crossd079e0b2022-08-16 10:27:33 -0700200//
201// bool variable: the variable is unspecified or not set to a true value
202// value variable: the variable is unspecified
203// string variable: the variable is unspecified or the variable is set to a string unused in the
204// given module. For example, string variable `test` takes values: "a" and "b",
205// if the module contains a property `a` and `conditions_default`, when test=b,
206// the properties under `conditions_default` will be used. To specify that no
207// properties should be amended for `b`, you can set `b: {},`.
Liz Kammer432bd592020-12-16 12:42:02 -0800208//
Colin Cross9d34f352019-11-22 16:03:51 -0800209// For example, an Android.bp file could have:
210//
Colin Crossd079e0b2022-08-16 10:27:33 -0700211// soong_config_module_type {
212// name: "acme_cc_defaults",
213// module_type: "cc_defaults",
214// config_namespace: "acme",
215// variables: ["board"],
216// bool_variables: ["feature"],
217// value_variables: ["width"],
218// properties: ["cflags", "srcs"],
219// }
Colin Cross9d34f352019-11-22 16:03:51 -0800220//
Colin Crossd079e0b2022-08-16 10:27:33 -0700221// soong_config_string_variable {
222// name: "board",
223// values: ["soc_a", "soc_b"],
224// }
Colin Cross9d34f352019-11-22 16:03:51 -0800225//
Colin Crossd079e0b2022-08-16 10:27:33 -0700226// acme_cc_defaults {
227// name: "acme_defaults",
228// cflags: ["-DGENERIC"],
229// soong_config_variables: {
230// board: {
231// soc_a: {
232// cflags: ["-DSOC_A"],
233// },
234// soc_b: {
235// cflags: ["-DSOC_B"],
236// },
237// conditions_default: {
238// cflags: ["-DSOC_DEFAULT"],
239// },
240// },
241// feature: {
242// cflags: ["-DFEATURE"],
243// conditions_default: {
244// cflags: ["-DFEATURE_DEFAULT"],
245// },
246// },
247// width: {
248// cflags: ["-DWIDTH=%s"],
249// conditions_default: {
250// cflags: ["-DWIDTH=DEFAULT"],
251// },
252// },
253// },
254// }
Colin Cross9d34f352019-11-22 16:03:51 -0800255//
Colin Crossd079e0b2022-08-16 10:27:33 -0700256// cc_library {
257// name: "libacme_foo",
258// defaults: ["acme_defaults"],
259// srcs: ["*.cpp"],
260// }
Colin Cross9d34f352019-11-22 16:03:51 -0800261//
Colin Cross9d34f352019-11-22 16:03:51 -0800262// If an acme BoardConfig.mk file contained:
263//
Colin Crossd079e0b2022-08-16 10:27:33 -0700264// SOONG_CONFIG_NAMESPACES += acme
265// SOONG_CONFIG_acme += \
266// board \
267// feature \
Colin Cross9d34f352019-11-22 16:03:51 -0800268//
Colin Crossd079e0b2022-08-16 10:27:33 -0700269// SOONG_CONFIG_acme_board := soc_a
270// SOONG_CONFIG_acme_feature := true
271// SOONG_CONFIG_acme_width := 200
Colin Cross9d34f352019-11-22 16:03:51 -0800272//
273// Then libacme_foo would build with cflags "-DGENERIC -DSOC_A -DFEATURE".
Jingwen Chena47f28d2021-11-02 16:43:57 +0000274func SoongConfigModuleTypeFactory() Module {
Colin Cross9d34f352019-11-22 16:03:51 -0800275 module := &soongConfigModuleTypeModule{}
276
277 module.AddProperties(&module.properties)
278
279 AddLoadHook(module, func(ctx LoadHookContext) {
280 // A soong_config_module_type module should implicitly import itself.
281 importModuleTypes(ctx, ctx.BlueprintsFile(), module.properties.Name)
282 })
283
284 initAndroidModuleBase(module)
285
286 return module
287}
288
289func (m *soongConfigModuleTypeModule) Name() string {
Colin Crossa6389e92022-06-22 16:44:07 -0700290 return m.properties.Name + fmt.Sprintf("%p", m)
Colin Cross9d34f352019-11-22 16:03:51 -0800291}
Colin Crossa6389e92022-06-22 16:44:07 -0700292func (*soongConfigModuleTypeModule) Namespaceless() {}
Colin Cross9d34f352019-11-22 16:03:51 -0800293func (*soongConfigModuleTypeModule) GenerateAndroidBuildActions(ctx ModuleContext) {}
294
295type soongConfigStringVariableDummyModule struct {
296 ModuleBase
297 properties soongconfig.VariableProperties
298 stringProperties soongconfig.StringVariableProperties
299}
300
301type soongConfigBoolVariableDummyModule struct {
302 ModuleBase
303 properties soongconfig.VariableProperties
304}
305
306// soong_config_string_variable defines a variable and a set of possible string values for use
307// in a soong_config_module_type definition.
Jingwen Chena47f28d2021-11-02 16:43:57 +0000308func SoongConfigStringVariableDummyFactory() Module {
Colin Cross9d34f352019-11-22 16:03:51 -0800309 module := &soongConfigStringVariableDummyModule{}
310 module.AddProperties(&module.properties, &module.stringProperties)
311 initAndroidModuleBase(module)
312 return module
313}
314
315// soong_config_string_variable defines a variable with true or false values for use
316// in a soong_config_module_type definition.
Jingwen Chena47f28d2021-11-02 16:43:57 +0000317func SoongConfigBoolVariableDummyFactory() Module {
Colin Cross9d34f352019-11-22 16:03:51 -0800318 module := &soongConfigBoolVariableDummyModule{}
319 module.AddProperties(&module.properties)
320 initAndroidModuleBase(module)
321 return module
322}
323
324func (m *soongConfigStringVariableDummyModule) Name() string {
Colin Crossa6389e92022-06-22 16:44:07 -0700325 return m.properties.Name + fmt.Sprintf("%p", m)
Colin Cross9d34f352019-11-22 16:03:51 -0800326}
Colin Crossa6389e92022-06-22 16:44:07 -0700327func (*soongConfigStringVariableDummyModule) Namespaceless() {}
Colin Cross9d34f352019-11-22 16:03:51 -0800328func (*soongConfigStringVariableDummyModule) GenerateAndroidBuildActions(ctx ModuleContext) {}
329
330func (m *soongConfigBoolVariableDummyModule) Name() string {
Colin Crossa6389e92022-06-22 16:44:07 -0700331 return m.properties.Name + fmt.Sprintf("%p", m)
Colin Cross9d34f352019-11-22 16:03:51 -0800332}
Colin Crossa6389e92022-06-22 16:44:07 -0700333func (*soongConfigBoolVariableDummyModule) Namespaceless() {}
Colin Cross9d34f352019-11-22 16:03:51 -0800334func (*soongConfigBoolVariableDummyModule) GenerateAndroidBuildActions(ctx ModuleContext) {}
335
Jingwen Chena47f28d2021-11-02 16:43:57 +0000336// importModuleTypes registers the module factories for a list of module types defined
337// in an Android.bp file. These module factories are scoped for the current Android.bp
338// file only.
Colin Cross9d34f352019-11-22 16:03:51 -0800339func importModuleTypes(ctx LoadHookContext, from string, moduleTypes ...string) {
340 from = filepath.Clean(from)
341 if filepath.Ext(from) != ".bp" {
342 ctx.PropertyErrorf("from", "%q must be a file with extension .bp", from)
343 return
344 }
345
346 if strings.HasPrefix(from, "../") {
347 ctx.PropertyErrorf("from", "%q must not use ../ to escape the source tree",
348 from)
349 return
350 }
351
352 moduleTypeDefinitions := loadSoongConfigModuleTypeDefinition(ctx, from)
353 if moduleTypeDefinitions == nil {
354 return
355 }
356 for _, moduleType := range moduleTypes {
357 if factory, ok := moduleTypeDefinitions[moduleType]; ok {
358 ctx.registerScopedModuleType(moduleType, factory)
359 } else {
360 ctx.PropertyErrorf("module_types", "module type %q not defined in %q",
361 moduleType, from)
362 }
363 }
364}
365
366// loadSoongConfigModuleTypeDefinition loads module types from an Android.bp file. It caches the
367// result so each file is only parsed once.
368func loadSoongConfigModuleTypeDefinition(ctx LoadHookContext, from string) map[string]blueprint.ModuleFactory {
369 type onceKeyType string
370 key := NewCustomOnceKey(onceKeyType(filepath.Clean(from)))
371
372 reportErrors := func(ctx LoadHookContext, filename string, errs ...error) {
373 for _, err := range errs {
374 if parseErr, ok := err.(*parser.ParseError); ok {
375 ctx.Errorf(parseErr.Pos, "%s", parseErr.Err)
376 } else {
377 ctx.Errorf(scanner.Position{Filename: filename}, "%s", err)
378 }
379 }
380 }
381
382 return ctx.Config().Once(key, func() interface{} {
Colin Cross39e545c2020-02-05 16:26:19 -0800383 ctx.AddNinjaFileDeps(from)
Colin Cross9d34f352019-11-22 16:03:51 -0800384 r, err := ctx.Config().fs.Open(from)
385 if err != nil {
386 ctx.PropertyErrorf("from", "failed to open %q: %s", from, err)
387 return (map[string]blueprint.ModuleFactory)(nil)
388 }
Liz Kammer0fe123d2022-02-07 10:17:35 -0500389 defer r.Close()
Colin Cross9d34f352019-11-22 16:03:51 -0800390
391 mtDef, errs := soongconfig.Parse(r, from)
Colin Cross9d34f352019-11-22 16:03:51 -0800392 if len(errs) > 0 {
393 reportErrors(ctx, from, errs...)
394 return (map[string]blueprint.ModuleFactory)(nil)
395 }
396
397 globalModuleTypes := ctx.moduleFactories()
398
399 factories := make(map[string]blueprint.ModuleFactory)
400
401 for name, moduleType := range mtDef.ModuleTypes {
402 factory := globalModuleTypes[moduleType.BaseModuleType]
403 if factory != nil {
Colin Cross8ff10582023-12-07 13:10:56 -0800404 factories[name] = configModuleFactory(factory, moduleType)
Colin Cross9d34f352019-11-22 16:03:51 -0800405 } else {
406 reportErrors(ctx, from,
407 fmt.Errorf("missing global module type factory for %q", moduleType.BaseModuleType))
408 }
409 }
410
411 if ctx.Failed() {
412 return (map[string]blueprint.ModuleFactory)(nil)
413 }
414
415 return factories
416 }).(map[string]blueprint.ModuleFactory)
417}
418
Inseob Kim81b00a82023-05-15 18:06:31 +0900419// tracingConfig is a wrapper to soongconfig.SoongConfig which records all accesses to SoongConfig.
420type tracingConfig struct {
421 config soongconfig.SoongConfig
422 boolSet map[string]bool
423 stringSet map[string]string
424 isSetSet map[string]bool
425}
426
427func (c *tracingConfig) Bool(name string) bool {
428 c.boolSet[name] = c.config.Bool(name)
429 return c.boolSet[name]
430}
431
432func (c *tracingConfig) String(name string) string {
433 c.stringSet[name] = c.config.String(name)
434 return c.stringSet[name]
435}
436
437func (c *tracingConfig) IsSet(name string) bool {
438 c.isSetSet[name] = c.config.IsSet(name)
439 return c.isSetSet[name]
440}
441
442func (c *tracingConfig) getTrace() soongConfigTrace {
443 ret := soongConfigTrace{}
444
445 for k, v := range c.boolSet {
446 ret.Bools = append(ret.Bools, fmt.Sprintf("%q:%t", k, v))
447 }
448 for k, v := range c.stringSet {
449 ret.Strings = append(ret.Strings, fmt.Sprintf("%q:%q", k, v))
450 }
451 for k, v := range c.isSetSet {
452 ret.IsSets = append(ret.IsSets, fmt.Sprintf("%q:%t", k, v))
453 }
454
455 return ret
456}
457
458func newTracingConfig(config soongconfig.SoongConfig) *tracingConfig {
459 c := tracingConfig{
460 config: config,
461 boolSet: make(map[string]bool),
462 stringSet: make(map[string]string),
463 isSetSet: make(map[string]bool),
464 }
465 return &c
466}
467
468var _ soongconfig.SoongConfig = (*tracingConfig)(nil)
469
Jingwen Chena47f28d2021-11-02 16:43:57 +0000470// configModuleFactory takes an existing soongConfigModuleFactory and a
471// ModuleType to create a new ModuleFactory that uses a custom loadhook.
Colin Cross8ff10582023-12-07 13:10:56 -0800472func configModuleFactory(factory blueprint.ModuleFactory, moduleType *soongconfig.ModuleType) blueprint.ModuleFactory {
Paul Duffine8b47682023-01-09 15:42:57 +0000473 // Defer creation of conditional properties struct until the first call from the factory
474 // method. That avoids having to make a special call to the factory to create the properties
475 // structs from which the conditional properties struct is created. This is needed in order to
476 // allow singleton modules to be customized by soong_config_module_type as the
477 // SingletonModuleFactoryAdaptor factory registers a load hook for the singleton module
478 // everytime that it is called. Calling the factory twice causes a build failure as the load
479 // hook is called twice, the first time it updates the singleton module to indicate that it has
480 // been registered as a module, and the second time it fails because it thinks it has been
481 // registered again and a singleton module can only be registered once.
482 //
483 // This is an issue for singleton modules because:
484 // * Load hooks are registered on the module object and are only called when the module object
485 // is created by Blueprint while processing the Android.bp file.
486 // * The module factory for a singleton module returns the same module object each time it is
487 // called, and registers its load hook on that same module object.
488 // * When the module factory is called by Blueprint it then calls all the load hooks that have
489 // been registered for every call to that module factory.
490 //
491 // It is not an issue for normal modules because they return a new module object each time the
492 // factory is called and so any load hooks registered on module objects which are discarded will
493 // not be run.
494 once := &sync.Once{}
495 conditionalFactoryProps := reflect.Value{}
496 getConditionalFactoryProps := func(props []interface{}) reflect.Value {
497 once.Do(func() {
498 conditionalFactoryProps = soongconfig.CreateProperties(props, moduleType)
499 })
500 return conditionalFactoryProps
Jingwen Chena47f28d2021-11-02 16:43:57 +0000501 }
Colin Cross9d34f352019-11-22 16:03:51 -0800502
Jingwen Chena47f28d2021-11-02 16:43:57 +0000503 return func() (blueprint.Module, []interface{}) {
504 module, props := factory()
Paul Duffine8b47682023-01-09 15:42:57 +0000505 conditionalFactoryProps := getConditionalFactoryProps(props)
506 if !conditionalFactoryProps.IsValid() {
507 return module, props
508 }
509
Jingwen Chena47f28d2021-11-02 16:43:57 +0000510 conditionalProps := proptools.CloneEmptyProperties(conditionalFactoryProps)
511 props = append(props, conditionalProps.Interface())
Colin Cross9d34f352019-11-22 16:03:51 -0800512
Colin Cross8ff10582023-12-07 13:10:56 -0800513 // Regular Soong operation wraps the existing module factory with a
514 // conditional on Soong config variables by reading the product
515 // config variables from Make.
516 AddLoadHook(module, func(ctx LoadHookContext) {
517 tracingConfig := newTracingConfig(ctx.Config().VendorConfig(moduleType.ConfigNamespace))
518 newProps, err := soongconfig.PropertiesToApply(moduleType, conditionalProps, tracingConfig)
519 if err != nil {
520 ctx.ModuleErrorf("%s", err)
521 return
522 }
523 for _, ps := range newProps {
524 ctx.AppendProperties(ps)
525 }
Inseob Kim81b00a82023-05-15 18:06:31 +0900526
Colin Cross8ff10582023-12-07 13:10:56 -0800527 module.(Module).base().commonProperties.SoongConfigTrace = tracingConfig.getTrace()
528 })
Jingwen Chena47f28d2021-11-02 16:43:57 +0000529 return module, props
Colin Cross9d34f352019-11-22 16:03:51 -0800530 }
531}