summaryrefslogtreecommitdiff
path: root/bpf/bpf.go
diff options
context:
space:
mode:
Diffstat (limited to 'bpf/bpf.go')
-rw-r--r--bpf/bpf.go30
1 files changed, 30 insertions, 0 deletions
diff --git a/bpf/bpf.go b/bpf/bpf.go
index 1eceeeb53..737675057 100644
--- a/bpf/bpf.go
+++ b/bpf/bpf.go
@@ -23,6 +23,7 @@ import (
"android/soong/android"
"android/soong/bazel"
+ "android/soong/bazel/cquery"
"github.com/google/blueprint"
"github.com/google/blueprint/proptools"
@@ -246,6 +247,35 @@ func (bpf *bpf) AndroidMk() android.AndroidMkData {
}
}
+var _ android.MixedBuildBuildable = (*bpf)(nil)
+
+func (bpf *bpf) IsMixedBuildSupported(ctx android.BaseModuleContext) bool {
+ return true
+}
+
+func (bpf *bpf) QueueBazelCall(ctx android.BaseModuleContext) {
+ bazelCtx := ctx.Config().BazelContext
+ bazelCtx.QueueBazelRequest(
+ bpf.GetBazelLabel(ctx, bpf),
+ cquery.GetOutputFiles,
+ android.GetConfigKey(ctx))
+}
+
+func (bpf *bpf) ProcessBazelQueryResponse(ctx android.ModuleContext) {
+ bazelCtx := ctx.Config().BazelContext
+ objPaths, err := bazelCtx.GetOutputFiles(bpf.GetBazelLabel(ctx, bpf), android.GetConfigKey(ctx))
+ if err != nil {
+ ctx.ModuleErrorf(err.Error())
+ return
+ }
+
+ bazelOuts := android.Paths{}
+ for _, p := range objPaths {
+ bazelOuts = append(bazelOuts, android.PathForBazelOut(ctx, p))
+ }
+ bpf.objs = bazelOuts
+}
+
// 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) {