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/cc/cc.go b/cc/cc.go
index 39d89e5..e4f4761 100644
--- a/cc/cc.go
+++ b/cc/cc.go
@@ -589,17 +589,6 @@
installInRoot() bool
}
-// 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 android.ModuleContext, label string) bool
-}
-
type xref interface {
XrefCcFiles() android.Paths
}
@@ -796,7 +785,7 @@
compiler compiler
linker linker
installer installer
- bazelHandler bazelHandler
+ bazelHandler android.BazelHandler
features []feature
stl *stl
@@ -1696,7 +1685,7 @@
bazelModuleLabel := c.GetBazelLabel(actx, c)
bazelActionsUsed := false
if c.MixedBuildsEnabled(actx) && c.bazelHandler != nil {
- bazelActionsUsed = c.bazelHandler.generateBazelBuildActions(actx, bazelModuleLabel)
+ bazelActionsUsed = c.bazelHandler.GenerateBazelBuildActions(actx, bazelModuleLabel)
}
return bazelActionsUsed
}
diff --git a/cc/library.go b/cc/library.go
index 51cba20..b2360e9 100644
--- a/cc/library.go
+++ b/cc/library.go
@@ -556,7 +556,7 @@
}
type ccLibraryBazelHandler struct {
- bazelHandler
+ android.BazelHandler
module *Module
}
@@ -642,7 +642,7 @@
return android.OptionalPathForPath(android.PathForBazelOut(ctx, tocFile))
}
-func (handler *ccLibraryBazelHandler) generateBazelBuildActions(ctx android.ModuleContext, label string) bool {
+func (handler *ccLibraryBazelHandler) GenerateBazelBuildActions(ctx android.ModuleContext, label string) bool {
bazelCtx := ctx.Config().BazelContext
ccInfo, ok, err := bazelCtx.GetCcInfo(label, ctx.Arch().ArchType)
if err != nil {
diff --git a/cc/library_headers.go b/cc/library_headers.go
index e596ff7..1a276f4 100644
--- a/cc/library_headers.go
+++ b/cc/library_headers.go
@@ -44,13 +44,13 @@
}
type libraryHeaderBazelHander struct {
- bazelHandler
+ android.BazelHandler
module *Module
library *libraryDecorator
}
-func (h *libraryHeaderBazelHander) generateBazelBuildActions(ctx android.ModuleContext, label string) bool {
+func (h *libraryHeaderBazelHander) GenerateBazelBuildActions(ctx android.ModuleContext, label string) bool {
bazelCtx := ctx.Config().BazelContext
ccInfo, ok, err := bazelCtx.GetCcInfo(label, ctx.Arch().ArchType)
if err != nil {
diff --git a/cc/object.go b/cc/object.go
index bd9f228..5952f1e 100644
--- a/cc/object.go
+++ b/cc/object.go
@@ -47,12 +47,12 @@
}
type objectBazelHandler struct {
- bazelHandler
+ android.BazelHandler
module *Module
}
-func (handler *objectBazelHandler) generateBazelBuildActions(ctx android.ModuleContext, label string) bool {
+func (handler *objectBazelHandler) GenerateBazelBuildActions(ctx android.ModuleContext, label string) bool {
bazelCtx := ctx.Config().BazelContext
objPaths, ok := bazelCtx.GetOutputFiles(label, ctx.Arch().ArchType)
if ok {
diff --git a/cc/prebuilt.go b/cc/prebuilt.go
index f7154ec..d324241 100644
--- a/cc/prebuilt.go
+++ b/cc/prebuilt.go
@@ -15,9 +15,10 @@
package cc
import (
- "android/soong/android"
"path/filepath"
"strings"
+
+ "android/soong/android"
)
func init() {
@@ -321,13 +322,13 @@
}
type prebuiltStaticLibraryBazelHandler struct {
- bazelHandler
+ android.BazelHandler
module *Module
library *libraryDecorator
}
-func (h *prebuiltStaticLibraryBazelHandler) generateBazelBuildActions(ctx android.ModuleContext, label string) bool {
+func (h *prebuiltStaticLibraryBazelHandler) GenerateBazelBuildActions(ctx android.ModuleContext, label string) bool {
bazelCtx := ctx.Config().BazelContext
ccInfo, ok, err := bazelCtx.GetCcInfo(label, ctx.Arch().ArchType)
if err != nil {