diff options
author | 2024-10-28 19:44:34 +0000 | |
---|---|---|
committer | 2024-10-28 19:52:47 +0000 | |
commit | 168098c392712032db53fcac84140de4685af431 (patch) | |
tree | e59fceed2c61863b099914e2a07175c870974665 | |
parent | 859cdef88b917a31698310af7edf30fa06c2440e (diff) |
Autogenerate a vendor-build.prop for the current product
The autogenerated soong vendor.img will use the autogenerated soong
vendor-build.prop module. The autogenerated vendor-build.prop module is
missing support for `android-info.txt` which is an additional input as
--prop-files. Support for that will be added in a followup CL.
Test: verified that autogenerated vendor.img for aosp_cf_x86_64_phone
contains a build.prop file, and its contents are equivalent to kati
built vendor build.prop file
Bug: 375500423
Change-Id: I46b3c2e7cf44300820dcd2f7a9799ad11730691e
-rw-r--r-- | Android.bp | 1 | ||||
-rw-r--r-- | android/build_prop.go | 4 | ||||
-rw-r--r-- | fsgen/filesystem_creator.go | 24 |
3 files changed, 25 insertions, 4 deletions
diff --git a/Android.bp b/Android.bp index d0f97db2a..cbe1c7b3f 100644 --- a/Android.bp +++ b/Android.bp @@ -164,6 +164,7 @@ product_config { name: "product_config", visibility: [ "//build/make/target/product/generic", + "//build/soong/fsgen", ], } diff --git a/android/build_prop.go b/android/build_prop.go index 120ad94d1..7c3c50645 100644 --- a/android/build_prop.go +++ b/android/build_prop.go @@ -20,7 +20,7 @@ import ( func init() { ctx := InitRegistrationContext - ctx.RegisterModuleType("build_prop", buildPropFactory) + ctx.RegisterModuleType("build_prop", BuildPropFactory) } type buildPropProperties struct { @@ -191,7 +191,7 @@ func (p *buildPropModule) AndroidMkEntries() []AndroidMkEntries { // build_prop module generates {partition}/build.prop file. At first common build properties are // printed based on Soong config variables. And then prop_files are printed as-is. Finally, // post_process_props tool is run to check if the result build.prop is valid or not. -func buildPropFactory() Module { +func BuildPropFactory() Module { module := &buildPropModule{} module.AddProperties(&module.properties) InitAndroidArchModule(module, DeviceSupported, MultilibCommon) diff --git a/fsgen/filesystem_creator.go b/fsgen/filesystem_creator.go index 39572d4c3..766176d5a 100644 --- a/fsgen/filesystem_creator.go +++ b/fsgen/filesystem_creator.go @@ -139,8 +139,9 @@ func createFsGenState(ctx android.LoadHookContext) *FsGenState { "update_engine_sideload": defaultDepCandidateProps(ctx.Config()), }, "vendor": &map[string]*depCandidateProps{ - "fs_config_files_vendor": defaultDepCandidateProps(ctx.Config()), - "fs_config_dirs_vendor": defaultDepCandidateProps(ctx.Config()), + "fs_config_files_vendor": defaultDepCandidateProps(ctx.Config()), + "fs_config_dirs_vendor": defaultDepCandidateProps(ctx.Config()), + generatedModuleName(ctx.Config(), "vendor-build.prop"): defaultDepCandidateProps(ctx.Config()), }, "odm": newMultilibDeps(), "product": newMultilibDeps(), @@ -481,6 +482,25 @@ func (f *filesystemCreator) createPartition(ctx android.LoadHookContext, partiti module = ctx.CreateModule(filesystem.FilesystemFactory, baseProps, fsProps) } module.HideFromMake() + if partitionType == "vendor" { + // Create a build prop for vendor + vendorBuildProps := &struct { + Name *string + Vendor *bool + Stem *string + Product_config *string + }{ + Name: proptools.StringPtr(generatedModuleName(ctx.Config(), "vendor-build.prop")), + Vendor: proptools.BoolPtr(true), + Stem: proptools.StringPtr("build.prop"), + Product_config: proptools.StringPtr(":product_config"), + } + vendorBuildProp := ctx.CreateModule( + android.BuildPropFactory, + vendorBuildProps, + ) + vendorBuildProp.HideFromMake() + } return true } |