环境
$ cat /etc/os-release
NAME="Ubuntu"
VERSION="20.04.4 LTS (Focal Fossa)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 20.04.4 LTS"
VERSION_ID="20.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=focal
UBUNTU_CODENAME=focal
调查过程
$ mgrep buildDateTime
./build/soong/ui/metrics/metrics_proto/metrics.pb.go:285: BuildDateTimestamp *int64 `protobuf:"varint,1,opt,name=build_date_timestamp,json=buildDateTimestamp" json:"build_date_timestamp,omitempty"`
./build/soong/ui/build/config.go:54: buildDateTime string
./build/soong/ui/build/config.go:417: buildDateTimeFile := filepath.Join(outDir, "build_date.txt")
./build/soong/ui/build/config.go:418: if buildDateTime, ok := ret.environ.Get("BUILD_DATETIME"); ok && buildDateTime != "" {
./build/soong/ui/build/config.go:419: ret.buildDateTime = buildDateTime
./build/soong/ui/build/config.go:421: ret.buildDateTime = strconv.FormatInt(time.Now().Unix(), 10)
./build/soong/ui/build/config.go:424: ret.environ.Set("BUILD_DATETIME_FILE", buildDateTimeFile)
./build/soong/ui/build/config.go:1388: return c.buildDateTime
./build/soong/ui/build/build.go:51: if buildDateTimeFile, ok := config.environ.Get("BUILD_DATETIME_FILE"); ok {
./build/soong/ui/build/build.go:52: err := ioutil.WriteFile(buildDateTimeFile, []byte(config.buildDateTime), 0666) // a+rw
./build/soong/ui/build/upload_test.go:138: buildDateTime: strconv.FormatInt(time.Now().UnixNano()/int64(time.Millisecond), 10),
结论
编译target的时候
export BUILD_DATETIME=`cat QSSI.13/out/build_date.txt`
<完>