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

Commit cd6e54c4 authored by Spandan Das's avatar Spandan Das Committed by Gerrit Code Review
Browse files

Merge changes from topic "soong_vendor_build_prop" into main

* changes:
  Autogenerate a vendor-build.prop for the current product
  Add vendor to list of supported partitions in gen_build_prop.py
parents ec62d843 168098c3
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",
    ],
}

+6 −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 {
@@ -65,6 +65,9 @@ func (p *buildPropModule) propFiles(ctx ModuleContext) Paths {
		return ctx.Config().ProductPropFiles(ctx)
	} else if partition == "odm" {
		return ctx.Config().OdmPropFiles(ctx)
	} else if partition == "vendor" {
		// TODO (b/375500423): Add android-info.txt to prop files
		return ctx.Config().VendorPropFiles(ctx)
	}
	return nil
}
@@ -104,6 +107,7 @@ var validPartitions = []string{
	"system_ext",
	"product",
	"odm",
	"vendor",
}

func (p *buildPropModule) GenerateAndroidBuildActions(ctx ModuleContext) {
@@ -187,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)
+4 −0
Original line number Diff line number Diff line
@@ -2195,6 +2195,10 @@ func (c *config) OdmPropFiles(ctx PathContext) Paths {
	return PathsForSource(ctx, c.productVariables.OdmPropFiles)
}

func (c *config) VendorPropFiles(ctx PathContext) Paths {
	return PathsForSource(ctx, c.productVariables.VendorPropFiles)
}

func (c *config) ExtraAllowedDepsTxt() string {
	return String(c.productVariables.ExtraAllowedDepsTxt)
}
+1 −0
Original line number Diff line number Diff line
@@ -521,6 +521,7 @@ type ProductVariables struct {
	SystemExtPropFiles []string `json:",omitempty"`
	ProductPropFiles   []string `json:",omitempty"`
	OdmPropFiles       []string `json:",omitempty"`
	VendorPropFiles    []string `json:",omitempty"`

	EnableUffdGc *string `json:",omitempty"`

+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
}

Loading