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

Commit 61d83e90 authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "Incorporate filegroups into mixed builds."

parents 14d09018 5bde22ff
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))
	}