Revert "Generate build_number.txt only once"
This reverts commit ab6e524709
.
Reason for revert: DroidMonitor-triggered revert due to breakage https://android-build.corp.google.com/builds/quarterdeck?branch=aosp-main&target=ndk&lkgb=10879153&lkbb=10879224&fkbb=10879224, bug b/302608661.
Change-Id: I07d47a92ea9a9f5d329e813859316decfd75cde1
BUG: 302608661
This commit is contained in:
committed by
Gerrit Code Review
parent
ab6e524709
commit
f852b72a22
@@ -15,13 +15,11 @@
|
||||
package build
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"sync"
|
||||
"text/template"
|
||||
"time"
|
||||
|
||||
"android/soong/ui/metrics"
|
||||
)
|
||||
@@ -58,31 +56,6 @@ func SetupOutDir(ctx Context, config Config) {
|
||||
} else {
|
||||
ctx.Fatalln("Missing BUILD_DATETIME_FILE")
|
||||
}
|
||||
|
||||
// BUILD_NUMBER should be set to the source control value that
|
||||
// represents the current state of the source code. E.g., a
|
||||
// perforce changelist number or a git hash. Can be an arbitrary string
|
||||
// (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".
|
||||
buildNumber, ok := config.environ.Get("BUILD_NUMBER")
|
||||
if ok {
|
||||
writeValueIfChanged(ctx, config, config.OutDir(), "file_name_tag.txt", buildNumber)
|
||||
} else {
|
||||
var username string
|
||||
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 */))
|
||||
writeValueIfChanged(ctx, config, config.OutDir(), "file_name_tag.txt", username)
|
||||
}
|
||||
// Write the build number to a file so it can be read back in
|
||||
// without changing the command line every time. Avoids rebuilds
|
||||
// when using ninja.
|
||||
writeValueIfChanged(ctx, config, config.SoongOutDir(), "build_number.txt", buildNumber)
|
||||
}
|
||||
|
||||
var combinedBuildNinjaTemplate = template.Must(template.New("combined").Parse(`
|
||||
|
Reference in New Issue
Block a user