diff options
author | 2024-11-13 16:09:23 -0800 | |
---|---|---|
committer | 2024-11-13 16:48:50 -0800 | |
commit | 4e9f5923c0e7cf0d7f845b90c7da65c24e44bcee (patch) | |
tree | 6d9fc3cdf89401a385e24e9e35ab67765cdef02d /filesystem/bootimg.go | |
parent | 06540bb808debb9efe410e518ce9f420bac9042c (diff) |
Use fewer OutputPaths
A lot of the time, you really mean android.Path or android.WriteablePath
instead of OutputPath.
Also, many modules were holding onto OutputPaths/WriteablePaths
after the files had already been generated, meaning they should no
longer be treated as writable paths and are instead inputs into other
actions. Change the type of those paths to just android.Path.
Test: verified ninja files were unchanged on aosp_arm64-trunk_staging-userdebug
Change-Id: Id773171bef59d855ba33c4b85cef268031cbec39
Diffstat (limited to 'filesystem/bootimg.go')
-rw-r--r-- | filesystem/bootimg.go | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/filesystem/bootimg.go b/filesystem/bootimg.go index 9d9392596..c9bd61788 100644 --- a/filesystem/bootimg.go +++ b/filesystem/bootimg.go @@ -34,7 +34,7 @@ type bootimg struct { properties bootimgProperties - output android.OutputPath + output android.Path installDir android.InstallPath } @@ -115,20 +115,20 @@ func (b *bootimg) GenerateAndroidBuildActions(ctx android.ModuleContext) { vendor := proptools.Bool(b.properties.Vendor_boot) unsignedOutput := b.buildBootImage(ctx, vendor) + output := unsignedOutput if proptools.Bool(b.properties.Use_avb) { - b.output = b.signImage(ctx, unsignedOutput) - } else { - b.output = unsignedOutput + output = b.signImage(ctx, unsignedOutput) } b.installDir = android.PathForModuleInstall(ctx, "etc") - ctx.InstallFile(b.installDir, b.installFileName(), b.output) + ctx.InstallFile(b.installDir, b.installFileName(), output) - ctx.SetOutputFiles([]android.Path{b.output}, "") + ctx.SetOutputFiles([]android.Path{output}, "") + b.output = output } -func (b *bootimg) buildBootImage(ctx android.ModuleContext, vendor bool) android.OutputPath { - output := android.PathForModuleOut(ctx, "unsigned", b.installFileName()).OutputPath +func (b *bootimg) buildBootImage(ctx android.ModuleContext, vendor bool) android.Path { + output := android.PathForModuleOut(ctx, "unsigned", b.installFileName()) builder := android.NewRuleBuilder(pctx, ctx) cmd := builder.Command().BuiltTool("mkbootimg") @@ -215,10 +215,10 @@ func (b *bootimg) buildBootImage(ctx android.ModuleContext, vendor bool) android return output } -func (b *bootimg) signImage(ctx android.ModuleContext, unsignedImage android.OutputPath) android.OutputPath { +func (b *bootimg) signImage(ctx android.ModuleContext, unsignedImage android.Path) android.Path { propFile, toolDeps := b.buildPropFile(ctx) - output := android.PathForModuleOut(ctx, b.installFileName()).OutputPath + output := android.PathForModuleOut(ctx, b.installFileName()) builder := android.NewRuleBuilder(pctx, ctx) builder.Command().Text("cp").Input(unsignedImage).Output(output) builder.Command().BuiltTool("verity_utils"). @@ -239,7 +239,7 @@ func (b *bootimg) salt() string { return sha1sum(input) } -func (b *bootimg) buildPropFile(ctx android.ModuleContext) (propFile android.OutputPath, toolDeps android.Paths) { +func (b *bootimg) buildPropFile(ctx android.ModuleContext) (android.Path, android.Paths) { var sb strings.Builder var deps android.Paths addStr := func(name string, value string) { @@ -261,7 +261,7 @@ func (b *bootimg) buildPropFile(ctx android.ModuleContext) (propFile android.Out addStr("partition_name", partitionName) addStr("avb_salt", b.salt()) - propFile = android.PathForModuleOut(ctx, "prop").OutputPath + propFile := android.PathForModuleOut(ctx, "prop") android.WriteFileRule(ctx, propFile, sb.String()) return propFile, deps } |