Add a post-build step for dist builds that records what changed in the build.
This will be used to skip tests when related files (or nothing) has changed. Also minor refactoring of evaluateWhatToRun to put the logic all in one place. Change-Id: Ia56b251716f6b6640bc5526a597cf7c066231e99 Test: go test, m (with soong tests), manually verify
This commit is contained in:
@@ -102,9 +102,9 @@ const (
|
||||
// Whether to include the kati-generated ninja file in the combined ninja.
|
||||
RunKatiNinja = 1 << iota
|
||||
// Whether to run ninja on the combined ninja.
|
||||
RunNinja = 1 << iota
|
||||
RunBuildTests = 1 << iota
|
||||
RunAll = RunProductConfig | RunSoong | RunKati | RunKatiNinja | RunNinja
|
||||
RunNinja = 1 << iota
|
||||
RunDistActions = 1 << iota
|
||||
RunBuildTests = 1 << iota
|
||||
)
|
||||
|
||||
// checkBazelMode fails the build if there are conflicting arguments for which bazel
|
||||
@@ -322,34 +322,42 @@ func Build(ctx Context, config Config) {
|
||||
|
||||
runNinjaForBuild(ctx, config)
|
||||
}
|
||||
|
||||
if what&RunDistActions != 0 {
|
||||
runDistActions(ctx, config)
|
||||
}
|
||||
}
|
||||
|
||||
func evaluateWhatToRun(config Config, verboseln func(v ...interface{})) int {
|
||||
//evaluate what to run
|
||||
what := RunAll
|
||||
what := 0
|
||||
if config.Checkbuild() {
|
||||
what |= RunBuildTests
|
||||
}
|
||||
if config.SkipConfig() {
|
||||
if !config.SkipConfig() {
|
||||
what |= RunProductConfig
|
||||
} else {
|
||||
verboseln("Skipping Config as requested")
|
||||
what = what &^ RunProductConfig
|
||||
}
|
||||
if config.SkipKati() {
|
||||
verboseln("Skipping Kati as requested")
|
||||
what = what &^ RunKati
|
||||
}
|
||||
if config.SkipKatiNinja() {
|
||||
verboseln("Skipping use of Kati ninja as requested")
|
||||
what = what &^ RunKatiNinja
|
||||
}
|
||||
if config.SkipSoong() {
|
||||
if !config.SkipSoong() {
|
||||
what |= RunSoong
|
||||
} else {
|
||||
verboseln("Skipping use of Soong as requested")
|
||||
what = what &^ RunSoong
|
||||
}
|
||||
|
||||
if config.SkipNinja() {
|
||||
if !config.SkipKati() {
|
||||
what |= RunKati
|
||||
} else {
|
||||
verboseln("Skipping Kati as requested")
|
||||
}
|
||||
if !config.SkipKatiNinja() {
|
||||
what |= RunKatiNinja
|
||||
} else {
|
||||
verboseln("Skipping use of Kati ninja as requested")
|
||||
}
|
||||
if !config.SkipNinja() {
|
||||
what |= RunNinja
|
||||
} else {
|
||||
verboseln("Skipping Ninja as requested")
|
||||
what = what &^ RunNinja
|
||||
}
|
||||
|
||||
if !config.SoongBuildInvocationNeeded() {
|
||||
@@ -361,6 +369,11 @@ func evaluateWhatToRun(config Config, verboseln func(v ...interface{})) int {
|
||||
what = what &^ RunNinja
|
||||
what = what &^ RunKati
|
||||
}
|
||||
|
||||
if config.Dist() {
|
||||
what |= RunDistActions
|
||||
}
|
||||
|
||||
return what
|
||||
}
|
||||
|
||||
@@ -419,3 +432,9 @@ func distFile(ctx Context, config Config, src string, subDirs ...string) {
|
||||
}
|
||||
}()
|
||||
}
|
||||
|
||||
// Actions to run on every build where 'dist' is in the actions.
|
||||
// Be careful, anything added here slows down EVERY CI build
|
||||
func runDistActions(ctx Context, config Config) {
|
||||
runStagingSnapshot(ctx, config)
|
||||
}
|
||||
|
Reference in New Issue
Block a user