Merge "Make prebuilt properties customizable" into sc-dev am: 85b5529c54

Original change: https://googleplex-android-review.googlesource.com/c/platform/build/soong/+/15095733

Change-Id: I21d3f33ecf131b3dd3eacbc32ec2200625507671
This commit is contained in:
TreeHugger Robot 2021-06-25 00:52:57 +00:00 committed by Automerger Merge Worker
commit 71a71d452e
2 changed files with 36 additions and 0 deletions

View File

@ -166,6 +166,7 @@ type PrebuiltSrcsSupplier func(ctx BaseModuleContext, prebuilt Module) []string
func InitPrebuiltModuleWithSrcSupplier(module PrebuiltInterface, srcsSupplier PrebuiltSrcsSupplier, srcsPropertyName string) {
p := module.Prebuilt()
module.AddProperties(&p.properties)
module.base().customizableProperties = module.GetProperties()
if srcsSupplier == nil {
panic(fmt.Errorf("srcsSupplier must not be nil"))

View File

@ -259,6 +259,38 @@ var prebuiltsTests = []struct {
}`,
prebuilt: []OsType{Android, BuildOs},
},
{
name: "prebuilt properties customizable",
replaceBp: true,
modules: `
source {
name: "foo",
deps: [":bar"],
}
soong_config_module_type {
name: "prebuilt_with_config",
module_type: "prebuilt",
config_namespace: "any_namespace",
bool_variables: ["bool_var"],
properties: ["prefer"],
}
prebuilt_with_config {
name: "bar",
prefer: true,
srcs: ["prebuilt_file"],
soong_config_variables: {
bool_var: {
prefer: false,
conditions_default: {
prefer: true,
},
},
},
}`,
prebuilt: []OsType{Android, BuildOs},
},
}
func TestPrebuilts(t *testing.T) {
@ -394,6 +426,9 @@ func registerTestPrebuiltModules(ctx RegistrationContext) {
ctx.RegisterModuleType("prebuilt", newPrebuiltModule)
ctx.RegisterModuleType("source", newSourceModule)
ctx.RegisterModuleType("override_source", newOverrideSourceModule)
ctx.RegisterModuleType("soong_config_module_type", soongConfigModuleTypeFactory)
ctx.RegisterModuleType("soong_config_string_variable", soongConfigStringVariableDummyFactory)
ctx.RegisterModuleType("soong_config_bool_variable", soongConfigBoolVariableDummyFactory)
}
type prebuiltModule struct {