Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5bde22ff authored by Liz Kammer's avatar Liz Kammer
Browse files

Incorporate filegroups into mixed builds.

Test: bp2build generate & sync; mixed build droid
Bug: 185812083
Change-Id: I09d4203ec52acaacb11f371a6ae03b12214938f7
parent 46b93848
Loading
Loading
Loading
Loading
+26 −1
Original line number Diff line number Diff line
@@ -105,9 +105,34 @@ func FileGroupFactory() Module {
	return module
}

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) {
	fg.srcs = PathsForModuleSrcExcludes(ctx, fg.properties.Srcs, fg.properties.Exclude_srcs)
	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))
	}