Build product/odm build.prop with Soong
Bug: 322090587 Test: compare build.prop before and after, boot Change-Id: I7a7dc785030a0c17e5c09b7f65c978fe9bbcb7a7
This commit is contained in:
@@ -61,6 +61,8 @@ func (p *buildPropModule) propFiles(ctx ModuleContext) Paths {
|
||||
return ctx.Config().SystemPropFiles(ctx)
|
||||
} else if partition == "system_ext" {
|
||||
return ctx.Config().SystemExtPropFiles(ctx)
|
||||
} else if partition == "product" {
|
||||
return ctx.Config().ProductPropFiles(ctx)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@@ -80,6 +82,28 @@ func shouldAddBuildThumbprint(config Config) bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// Can't use PartitionTag() because PartitionTag() returns the partition this module is actually
|
||||
// installed (e.g. odm module's partition tag can be either "odm" or "vendor")
|
||||
func (p *buildPropModule) partition(config DeviceConfig) string {
|
||||
if p.SocSpecific() {
|
||||
return "vendor"
|
||||
} else if p.DeviceSpecific() {
|
||||
return "odm"
|
||||
} else if p.ProductSpecific() {
|
||||
return "product"
|
||||
} else if p.SystemExtSpecific() {
|
||||
return "system_ext"
|
||||
}
|
||||
return "system"
|
||||
}
|
||||
|
||||
var validPartitions = []string{
|
||||
"system",
|
||||
"system_ext",
|
||||
"product",
|
||||
"odm",
|
||||
}
|
||||
|
||||
func (p *buildPropModule) GenerateAndroidBuildActions(ctx ModuleContext) {
|
||||
p.outputFilePath = PathForModuleOut(ctx, "build.prop").OutputPath
|
||||
if !ctx.Config().KatiEnabled() {
|
||||
@@ -88,9 +112,9 @@ func (p *buildPropModule) GenerateAndroidBuildActions(ctx ModuleContext) {
|
||||
return
|
||||
}
|
||||
|
||||
partition := p.PartitionTag(ctx.DeviceConfig())
|
||||
if partition != "system" && partition != "system_ext" {
|
||||
ctx.PropertyErrorf("partition", "unsupported partition %q: only \"system\" and \"system_ext\" are supported", partition)
|
||||
partition := p.partition(ctx.DeviceConfig())
|
||||
if !InList(partition, validPartitions) {
|
||||
ctx.PropertyErrorf("partition", "unsupported partition %q: only %q are supported", partition, validPartitions)
|
||||
return
|
||||
}
|
||||
|
||||
@@ -118,7 +142,7 @@ func (p *buildPropModule) GenerateAndroidBuildActions(ctx ModuleContext) {
|
||||
cmd.FlagWithInput("--platform-preview-sdk-fingerprint-file=", ApiFingerprintPath(ctx))
|
||||
cmd.FlagWithInput("--product-config=", PathForModuleSrc(ctx, proptools.String(p.properties.Product_config)))
|
||||
cmd.FlagWithArg("--partition=", partition)
|
||||
cmd.FlagForEachInput("--prop-files=", ctx.Config().SystemPropFiles(ctx))
|
||||
cmd.FlagForEachInput("--prop-files=", p.propFiles(ctx))
|
||||
cmd.FlagWithOutput("--out=", p.outputFilePath)
|
||||
|
||||
postProcessCmd := rule.Command().BuiltTool("post_process_props")
|
||||
|
Reference in New Issue
Block a user