Merge "Read BUILD files in bp2build" am: 01f8784246 am: 73daae6519 am: 14923c16f8 am: 577e59bebb am: f4125ef827 am: 2c690369ea

Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2617569

Change-Id: I3c0ede4919a1cc387bbc6005f50cb28cb44a9c09
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Treehugger Robot
2023-06-10 03:08:30 +00:00
committed by Automerger Merge Worker
5 changed files with 126 additions and 3 deletions

View File

@@ -291,6 +291,10 @@ type config struct {
// "--bazel-force-enabled-modules"
bazelForceEnabledModules map[string]struct{}
// Names of Bazel targets as defined by BUILD files in the source tree,
// keyed by the directory in which they are defined.
bazelTargetsByDir map[string][]string
// If true, for any requests to Bazel, communicate with a Bazel proxy using
// unix sockets, instead of spawning Bazel as a subprocess.
UseBazelProxy bool
@@ -2005,6 +2009,20 @@ func (c *config) LogMixedBuild(ctx BaseModuleContext, useBazel bool) {
}
}
func (c *config) HasBazelBuildTargetInSource(ctx BaseModuleContext) bool {
moduleName := ctx.Module().Name()
for _, buildTarget := range c.bazelTargetsByDir[ctx.ModuleDir()] {
if moduleName == buildTarget {
return true
}
}
return false
}
func (c *config) SetBazelBuildFileTargets(bazelTargetsByDir map[string][]string) {
c.bazelTargetsByDir = bazelTargetsByDir
}
// ApiSurfaces directory returns the source path inside the api_surfaces repo
// (relative to workspace root).
func (c *config) ApiSurfacesDir(s ApiSurface, version string) string {