Make bp2build be more correct.
It now handles adding .bp files and changing globs. In order to do this, depfiles are now written separately from RunBlueprint. This is necessary due to the confluence of a number of seemingly unrelated factors: 1. The glob filelist dependencies are discovered in globSingleton 2. Singletons need to be registered because otherwise singleton module types panic 3. Singletons don't work because they require mutators bp2build does not run Due to (1), we would need to run the glob singleton. However, due to (2) and (3), we can't run singletons and have to run Blueprint with StopBeforeGeneratingBuildActions, which is when the build actions writing glob files would be generated. So what happens is: 1. When bp2build is run, the glob singleton is disabled 2. At the end of bp2build, the list of glob files is artifically added to the depfile of the workspace marker file 3. When build.ninja is generated, the Ninja file containing the glob list file is written by the now-active glob singleton Test: Presubmits. Change-Id: I3c5898d8c57c554a93520276c64a952afc912dbe
This commit is contained in:
@@ -21,6 +21,7 @@ import (
|
||||
"strconv"
|
||||
|
||||
"android/soong/shared"
|
||||
"github.com/google/blueprint/deptools"
|
||||
|
||||
soong_metrics_proto "android/soong/ui/metrics/metrics_proto"
|
||||
"github.com/google/blueprint"
|
||||
@@ -107,6 +108,7 @@ func bootstrapBlueprint(ctx Context, config Config, integratedBp2Build bool) {
|
||||
mainNinjaFile := shared.JoinPath(config.SoongOutDir(), "build.ninja")
|
||||
globFile := shared.JoinPath(config.SoongOutDir(), ".bootstrap/soong-build-globs.ninja")
|
||||
bootstrapGlobFile := shared.JoinPath(config.SoongOutDir(), ".bootstrap/build-globs.ninja")
|
||||
bootstrapDepFile := shared.JoinPath(config.SoongOutDir(), ".bootstrap/build.ninja.d")
|
||||
|
||||
args.RunGoTests = !config.skipSoongTests
|
||||
args.UseValidations = true // Use validations to depend on tests
|
||||
@@ -115,7 +117,6 @@ func bootstrapBlueprint(ctx Context, config Config, integratedBp2Build bool) {
|
||||
args.TopFile = "Android.bp"
|
||||
args.ModuleListFile = filepath.Join(config.FileListDir(), "Android.bp.list")
|
||||
args.OutFile = shared.JoinPath(config.SoongOutDir(), ".bootstrap/build.ninja")
|
||||
args.DepFile = shared.JoinPath(config.SoongOutDir(), ".bootstrap/build.ninja.d")
|
||||
args.GlobFile = globFile
|
||||
args.GeneratingPrimaryBuilder = true
|
||||
|
||||
@@ -171,7 +172,11 @@ func bootstrapBlueprint(ctx Context, config Config, integratedBp2Build bool) {
|
||||
debugCompilation: os.Getenv("SOONG_DELVE") != "",
|
||||
}
|
||||
|
||||
bootstrap.RunBlueprint(args, blueprintCtx, blueprintConfig)
|
||||
bootstrapDeps := bootstrap.RunBlueprint(args, blueprintCtx, blueprintConfig)
|
||||
err := deptools.WriteDepFile(bootstrapDepFile, args.OutFile, bootstrapDeps)
|
||||
if err != nil {
|
||||
ctx.Fatalf("Error writing depfile '%s': %s", bootstrapDepFile, err)
|
||||
}
|
||||
}
|
||||
|
||||
func checkEnvironmentFile(currentEnv *Environment, envFile string) {
|
||||
|
Reference in New Issue
Block a user