Merge "Make buildinfo_prop a regular module" into main

This commit is contained in:
Treehugger Robot 2024-06-07 18:36:54 +00:00 committed by Gerrit Code Review
commit 63de06c142

View file

@ -23,7 +23,7 @@ import (
func init() {
ctx := InitRegistrationContext
ctx.RegisterParallelSingletonModuleType("buildinfo_prop", buildinfoPropFactory)
ctx.RegisterModuleType("buildinfo_prop", buildinfoPropFactory)
}
type buildinfoPropProperties struct {
@ -32,7 +32,7 @@ type buildinfoPropProperties struct {
}
type buildinfoPropModule struct {
SingletonModuleBase
ModuleBase
properties buildinfoPropProperties
@ -88,6 +88,10 @@ func shouldAddBuildThumbprint(config Config) bool {
}
func (p *buildinfoPropModule) GenerateAndroidBuildActions(ctx ModuleContext) {
if ctx.ModuleName() != "buildinfo.prop" || ctx.ModuleDir() != "build/soong" {
ctx.ModuleErrorf("There can only be one buildinfo_prop module in build/soong")
return
}
p.outputFilePath = PathForModuleOut(ctx, p.Name()).OutputPath
if !ctx.Config().KatiEnabled() {
WriteFileRule(ctx, p.outputFilePath, "# no buildinfo.prop if kati is disabled")
@ -166,12 +170,8 @@ func (p *buildinfoPropModule) GenerateAndroidBuildActions(ctx ModuleContext) {
ctx.InstallFile(p.installPath, p.Name(), p.outputFilePath)
}
func (f *buildinfoPropModule) GenerateSingletonBuildActions(ctx SingletonContext) {
// does nothing; buildinfo_prop is a singeton because two buildinfo modules don't make sense.
}
func (p *buildinfoPropModule) AndroidMkEntries() []AndroidMkEntries {
return []AndroidMkEntries{AndroidMkEntries{
return []AndroidMkEntries{{
Class: "ETC",
OutputFile: OptionalPathForPath(p.outputFilePath),
ExtraEntries: []AndroidMkExtraEntriesFunc{
@ -187,7 +187,7 @@ func (p *buildinfoPropModule) AndroidMkEntries() []AndroidMkEntries {
// buildinfo_prop module generates a build.prop file, which contains a set of common
// system/build.prop properties, such as ro.build.version.*. Not all properties are implemented;
// currently this module is only for microdroid.
func buildinfoPropFactory() SingletonModule {
func buildinfoPropFactory() Module {
module := &buildinfoPropModule{}
module.AddProperties(&module.properties)
InitAndroidModule(module)