diff options
author | 2020-03-19 18:23:26 -0700 | |
---|---|---|
committer | 2020-03-19 18:23:26 -0700 | |
commit | 85f227eed73d98cff60946eb7a450f53e9d362d0 (patch) | |
tree | 0e733056917b356cf3661ac163b64674db964cdd /ui/status/log.go | |
parent | f59730185355ff5caa5ac675ab78e2be96000804 (diff) |
Generate the build_error protobuf file on first build action error.
buld_error protobuf file is created the moment a build action failed.
This is for external system to detect immediately what caused the
build failure while monitoring the build_progress.pb file.
Bug: b/150401146
Test: * m nothing
* Built successfully aosp_arm-eng and checked build_error file
was not created.
* Modified a cpp file to cause a build failed. Ran m and build
failed. Checked immediately during the build that the
build_error file was created.
* m clean; m and during build, checked if build_error was
removed.
Change-Id: I778616ae8cf242b49ad263b79c93321959112caa
Diffstat (limited to 'ui/status/log.go')
-rw-r--r-- | ui/status/log.go | 19 |
1 files changed, 5 insertions, 14 deletions
diff --git a/ui/status/log.go b/ui/status/log.go index db5c351d5..4a08acbaf 100644 --- a/ui/status/log.go +++ b/ui/status/log.go @@ -178,26 +178,17 @@ func (e *errorProtoLog) FinishAction(result ActionResult, counts Counts) { Artifacts: result.Outputs, Error: proto.String(result.Error.Error()), }) -} -func (e *errorProtoLog) Flush() { - // Don't create the build error proto file if there is action errors. - if len(e.errorProto.ActionErrors) == 0 { - return - } - - data, err := proto.Marshal(&e.errorProto) - if err != nil { - e.log.Printf("Failed to marshal build status proto: %v\n", err) - return - } - - err = ioutil.WriteFile(e.filename, []byte(data), 0644) + err := writeToFile(&e.errorProto, e.filename) if err != nil { e.log.Printf("Failed to write file %s: %v\n", e.filename, err) } } +func (e *errorProtoLog) Flush() { + //Not required. +} + func (e *errorProtoLog) Message(level MsgLevel, message string) { if level > ErrorLvl { e.errorProto.ErrorMessages = append(e.errorProto.ErrorMessages, message) |