Move version checking from Make into soong_ui
When kati keeps state around, it has to regenerate the ninja file every time the state is changed. So move the java version checking into soong_ui, where we can parallelize it with other operations instead of only checking it occasionally. Bug: 35970961 Test: Put java7 in PATH, m -j Test: Put java8-google in PATH, m -j Test: Put a space in TOP, m -j Test: OUT_DIR=<case-preserving fs> m -j Test: OUT_DIR=<path with space> m -j Test: DIST_DIR=<path with sapce> m -j Change-Id: I3245c8dd6d856240d17d54cb05d593dc9df71a27
This commit is contained in:
@@ -84,24 +84,38 @@ func (c *Cmd) StartOrFatal() {
|
||||
}
|
||||
}
|
||||
|
||||
func (c *Cmd) reportError(err error) {
|
||||
if err == nil {
|
||||
return
|
||||
}
|
||||
if e, ok := err.(*exec.ExitError); ok {
|
||||
c.ctx.Fatalf("%s failed with: %v", c.name, e.ProcessState.String())
|
||||
} else {
|
||||
c.ctx.Fatalf("Failed to run %s: %v", c.name, err)
|
||||
}
|
||||
}
|
||||
|
||||
// RunOrFatal is equivalent to Run, but handles the error with a call to ctx.Fatal
|
||||
func (c *Cmd) RunOrFatal() {
|
||||
if err := c.Run(); err != nil {
|
||||
if e, ok := err.(*exec.ExitError); ok {
|
||||
c.ctx.Fatalf("%s failed with: %v", c.name, e.ProcessState.String())
|
||||
} else {
|
||||
c.ctx.Fatalf("Failed to run %s: %v", c.name, err)
|
||||
}
|
||||
}
|
||||
c.reportError(c.Run())
|
||||
}
|
||||
|
||||
// WaitOrFatal is equivalent to Wait, but handles the error with a call to ctx.Fatal
|
||||
func (c *Cmd) WaitOrFatal() {
|
||||
if err := c.Wait(); err != nil {
|
||||
if e, ok := err.(*exec.ExitError); ok {
|
||||
c.ctx.Fatalf("%s failed with: %v", c.name, e.ProcessState.String())
|
||||
} else {
|
||||
c.ctx.Fatalf("Failed to run %s: %v", c.name, err)
|
||||
}
|
||||
}
|
||||
c.reportError(c.Wait())
|
||||
}
|
||||
|
||||
// OutputOrFatal is equivalent to Output, but handles the error with a call to ctx.Fatal
|
||||
func (c *Cmd) OutputOrFatal() []byte {
|
||||
ret, err := c.Output()
|
||||
c.reportError(err)
|
||||
return ret
|
||||
}
|
||||
|
||||
// CombinedOutputOrFatal is equivalent to CombinedOutput, but handles the error with
|
||||
// a call to ctx.Fatal
|
||||
func (c *Cmd) CombinedOutputOrFatal() []byte {
|
||||
ret, err := c.CombinedOutput()
|
||||
c.reportError(err)
|
||||
return ret
|
||||
}
|
||||
|
Reference in New Issue
Block a user