Let Soong_UI to handle build_date.txt file am: 2e6a4ff3be
am: cb33597d5a
Change-Id: Ieaacc296ec376c5cce9e01d30ee284e4174f5e5b
This commit is contained in:
commit
eaf13c4c36
1 changed files with 16 additions and 0 deletions
|
@ -15,12 +15,14 @@
|
||||||
package build
|
package build
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"io/ioutil"
|
||||||
"log"
|
"log"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"runtime"
|
"runtime"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
"time"
|
||||||
|
|
||||||
"android/soong/shared"
|
"android/soong/shared"
|
||||||
)
|
)
|
||||||
|
@ -181,6 +183,20 @@ func NewConfig(ctx Context, args ...string) Config {
|
||||||
ret.environ.Set("ANDROID_JAVA9_HOME", java9Home)
|
ret.environ.Set("ANDROID_JAVA9_HOME", java9Home)
|
||||||
ret.environ.Set("PATH", strings.Join(newPath, string(filepath.ListSeparator)))
|
ret.environ.Set("PATH", strings.Join(newPath, string(filepath.ListSeparator)))
|
||||||
|
|
||||||
|
outDir := ret.OutDir()
|
||||||
|
buildDateTimeFile := filepath.Join(outDir, "build_date.txt")
|
||||||
|
var content string
|
||||||
|
if buildDateTime, ok := ret.environ.Get("BUILD_DATETIME"); ok && buildDateTime != "" {
|
||||||
|
content = buildDateTime
|
||||||
|
} else {
|
||||||
|
content = strconv.FormatInt(time.Now().Unix(), 10)
|
||||||
|
}
|
||||||
|
err := ioutil.WriteFile(buildDateTimeFile, []byte(content), 0777)
|
||||||
|
if err != nil {
|
||||||
|
ctx.Fatalln("Failed to write BUILD_DATETIME to file:", err)
|
||||||
|
}
|
||||||
|
ret.environ.Set("BUILD_DATETIME_FILE", buildDateTimeFile)
|
||||||
|
|
||||||
return Config{ret}
|
return Config{ret}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue