Incorporate filegroups into mixed builds.

Test: bp2build generate & sync; mixed build droid
Bug: 185812083
Change-Id: I09d4203ec52acaacb11f371a6ae03b12214938f7
This commit is contained in:
Liz Kammer 2021-04-19 14:04:14 -04:00
parent 46b938485a
commit 5bde22ff15

View file

@ -105,9 +105,34 @@ func FileGroupFactory() Module {
return module
}
func (fg *fileGroup) GenerateAndroidBuildActions(ctx ModuleContext) {
fg.srcs = PathsForModuleSrcExcludes(ctx, fg.properties.Srcs, fg.properties.Exclude_srcs)
func (fg *fileGroup) generateBazelBuildActions(ctx ModuleContext) bool {
if !fg.MixedBuildsEnabled(ctx) {
return false
}
bazelCtx := ctx.Config().BazelContext
filePaths, ok := bazelCtx.GetOutputFiles(fg.GetBazelLabel(ctx, fg), ctx.Arch().ArchType)
if !ok {
return false
}
bazelOuts := make(Paths, 0, len(filePaths))
for _, p := range filePaths {
src := PathForBazelOut(ctx, p)
bazelOuts = append(bazelOuts, src)
}
fg.srcs = bazelOuts
return true
}
func (fg *fileGroup) GenerateAndroidBuildActions(ctx ModuleContext) {
if fg.generateBazelBuildActions(ctx) {
return
}
fg.srcs = PathsForModuleSrcExcludes(ctx, fg.properties.Srcs, fg.properties.Exclude_srcs)
if fg.properties.Path != nil {
fg.srcs = PathsWithModuleSrcSubDir(ctx, fg.srcs, String(fg.properties.Path))
}