Merge "Remove timestamp from local build number" into main

This commit is contained in:
Treehugger Robot
2024-06-13 18:45:09 +00:00
committed by Gerrit Code Review

View File

@@ -21,7 +21,6 @@ import (
"path/filepath" "path/filepath"
"sync" "sync"
"text/template" "text/template"
"time"
"android/soong/ui/metrics" "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), // (to allow for source control that uses something other than numbers),
// but must be a single word and a valid file name. // 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 // 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 // value. Make it start with a non-digit so that anyone trying to parse
// anyone trying to parse it as an integer will probably get "0". // 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") buildNumber, ok := config.environ.Get("BUILD_NUMBER")
if ok { if ok {
writeValueIfChanged(ctx, config, config.OutDir(), "file_name_tag.txt", buildNumber) 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 { if username, ok = config.environ.Get("BUILD_USERNAME"); !ok {
ctx.Fatalln("Missing BUILD_USERNAME") 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) writeValueIfChanged(ctx, config, config.OutDir(), "file_name_tag.txt", username)
} }
// Write the build number to a file so it can be read back in // Write the build number to a file so it can be read back in