Merge "Remove timestamp from local build number" into main am: 68f5fbf99b

Original change: https://android-review.googlesource.com/c/platform/build/soong/+/3131837

Change-Id: I5ba8743ad87e9ed2ef6a010104ff37385fcecdad
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Treehugger Robot 2024-06-13 18:49:36 +00:00 committed by Automerger Merge Worker
commit 220d0340fb

View file

@ -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