From 4e9f5923c0e7cf0d7f845b90c7da65c24e44bcee Mon Sep 17 00:00:00 2001 From: Cole Faust Date: Wed, 13 Nov 2024 16:09:23 -0800 Subject: 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 --- filesystem/vbmeta.go | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'filesystem/vbmeta.go') diff --git a/filesystem/vbmeta.go b/filesystem/vbmeta.go index ebb3ff951..6a4785933 100644 --- a/filesystem/vbmeta.go +++ b/filesystem/vbmeta.go @@ -44,7 +44,7 @@ type vbmeta struct { properties VbmetaProperties - output android.OutputPath + output android.Path installDir android.InstallPath } @@ -161,8 +161,6 @@ func (v *vbmeta) partitionName() string { const vbmetaMaxSize = 64 * 1024 func (v *vbmeta) GenerateAndroidBuildActions(ctx android.ModuleContext) { - v.output = android.PathForModuleOut(ctx, v.installFileName()).OutputPath - builder := android.NewRuleBuilder(pctx, ctx) cmd := builder.Command().BuiltTool("avbtool").Text("make_vbmeta_image") @@ -274,18 +272,19 @@ func (v *vbmeta) GenerateAndroidBuildActions(ctx android.ModuleContext) { cmd.Implicit(publicKey) } - cmd.FlagWithOutput("--output ", v.output) + output := android.PathForModuleOut(ctx, v.installFileName()) + cmd.FlagWithOutput("--output ", output) // libavb expects to be able to read the maximum vbmeta size, so we must provide a partition // which matches this or the read will fail. builder.Command().Text("truncate"). FlagWithArg("-s ", strconv.Itoa(vbmetaMaxSize)). - Output(v.output) + Output(output) builder.Build("vbmeta", fmt.Sprintf("vbmeta %s", ctx.ModuleName())) v.installDir = android.PathForModuleInstall(ctx, "etc") - ctx.InstallFile(v.installDir, v.installFileName(), v.output) + ctx.InstallFile(v.installDir, v.installFileName(), output) extractedPublicKey := android.PathForModuleOut(ctx, v.partitionName()+".avbpubkey") ctx.Build(pctx, android.BuildParams{ @@ -300,7 +299,8 @@ func (v *vbmeta) GenerateAndroidBuildActions(ctx android.ModuleContext) { PublicKey: extractedPublicKey, }) - ctx.SetOutputFiles([]android.Path{v.output}, "") + ctx.SetOutputFiles([]android.Path{output}, "") + v.output = output } // Returns the embedded shell command that prints the rollback index -- cgit v1.2.3-59-g8ed1b