Loading ui/build/build.go +9 −0 Original line number Diff line number Diff line Loading @@ -33,6 +33,15 @@ func SetupOutDir(ctx Context, config Config) { // can be parsed as ninja output. ensureEmptyFileExists(ctx, filepath.Join(config.OutDir(), "ninja_build")) ensureEmptyFileExists(ctx, filepath.Join(config.OutDir(), ".out-dir")) if buildDateTimeFile, ok := config.environ.Get("BUILD_DATETIME_FILE"); ok { err := ioutil.WriteFile(buildDateTimeFile, []byte(config.buildDateTime), 0777) if err != nil { ctx.Fatalln("Failed to write BUILD_DATETIME to file:", err) } } else { ctx.Fatalln("Missing BUILD_DATETIME_FILE") } } var combinedBuildNinjaTemplate = template.Must(template.New("combined").Parse(` Loading ui/build/config.go +9 −13 Original line number Diff line number Diff line Loading @@ -15,7 +15,6 @@ package build import ( "io/ioutil" "os" "path/filepath" "runtime" Loading @@ -34,6 +33,7 @@ type configImpl struct { goma bool environ *Environment distDir string buildDateTime string // From the arguments parallel int Loading Loading @@ -244,18 +244,14 @@ func NewConfig(ctx Context, args ...string) Config { 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 ret.buildDateTime = buildDateTime } else { content = strconv.FormatInt(time.Now().Unix(), 10) ret.buildDateTime = strconv.FormatInt(time.Now().Unix(), 10) } if ctx.Metrics != nil { ctx.Metrics.SetBuildDateTime(content) } err := ioutil.WriteFile(buildDateTimeFile, []byte(content), 0777) if err != nil { ctx.Fatalln("Failed to write BUILD_DATETIME to file:", err) ctx.Metrics.SetBuildDateTime(ret.buildDateTime) } ret.environ.Set("BUILD_DATETIME_FILE", buildDateTimeFile) Loading ui/status/log.go +2 −2 Original line number Diff line number Diff line Loading @@ -180,12 +180,12 @@ func (e *errorProtoLog) FinishAction(result ActionResult, counts Counts) { func (e *errorProtoLog) Flush() { data, err := proto.Marshal(&e.errorProto) if err != nil { e.log.Println("Failed to marshal build status proto: %v", err) e.log.Printf("Failed to marshal build status proto: %v\n", err) return } err = ioutil.WriteFile(e.filename, []byte(data), 0644) if err != nil { e.log.Println("Failed to write file %s: %v", e.errorProto, err) e.log.Printf("Failed to write file %s: %v\n", e.filename, err) } } Loading Loading
ui/build/build.go +9 −0 Original line number Diff line number Diff line Loading @@ -33,6 +33,15 @@ func SetupOutDir(ctx Context, config Config) { // can be parsed as ninja output. ensureEmptyFileExists(ctx, filepath.Join(config.OutDir(), "ninja_build")) ensureEmptyFileExists(ctx, filepath.Join(config.OutDir(), ".out-dir")) if buildDateTimeFile, ok := config.environ.Get("BUILD_DATETIME_FILE"); ok { err := ioutil.WriteFile(buildDateTimeFile, []byte(config.buildDateTime), 0777) if err != nil { ctx.Fatalln("Failed to write BUILD_DATETIME to file:", err) } } else { ctx.Fatalln("Missing BUILD_DATETIME_FILE") } } var combinedBuildNinjaTemplate = template.Must(template.New("combined").Parse(` Loading
ui/build/config.go +9 −13 Original line number Diff line number Diff line Loading @@ -15,7 +15,6 @@ package build import ( "io/ioutil" "os" "path/filepath" "runtime" Loading @@ -34,6 +33,7 @@ type configImpl struct { goma bool environ *Environment distDir string buildDateTime string // From the arguments parallel int Loading Loading @@ -244,18 +244,14 @@ func NewConfig(ctx Context, args ...string) Config { 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 ret.buildDateTime = buildDateTime } else { content = strconv.FormatInt(time.Now().Unix(), 10) ret.buildDateTime = strconv.FormatInt(time.Now().Unix(), 10) } if ctx.Metrics != nil { ctx.Metrics.SetBuildDateTime(content) } err := ioutil.WriteFile(buildDateTimeFile, []byte(content), 0777) if err != nil { ctx.Fatalln("Failed to write BUILD_DATETIME to file:", err) ctx.Metrics.SetBuildDateTime(ret.buildDateTime) } ret.environ.Set("BUILD_DATETIME_FILE", buildDateTimeFile) Loading
ui/status/log.go +2 −2 Original line number Diff line number Diff line Loading @@ -180,12 +180,12 @@ func (e *errorProtoLog) FinishAction(result ActionResult, counts Counts) { func (e *errorProtoLog) Flush() { data, err := proto.Marshal(&e.errorProto) if err != nil { e.log.Println("Failed to marshal build status proto: %v", err) e.log.Printf("Failed to marshal build status proto: %v\n", err) return } err = ioutil.WriteFile(e.filename, []byte(data), 0644) if err != nil { e.log.Println("Failed to write file %s: %v", e.errorProto, err) e.log.Printf("Failed to write file %s: %v\n", e.filename, err) } } Loading