Remove timestamp from local build number
The build_info.prop file was converted to soong, which then caused it to have a stale build number due to not adding the build number file as a dependency to avoid rebuilds. I added it as a dependency to fix the staleness, but it always rebuilds locally now. I think the way it worked before, it would get stale build numbers, except that it was cleared with installclean which was always run on CI. Now that it's a soong module and generated in out/soong/.intermediates it's not cleared by installclean. I could make a system to register files that should be installclean'd from a soong module, but I'd eventually like to eliminate the need to run installclean entirely. So as an alternative, just make the build number not change every build when doing local builds, by removing the timestamp from it. Bug: 346757289 Test: m repeatedly and observe no rebuilds the second time (of the system image, the build flags infrastructure seems to do some small rebuilding) Change-Id: I0207feb739523dde3e89d1e5c4822865f641c313
This commit is contained in:
parent
a551b011d0
commit
1ae7b774eb
1 changed files with 7 additions and 5 deletions
|
@ -21,7 +21,6 @@ import (
|
|||
"path/filepath"
|
||||
"sync"
|
||||
"text/template"
|
||||
"time"
|
||||
|
||||
"android/soong/ui/metrics"
|
||||
)
|
||||
|
@ -66,9 +65,12 @@ func SetupOutDir(ctx Context, config Config) {
|
|||
// (to allow for source control that uses something other than numbers),
|
||||
// but must be a single word and a valid file name.
|
||||
//
|
||||
// If no BUILD_NUMBER is set, create a useful "I am an engineering build
|
||||
// from this date/time" value. Make it start with a non-digit so that
|
||||
// anyone trying to parse it as an integer will probably get "0".
|
||||
// If no BUILD_NUMBER is set, create a useful "I am an engineering build"
|
||||
// value. Make it start with a non-digit so that anyone trying to parse
|
||||
// it as an integer will probably get "0". This value used to contain
|
||||
// a timestamp, but now that more dependencies are tracked in order to
|
||||
// reduce the importance of `m installclean`, changing it every build
|
||||
// causes unnecessary rebuilds for local development.
|
||||
buildNumber, ok := config.environ.Get("BUILD_NUMBER")
|
||||
if ok {
|
||||
writeValueIfChanged(ctx, config, config.OutDir(), "file_name_tag.txt", buildNumber)
|
||||
|
@ -77,7 +79,7 @@ func SetupOutDir(ctx Context, config Config) {
|
|||
if username, ok = config.environ.Get("BUILD_USERNAME"); !ok {
|
||||
ctx.Fatalln("Missing BUILD_USERNAME")
|
||||
}
|
||||
buildNumber = fmt.Sprintf("eng.%.6s.%s", username, time.Now().Format("20060102.150405" /* YYYYMMDD.HHMMSS */))
|
||||
buildNumber = fmt.Sprintf("eng.%.6s.00000000.000000", username)
|
||||
writeValueIfChanged(ctx, config, config.OutDir(), "file_name_tag.txt", username)
|
||||
}
|
||||
// Write the build number to a file so it can be read back in
|
||||
|
|
Loading…
Reference in a new issue