clang/win: Make diagnostics colored if ansicon is around at runhooks time.

BUG=82385
TEST=Run gyp or gn with ansicon active, build. Diagnostics should be colored
in cmd.exe.

Review URL: https://codereview.chromium.org/1194823004

Cr-Original-Commit-Position: refs/heads/master@{#335394}
Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src
Cr-Mirrored-Commit: 59fc7718fefd2c93e1acd94c4d5a405949a0cf10
This commit is contained in:
thakis 2015-06-19 16:43:34 -07:00 коммит произвёл Commit bot
Родитель b2069d66aa
Коммит e72f6f6aae
3 изменённых файлов: 29 добавлений и 0 удалений

Просмотреть файл

@ -5760,6 +5760,17 @@
],
},
}],
['clang==1 and "<!(python <(DEPTH)/build/win/use_ansi_codes.py)"=="True"', {
'VCCLCompilerTool': {
'AdditionalOptions': [
# cmd.exe doesn't understand ANSI escape codes by default,
# so only enable them if something emulating them is around.
'-fansi-escape-codes',
# Also see http://crbug.com/110262
'-fcolor-diagnostics',
],
},
}],
],
},
},

Просмотреть файл

@ -130,6 +130,14 @@ config("compiler") {
} else {
cflags += [ "-m64" ]
}
if (exec_script("//build/win/use_ansi_codes.py", [], "trim string") ==
"True") {
cflags += [
# cmd.exe doesn't understand ANSI escape codes by default,
# so only enable them if something emulating them is around.
"-fansi-escape-codes",
]
}
}
} else {
# Common GCC compiler flags setup.

10
win/use_ansi_codes.py Executable file
Просмотреть файл

@ -0,0 +1,10 @@
#!/usr/bin/env python
# Copyright (c) 2015 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Prints if the the terminal is likely to understand ANSI codes."""
import os
# Add more terminals here as needed.
print 'ANSICON' in os.environ