Use OutputFilesProvider on bpf

This changes makes bpf module type uses OutputFilesProvider,
instead of current OutputFileProducer for inter-module-
communication.

Test: CI
Bug: 339477385
Bug: 342406930
Change-Id: I85d1141e9f6583cc5427756107da99f56b0c7ea1
This commit is contained in:
mrziwang
2024-05-22 14:36:09 -07:00
parent 5f2be11396
commit e6c8581fbe
6 changed files with 88 additions and 32 deletions

View File

@@ -65,8 +65,6 @@ var PrepareForTestWithBpf = android.FixtureRegisterWithContext(registerBpfBuildC
type BpfModule interface {
android.Module
OutputFiles(tag string) (android.Paths, error)
// Returns the sub install directory if the bpf module is included by apex.
SubDir() string
}
@@ -213,6 +211,8 @@ func (bpf *bpf) GenerateAndroidBuildActions(ctx android.ModuleContext) {
}
android.SetProvider(ctx, blueprint.SrcsFileProviderKey, blueprint.SrcsFileProviderData{SrcPaths: srcs.Strings()})
ctx.SetOutputFiles(bpf.objs, "")
}
func (bpf *bpf) AndroidMk() android.AndroidMkData {
@@ -255,23 +255,10 @@ func (bpf *bpf) AndroidMk() android.AndroidMkData {
}
}
// Implements OutputFileFileProducer interface so that the obj output can be used in the data property
// of other modules.
func (bpf *bpf) OutputFiles(tag string) (android.Paths, error) {
switch tag {
case "":
return bpf.objs, nil
default:
return nil, fmt.Errorf("unsupported module reference tag %q", tag)
}
}
func (bpf *bpf) SubDir() string {
return bpf.properties.Sub_dir
}
var _ android.OutputFileProducer = (*bpf)(nil)
func BpfFactory() android.Module {
module := &bpf{}