Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 168098c3 authored by Spandan Das's avatar Spandan Das
Browse files

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
parent 859cdef8
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -164,6 +164,7 @@ product_config {
    name: "product_config",
    visibility: [
        "//build/make/target/product/generic",
        "//build/soong/fsgen",
    ],
}

+2 −2
Original line number Diff line number Diff line
@@ -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)
+22 −2
Original line number Diff line number Diff line
@@ -141,6 +141,7 @@ func createFsGenState(ctx android.LoadHookContext) *FsGenState {
				"vendor": &map[string]*depCandidateProps{
					"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
}