Lift BazelHandler interface into android/
Because it's commonly useful and not cc/ specific
Also export GenerateBazelBuildActions and update uses
Test: Existing tests pass
Change-Id: Ibc6858bb1129afba181a7686dda432defe33b00d
diff --git a/android/bazel_handler.go b/android/bazel_handler.go
index 341d500..b272daa 100644
--- a/android/bazel_handler.go
+++ b/android/bazel_handler.go
@@ -57,6 +57,17 @@
archType ArchType
}
+// bazelHandler is the interface for a helper object related to deferring to Bazel for
+// processing a module (during Bazel mixed builds). Individual module types should define
+// their own bazel handler if they support deferring to Bazel.
+type BazelHandler interface {
+ // Issue query to Bazel to retrieve information about Bazel's view of the current module.
+ // If Bazel returns this information, set module properties on the current module to reflect
+ // the returned information.
+ // Returns true if information was available from Bazel, false if bazel invocation still needs to occur.
+ GenerateBazelBuildActions(ctx ModuleContext, label string) bool
+}
+
type BazelContext interface {
// The below methods involve queuing cquery requests to be later invoked
// by bazel. If any of these methods return (_, false), then the request
diff --git a/android/filegroup.go b/android/filegroup.go
index e207412..97dd136 100644
--- a/android/filegroup.go
+++ b/android/filegroup.go
@@ -15,8 +15,9 @@
package android
import (
- "android/soong/bazel"
"strings"
+
+ "android/soong/bazel"
)
func init() {
@@ -108,7 +109,7 @@
return module
}
-func (fg *fileGroup) generateBazelBuildActions(ctx ModuleContext) bool {
+func (fg *fileGroup) GenerateBazelBuildActions(ctx ModuleContext) bool {
if !fg.MixedBuildsEnabled(ctx) {
return false
}
@@ -131,7 +132,7 @@
}
func (fg *fileGroup) GenerateAndroidBuildActions(ctx ModuleContext) {
- if fg.generateBazelBuildActions(ctx) {
+ if fg.GenerateBazelBuildActions(ctx) {
return
}