From 555d133433fef7a9c2eb1420efce05398f13018d Mon Sep 17 00:00:00 2001 From: mrziwang Date: Fri, 7 Jun 2024 11:15:33 -0700 Subject: [PATCH] Use OutputFilesProvider on filesystem module types Test: CI Bug: 339477385 Change-Id: I0902726cfef13c716d73c1abc5c9836bdcf3e10f --- filesystem/avb_gen_vbmeta_image.go | 12 ++---------- filesystem/bootimg.go | 12 ++---------- filesystem/filesystem.go | 12 ++---------- filesystem/logical_partition.go | 12 ++---------- filesystem/raw_binary.go | 14 ++------------ filesystem/vbmeta.go | 12 ++---------- 6 files changed, 12 insertions(+), 62 deletions(-) diff --git a/filesystem/avb_gen_vbmeta_image.go b/filesystem/avb_gen_vbmeta_image.go index 985f0eac2..a7fd7829e 100644 --- a/filesystem/avb_gen_vbmeta_image.go +++ b/filesystem/avb_gen_vbmeta_image.go @@ -81,6 +81,8 @@ func (a *avbGenVbmetaImage) GenerateAndroidBuildActions(ctx android.ModuleContex a.output = android.PathForModuleOut(ctx, a.installFileName()).OutputPath cmd.FlagWithOutput("--output_vbmeta_image ", a.output) builder.Build("avbGenVbmetaImage", fmt.Sprintf("avbGenVbmetaImage %s", ctx.ModuleName())) + + ctx.SetOutputFiles([]android.Path{a.output}, "") } var _ android.AndroidMkEntriesProvider = (*avbGenVbmetaImage)(nil) @@ -99,16 +101,6 @@ func (a *avbGenVbmetaImage) AndroidMkEntries() []android.AndroidMkEntries { }} } -var _ android.OutputFileProducer = (*avbGenVbmetaImage)(nil) - -// Implements android.OutputFileProducer -func (a *avbGenVbmetaImage) OutputFiles(tag string) (android.Paths, error) { - if tag == "" { - return []android.Path{a.output}, nil - } - return nil, fmt.Errorf("unsupported module reference tag %q", tag) -} - type avbGenVbmetaImageDefaults struct { android.ModuleBase android.DefaultsModuleBase diff --git a/filesystem/bootimg.go b/filesystem/bootimg.go index 352b45178..e796ab9b3 100644 --- a/filesystem/bootimg.go +++ b/filesystem/bootimg.go @@ -123,6 +123,8 @@ func (b *bootimg) GenerateAndroidBuildActions(ctx android.ModuleContext) { b.installDir = android.PathForModuleInstall(ctx, "etc") ctx.InstallFile(b.installDir, b.installFileName(), b.output) + + ctx.SetOutputFiles([]android.Path{b.output}, "") } func (b *bootimg) buildBootImage(ctx android.ModuleContext, vendor bool) android.OutputPath { @@ -292,13 +294,3 @@ func (b *bootimg) SignedOutputPath() android.Path { } return nil } - -var _ android.OutputFileProducer = (*bootimg)(nil) - -// Implements android.OutputFileProducer -func (b *bootimg) OutputFiles(tag string) (android.Paths, error) { - if tag == "" { - return []android.Path{b.output}, nil - } - return nil, fmt.Errorf("unsupported module reference tag %q", tag) -} diff --git a/filesystem/filesystem.go b/filesystem/filesystem.go index d2572c269..c889dd61c 100644 --- a/filesystem/filesystem.go +++ b/filesystem/filesystem.go @@ -221,6 +221,8 @@ func (f *filesystem) GenerateAndroidBuildActions(ctx android.ModuleContext) { f.installDir = android.PathForModuleInstall(ctx, "etc") ctx.InstallFile(f.installDir, f.installFileName(), f.output) + + ctx.SetOutputFiles([]android.Path{f.output}, "") } func validatePartitionType(ctx android.ModuleContext, p partition) { @@ -561,16 +563,6 @@ func (f *filesystem) AndroidMkEntries() []android.AndroidMkEntries { }} } -var _ android.OutputFileProducer = (*filesystem)(nil) - -// Implements android.OutputFileProducer -func (f *filesystem) OutputFiles(tag string) (android.Paths, error) { - if tag == "" { - return []android.Path{f.output}, nil - } - return nil, fmt.Errorf("unsupported module reference tag %q", tag) -} - // Filesystem is the public interface for the filesystem struct. Currently, it's only for the apex // package to have access to the output file. type Filesystem interface { diff --git a/filesystem/logical_partition.go b/filesystem/logical_partition.go index e2f7d7bdf..e483fe472 100644 --- a/filesystem/logical_partition.go +++ b/filesystem/logical_partition.go @@ -185,6 +185,8 @@ func (l *logicalPartition) GenerateAndroidBuildActions(ctx android.ModuleContext l.installDir = android.PathForModuleInstall(ctx, "etc") ctx.InstallFile(l.installDir, l.installFileName(), l.output) + + ctx.SetOutputFiles([]android.Path{l.output}, "") } // Add a rule that converts the filesystem for the given partition to the given rule builder. The @@ -231,13 +233,3 @@ func (l *logicalPartition) OutputPath() android.Path { func (l *logicalPartition) SignedOutputPath() android.Path { return nil // logical partition is not signed by itself } - -var _ android.OutputFileProducer = (*logicalPartition)(nil) - -// Implements android.OutputFileProducer -func (l *logicalPartition) OutputFiles(tag string) (android.Paths, error) { - if tag == "" { - return []android.Path{l.output}, nil - } - return nil, fmt.Errorf("unsupported module reference tag %q", tag) -} diff --git a/filesystem/raw_binary.go b/filesystem/raw_binary.go index 1544ea788..ad36c2935 100644 --- a/filesystem/raw_binary.go +++ b/filesystem/raw_binary.go @@ -15,8 +15,6 @@ package filesystem import ( - "fmt" - "github.com/google/blueprint" "github.com/google/blueprint/proptools" @@ -88,6 +86,8 @@ func (r *rawBinary) GenerateAndroidBuildActions(ctx android.ModuleContext) { r.output = outputFile r.installDir = android.PathForModuleInstall(ctx, "etc") ctx.InstallFile(r.installDir, r.installFileName(), r.output) + + ctx.SetOutputFiles([]android.Path{r.output}, "") } var _ android.AndroidMkEntriesProvider = (*rawBinary)(nil) @@ -109,13 +109,3 @@ func (r *rawBinary) OutputPath() android.Path { func (r *rawBinary) SignedOutputPath() android.Path { return nil } - -var _ android.OutputFileProducer = (*rawBinary)(nil) - -// Implements android.OutputFileProducer -func (r *rawBinary) OutputFiles(tag string) (android.Paths, error) { - if tag == "" { - return []android.Path{r.output}, nil - } - return nil, fmt.Errorf("unsupported module reference tag %q", tag) -} diff --git a/filesystem/vbmeta.go b/filesystem/vbmeta.go index 43a2f3712..0c6e7f428 100644 --- a/filesystem/vbmeta.go +++ b/filesystem/vbmeta.go @@ -211,6 +211,8 @@ func (v *vbmeta) GenerateAndroidBuildActions(ctx android.ModuleContext) { v.installDir = android.PathForModuleInstall(ctx, "etc") ctx.InstallFile(v.installDir, v.installFileName(), v.output) + + ctx.SetOutputFiles([]android.Path{v.output}, "") } // Returns the embedded shell command that prints the rollback index @@ -288,13 +290,3 @@ func (v *vbmeta) OutputPath() android.Path { func (v *vbmeta) SignedOutputPath() android.Path { return v.OutputPath() // vbmeta is always signed } - -var _ android.OutputFileProducer = (*vbmeta)(nil) - -// Implements android.OutputFileProducer -func (v *vbmeta) OutputFiles(tag string) (android.Paths, error) { - if tag == "" { - return []android.Path{v.output}, nil - } - return nil, fmt.Errorf("unsupported module reference tag %q", tag) -}