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

Commit 7660e718 authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "add bp2build subevents" into main

parents 51732356 aaf2fd13
Loading
Loading
Loading
Loading
+7 −2
Original line number Diff line number Diff line
@@ -15,7 +15,6 @@
package bp2build

import (
	"android/soong/starlark_import"
	"fmt"
	"os"
	"path/filepath"
@@ -24,6 +23,7 @@ import (
	"android/soong/android"
	"android/soong/bazel"
	"android/soong/shared"
	"android/soong/starlark_import"
)

func deleteFilesExcept(ctx *CodegenContext, rootOutputPath android.OutputPath, except []BazelFile) {
@@ -67,6 +67,8 @@ func deleteFilesExcept(ctx *CodegenContext, rootOutputPath android.OutputPath, e
// writing .bzl files that are equivalent to Android.bp files that are capable
// of being built with Bazel.
func Codegen(ctx *CodegenContext) *CodegenMetrics {
	ctx.Context().BeginEvent("Codegen")
	defer ctx.Context().EndEvent("Codegen")
	// This directory stores BUILD files that could be eventually checked-in.
	bp2buildDir := android.PathForOutput(ctx, "bp2build")

@@ -79,7 +81,10 @@ func Codegen(ctx *CodegenContext) *CodegenMetrics {
		fmt.Printf("ERROR: Encountered %d error(s): \nERROR: %s", len(errs), strings.Join(errMsgs, "\n"))
		os.Exit(1)
	}
	bp2buildFiles := CreateBazelFiles(ctx.Config(), nil, res.buildFileToTargets, ctx.mode)
	var bp2buildFiles []BazelFile
	ctx.Context().EventHandler.Do("CreateBazelFile", func() {
		bp2buildFiles = CreateBazelFiles(ctx.Config(), nil, res.buildFileToTargets, ctx.mode)
	})
	injectionFiles, additionalBp2buildFiles, err := CreateSoongInjectionDirFiles(ctx, res.metrics)
	if err != nil {
		fmt.Printf("%s\n", err.Error())
+2 −0
Original line number Diff line number Diff line
@@ -653,6 +653,8 @@ func generateBazelTargetsGoBinary(ctx *android.Context, g *bootstrap.GoBinary, g
}

func GenerateBazelTargets(ctx *CodegenContext, generateFilegroups bool) (conversionResults, []error) {
	ctx.Context().BeginEvent("GenerateBazelTargets")
	defer ctx.Context().EndEvent("GenerateBazelTargets")
	buildFileToTargets := make(map[string]BazelTargets)

	// Simple metrics tracking for bp2build
+1 −3
Original line number Diff line number Diff line
@@ -814,9 +814,7 @@ func runBp2Build(ctx *android.Context, extraNinjaDeps []string, metricsDir strin
		// Run the code-generation phase to convert BazelTargetModules to BUILD files
		// and print conversion codegenMetrics to the user.
		codegenContext := bp2build.NewCodegenContext(ctx.Config(), ctx, bp2build.Bp2Build, topDir)
		ctx.EventHandler.Do("codegen", func() {
		codegenMetrics = bp2build.Codegen(codegenContext)
		})

		ninjaDeps = append(ninjaDeps, codegenContext.AdditionalNinjaDeps()...)