Provide an option to reduce build's verbosity.
am: c0c9ef9964
Change-Id: I7ae0b4a7b1a1fc20ff4c7e71b9e9c7c4db5728a3
This commit is contained in:
@@ -172,7 +172,8 @@ func main() {
|
|||||||
|
|
||||||
stat := &status.Status{}
|
stat := &status.Status{}
|
||||||
defer stat.Finish()
|
defer stat.Finish()
|
||||||
stat.AddOutput(terminal.NewStatusOutput(writer, ""))
|
stat.AddOutput(terminal.NewStatusOutput(writer, "",
|
||||||
|
build.OsEnvironment().IsEnvTrue("ANDROID_QUIET_BUILD")))
|
||||||
|
|
||||||
var failures failureCount
|
var failures failureCount
|
||||||
stat.AddOutput(&failures)
|
stat.AddOutput(&failures)
|
||||||
@@ -389,7 +390,8 @@ func buildProduct(mpctx *mpContext, product string) {
|
|||||||
Thread: mpctx.Tracer.NewThread(product),
|
Thread: mpctx.Tracer.NewThread(product),
|
||||||
Status: &status.Status{},
|
Status: &status.Status{},
|
||||||
}}
|
}}
|
||||||
ctx.Status.AddOutput(terminal.NewStatusOutput(ctx.Writer, ""))
|
ctx.Status.AddOutput(terminal.NewStatusOutput(ctx.Writer, "",
|
||||||
|
build.OsEnvironment().IsEnvTrue("ANDROID_QUIET_BUILD")))
|
||||||
|
|
||||||
config := build.NewConfig(ctx, flag.Args()...)
|
config := build.NewConfig(ctx, flag.Args()...)
|
||||||
config.Environment().Set("OUT_DIR", outDir)
|
config.Environment().Set("OUT_DIR", outDir)
|
||||||
|
@@ -78,7 +78,8 @@ func main() {
|
|||||||
|
|
||||||
stat := &status.Status{}
|
stat := &status.Status{}
|
||||||
defer stat.Finish()
|
defer stat.Finish()
|
||||||
stat.AddOutput(terminal.NewStatusOutput(writer, os.Getenv("NINJA_STATUS")))
|
stat.AddOutput(terminal.NewStatusOutput(writer, os.Getenv("NINJA_STATUS"),
|
||||||
|
build.OsEnvironment().IsEnvTrue("ANDROID_QUIET_BUILD")))
|
||||||
stat.AddOutput(trace.StatusTracer())
|
stat.AddOutput(trace.StatusTracer())
|
||||||
|
|
||||||
build.SetupSignals(log, cancel, func() {
|
build.SetupSignals(log, cancel, func() {
|
||||||
|
@@ -214,11 +214,13 @@ func runMakeProductConfig(ctx Context, config Config) {
|
|||||||
ctx.Fatalln("Error dumping make vars:", err)
|
ctx.Fatalln("Error dumping make vars:", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
env := config.Environment()
|
||||||
// Print the banner like make does
|
// Print the banner like make does
|
||||||
ctx.Writer.Print(Banner(make_vars))
|
if !env.IsEnvTrue("ANDROID_QUIET_BUILD") {
|
||||||
|
ctx.Writer.Print(Banner(make_vars))
|
||||||
|
}
|
||||||
|
|
||||||
// Populate the environment
|
// Populate the environment
|
||||||
env := config.Environment()
|
|
||||||
for _, name := range exportEnvVars {
|
for _, name := range exportEnvVars {
|
||||||
if make_vars[name] == "" {
|
if make_vars[name] == "" {
|
||||||
env.Unset(name)
|
env.Unset(name)
|
||||||
|
@@ -27,6 +27,7 @@ type statusOutput struct {
|
|||||||
format string
|
format string
|
||||||
|
|
||||||
start time.Time
|
start time.Time
|
||||||
|
quiet bool
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewStatusOutput returns a StatusOutput that represents the
|
// NewStatusOutput returns a StatusOutput that represents the
|
||||||
@@ -35,12 +36,13 @@ type statusOutput struct {
|
|||||||
//
|
//
|
||||||
// statusFormat takes nearly all the same options as NINJA_STATUS.
|
// statusFormat takes nearly all the same options as NINJA_STATUS.
|
||||||
// %c is currently unsupported.
|
// %c is currently unsupported.
|
||||||
func NewStatusOutput(w Writer, statusFormat string) status.StatusOutput {
|
func NewStatusOutput(w Writer, statusFormat string, quietBuild bool) status.StatusOutput {
|
||||||
return &statusOutput{
|
return &statusOutput{
|
||||||
writer: w,
|
writer: w,
|
||||||
format: statusFormat,
|
format: statusFormat,
|
||||||
|
|
||||||
start: time.Now(),
|
start: time.Now(),
|
||||||
|
quiet: quietBuild,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -76,13 +78,12 @@ func (s *statusOutput) FinishAction(result status.ActionResult, counts status.Co
|
|||||||
progress := s.progress(counts) + str
|
progress := s.progress(counts) + str
|
||||||
|
|
||||||
if result.Error != nil {
|
if result.Error != nil {
|
||||||
hasCommand := ""
|
targets := strings.Join(result.Outputs, " ")
|
||||||
if result.Command != "" {
|
if s.quiet || result.Command == "" {
|
||||||
hasCommand = "\n"
|
s.writer.StatusAndMessage(progress, fmt.Sprintf("FAILED: %s\n%s", targets, result.Output))
|
||||||
|
} else {
|
||||||
|
s.writer.StatusAndMessage(progress, fmt.Sprintf("FAILED: %s\n%s\n%s", targets, result.Command, result.Output))
|
||||||
}
|
}
|
||||||
|
|
||||||
s.writer.StatusAndMessage(progress, fmt.Sprintf("FAILED: %s\n%s%s%s",
|
|
||||||
strings.Join(result.Outputs, " "), result.Command, hasCommand, result.Output))
|
|
||||||
} else if result.Output != "" {
|
} else if result.Output != "" {
|
||||||
s.writer.StatusAndMessage(progress, result.Output)
|
s.writer.StatusAndMessage(progress, result.Output)
|
||||||
} else {
|
} else {
|
||||||
|
Reference in New Issue
Block a user