Add system_ext support to build_prop module
As some partitions have build.prop under etc/, this change adds relative_install_path property to build_prop module. Also this change adds system_ext related Soong variables and system_ext support in gen_build_prop.py. Bug: 322090587 Test: build and compare system_ext/etc/build.prop Change-Id: I416662b8bae09383af0cdd3d8444a5c300006b7b
This commit is contained in:
parent
ec12b7dc1e
commit
2900689117
5 changed files with 44 additions and 14 deletions
|
@ -141,3 +141,12 @@ build_prop {
|
||||||
"//packages/modules/Virtualization/microdroid",
|
"//packages/modules/Virtualization/microdroid",
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
|
|
||||||
|
build_prop {
|
||||||
|
name: "system_ext-build.prop",
|
||||||
|
stem: "build.prop",
|
||||||
|
system_ext_specific: true,
|
||||||
|
product_config: ":product_config",
|
||||||
|
relative_install_path: "etc", // system_ext/etc/build.prop
|
||||||
|
visibility: ["//visibility:private"],
|
||||||
|
}
|
||||||
|
|
|
@ -37,6 +37,9 @@ type buildPropProperties struct {
|
||||||
|
|
||||||
// Path to a JSON file containing product configs.
|
// Path to a JSON file containing product configs.
|
||||||
Product_config *string `android:"path"`
|
Product_config *string `android:"path"`
|
||||||
|
|
||||||
|
// Optional subdirectory under which this file is installed into
|
||||||
|
Relative_install_path *string
|
||||||
}
|
}
|
||||||
|
|
||||||
type buildPropModule struct {
|
type buildPropModule struct {
|
||||||
|
@ -56,6 +59,8 @@ func (p *buildPropModule) propFiles(ctx ModuleContext) Paths {
|
||||||
partition := p.PartitionTag(ctx.DeviceConfig())
|
partition := p.PartitionTag(ctx.DeviceConfig())
|
||||||
if partition == "system" {
|
if partition == "system" {
|
||||||
return ctx.Config().SystemPropFiles(ctx)
|
return ctx.Config().SystemPropFiles(ctx)
|
||||||
|
} else if partition == "system_ext" {
|
||||||
|
return ctx.Config().SystemExtPropFiles(ctx)
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
@ -84,8 +89,8 @@ func (p *buildPropModule) GenerateAndroidBuildActions(ctx ModuleContext) {
|
||||||
}
|
}
|
||||||
|
|
||||||
partition := p.PartitionTag(ctx.DeviceConfig())
|
partition := p.PartitionTag(ctx.DeviceConfig())
|
||||||
if partition != "system" {
|
if partition != "system" && partition != "system_ext" {
|
||||||
ctx.PropertyErrorf("partition", "unsupported partition %q: only \"system\" is supported", partition)
|
ctx.PropertyErrorf("partition", "unsupported partition %q: only \"system\" and \"system_ext\" are supported", partition)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -134,7 +139,7 @@ func (p *buildPropModule) GenerateAndroidBuildActions(ctx ModuleContext) {
|
||||||
|
|
||||||
rule.Build(ctx.ModuleName(), "generating build.prop")
|
rule.Build(ctx.ModuleName(), "generating build.prop")
|
||||||
|
|
||||||
p.installPath = PathForModuleInstall(ctx)
|
p.installPath = PathForModuleInstall(ctx, proptools.String(p.properties.Relative_install_path))
|
||||||
ctx.InstallFile(p.installPath, p.stem(), p.outputFilePath)
|
ctx.InstallFile(p.installPath, p.stem(), p.outputFilePath)
|
||||||
|
|
||||||
ctx.SetOutputFiles(Paths{p.outputFilePath}, "")
|
ctx.SetOutputFiles(Paths{p.outputFilePath}, "")
|
||||||
|
|
|
@ -2110,6 +2110,10 @@ func (c *config) SystemPropFiles(ctx PathContext) Paths {
|
||||||
return PathsForSource(ctx, c.productVariables.SystemPropFiles)
|
return PathsForSource(ctx, c.productVariables.SystemPropFiles)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c *config) SystemExtPropFiles(ctx PathContext) Paths {
|
||||||
|
return PathsForSource(ctx, c.productVariables.SystemExtPropFiles)
|
||||||
|
}
|
||||||
|
|
||||||
func (c *config) EnableUffdGc() string {
|
func (c *config) EnableUffdGc() string {
|
||||||
return String(c.productVariables.EnableUffdGc)
|
return String(c.productVariables.EnableUffdGc)
|
||||||
}
|
}
|
||||||
|
|
|
@ -534,6 +534,7 @@ type ProductVariables struct {
|
||||||
ArtTargetIncludeDebugBuild *bool `json:",omitempty"`
|
ArtTargetIncludeDebugBuild *bool `json:",omitempty"`
|
||||||
|
|
||||||
SystemPropFiles []string `json:",omitempty"`
|
SystemPropFiles []string `json:",omitempty"`
|
||||||
|
SystemExtPropFiles []string `json:",omitempty"`
|
||||||
|
|
||||||
EnableUffdGc *string `json:",omitempty"`
|
EnableUffdGc *string `json:",omitempty"`
|
||||||
}
|
}
|
||||||
|
|
|
@ -129,16 +129,16 @@ def generate_common_build_props(args):
|
||||||
print(f"ro.product.{partition}.name={config['DeviceProduct']}")
|
print(f"ro.product.{partition}.name={config['DeviceProduct']}")
|
||||||
|
|
||||||
if partition != "system":
|
if partition != "system":
|
||||||
if config["ModelForAttestation"]:
|
if config["ProductModelForAttestation"]:
|
||||||
print(f"ro.product.model_for_attestation={config['ModelForAttestation']}")
|
print(f"ro.product.model_for_attestation={config['ProductModelForAttestation']}")
|
||||||
if config["BrandForAttestation"]:
|
if config["ProductBrandForAttestation"]:
|
||||||
print(f"ro.product.brand_for_attestation={config['BrandForAttestation']}")
|
print(f"ro.product.brand_for_attestation={config['ProductBrandForAttestation']}")
|
||||||
if config["NameForAttestation"]:
|
if config["ProductNameForAttestation"]:
|
||||||
print(f"ro.product.name_for_attestation={config['NameForAttestation']}")
|
print(f"ro.product.name_for_attestation={config['ProductNameForAttestation']}")
|
||||||
if config["DeviceForAttestation"]:
|
if config["ProductDeviceForAttestation"]:
|
||||||
print(f"ro.product.device_for_attestation={config['DeviceForAttestation']}")
|
print(f"ro.product.device_for_attestation={config['ProductDeviceForAttestation']}")
|
||||||
if config["ManufacturerForAttestation"]:
|
if config["ProductManufacturerForAttestation"]:
|
||||||
print(f"ro.product.manufacturer_for_attestation={config['ManufacturerForAttestation']}")
|
print(f"ro.product.manufacturer_for_attestation={config['ProductManufacturerForAttestation']}")
|
||||||
|
|
||||||
if config["ZygoteForce64"]:
|
if config["ZygoteForce64"]:
|
||||||
if partition == "vendor":
|
if partition == "vendor":
|
||||||
|
@ -511,6 +511,15 @@ def build_system_prop(args):
|
||||||
|
|
||||||
build_prop(args, gen_build_info=True, gen_common_build_props=True, variables=variables)
|
build_prop(args, gen_build_info=True, gen_common_build_props=True, variables=variables)
|
||||||
|
|
||||||
|
def build_system_ext_prop(args):
|
||||||
|
config = args.config
|
||||||
|
|
||||||
|
# Order matters here. When there are duplicates, the last one wins.
|
||||||
|
# TODO(b/117892318): don't allow duplicates so that the ordering doesn't matter
|
||||||
|
variables = ["PRODUCT_SYSTEM_EXT_PROPERTIES"]
|
||||||
|
|
||||||
|
build_prop(args, gen_build_info=False, gen_common_build_props=True, variables=variables)
|
||||||
|
|
||||||
'''
|
'''
|
||||||
def build_vendor_prop(args):
|
def build_vendor_prop(args):
|
||||||
config = args.config
|
config = args.config
|
||||||
|
@ -563,6 +572,8 @@ def main():
|
||||||
with contextlib.redirect_stdout(args.out):
|
with contextlib.redirect_stdout(args.out):
|
||||||
if args.partition == "system":
|
if args.partition == "system":
|
||||||
build_system_prop(args)
|
build_system_prop(args)
|
||||||
|
elif args.partition == "system_ext":
|
||||||
|
build_system_ext_prop(args)
|
||||||
'''
|
'''
|
||||||
elif args.partition == "vendor":
|
elif args.partition == "vendor":
|
||||||
build_vendor_prop(args)
|
build_vendor_prop(args)
|
||||||
|
|
Loading…
Reference in a new issue