blob: 481c511a0d0b72d0ae496f2711b484a57719688d [file] [log] [blame]
Dan Willemsenb82471a2018-05-17 16:37:09 -07001// 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 (
Dan Willemsenb82471a2018-05-17 16:37:09 -070018 "android/soong/ui/status"
19)
20
Dan Willemsenb82471a2018-05-17 16:37:09 -070021// NewStatusOutput returns a StatusOutput that represents the
22// current build status similarly to Ninja's built-in terminal
23// output.
24//
25// statusFormat takes nearly all the same options as NINJA_STATUS.
26// %c is currently unsupported.
Sasha Smundakc0c9ef92019-01-23 09:52:57 -080027func NewStatusOutput(w Writer, statusFormat string, quietBuild bool) status.StatusOutput {
Colin Crossce525352019-06-08 18:58:00 -070028 formatter := newFormatter(statusFormat, quietBuild)
Dan Willemsenb82471a2018-05-17 16:37:09 -070029
Colin Crossce525352019-06-08 18:58:00 -070030 if w.isSmartTerminal() {
31 return NewSmartStatusOutput(w, formatter)
Dan Willemsenb82471a2018-05-17 16:37:09 -070032 } else {
Colin Crossce525352019-06-08 18:58:00 -070033 return NewDumbStatusOutput(w, formatter)
Dan Willemsenb82471a2018-05-17 16:37:09 -070034 }
35}