1// Copyright 2018 Google Inc. All rights reserved. 2// 3// Licensed under the Apache License, Version 2.0 (the "License"); 4// you may not use this file except in compliance with the License. 5// You may obtain a copy of the License at 6// 7// http://www.apache.org/licenses/LICENSE-2.0 8// 9// Unless required by applicable law or agreed to in writing, software 10// distributed under the License is distributed on an "AS IS" BASIS, 11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12// See the License for the specific language governing permissions and 13// limitations under the License. 14 15package terminal 16 17import ( 18 "io" 19 20 "android/soong/ui/status" 21) 22 23// NewStatusOutput returns a StatusOutput that represents the 24// current build status similarly to Ninja's built-in terminal 25// output. 26// 27// statusFormat takes nearly all the same options as NINJA_STATUS. 28// %c is currently unsupported. 29func NewStatusOutput(w io.Writer, statusFormat string, forceSimpleOutput, quietBuild bool) status.StatusOutput { 30 formatter := newFormatter(statusFormat, quietBuild) 31 32 if !forceSimpleOutput && isSmartTerminal(w) { 33 return NewSmartStatusOutput(w, formatter) 34 } else { 35 return NewSimpleStatusOutput(w, formatter) 36 } 37} 38