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

Commit b9059316 authored by Nick Chalko's avatar Nick Chalko
Browse files

Implement support for build_prop.Footer_files

Test: m system-build.prop && tail ${OUT}/system/build.prop
Bug: 378710882
Change-Id: Ia1dd71cbcb62fbe6453ed6c48409cd1f42879986
parent 1caa78e9
Loading
Loading
Loading
Loading
+20 −1
Original line number Diff line number Diff line
@@ -15,6 +15,8 @@
package android

import (
	"fmt"

	"github.com/google/blueprint/proptools"
)

@@ -173,7 +175,16 @@ func (p *buildPropModule) GenerateAndroidBuildActions(ctx ModuleContext) {
	postProcessCmd.Text(outputFilePath.String())
	postProcessCmd.Flags(p.properties.Block_list)

	rule.Command().Text("echo").Text(proptools.NinjaAndShellEscape("# end of file")).FlagWithArg(">> ", outputFilePath.String())
	for _, footer := range p.properties.Footer_files {
		path := PathForModuleSrc(ctx, footer)
		rule.appendText(outputFilePath, "####################################")
		rule.appendTextf(outputFilePath, "# Adding footer from %v", footer)
		rule.appendTextf(outputFilePath, "# with path %v", path)
		rule.appendText(outputFilePath, "####################################")
		rule.Command().Text("cat").FlagWithInput("", path).FlagWithArg(">> ", outputFilePath.String())
	}

	rule.appendText(outputFilePath, "# end of file")

	rule.Build(ctx.ModuleName(), "generating build.prop")

@@ -184,6 +195,14 @@ func (p *buildPropModule) GenerateAndroidBuildActions(ctx ModuleContext) {
	p.outputFilePath = outputFilePath
}

func (r *RuleBuilder) appendText(path ModuleOutPath, text string) {
	r.Command().Text("echo").Text(proptools.NinjaAndShellEscape(text)).FlagWithArg(">> ", path.String())
}

func (r *RuleBuilder) appendTextf(path ModuleOutPath, format string, a ...any) {
	r.appendText(path, fmt.Sprintf(format, a...))
}

func (p *buildPropModule) AndroidMkEntries() []AndroidMkEntries {
	return []AndroidMkEntries{{
		Class:      "ETC",