Use OutputFilesProvider on filesystem module types

Test: CI
Bug: 339477385
Change-Id: I0902726cfef13c716d73c1abc5c9836bdcf3e10f
This commit is contained in:
mrziwang 2024-06-07 11:15:33 -07:00
parent 02f1e342cd
commit 555d133433
6 changed files with 12 additions and 62 deletions

View file

@ -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

View file

@ -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)
}

View file

@ -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 {

View file

@ -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)
}

View file

@ -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)
}

View file

@ -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)
}