mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
Merge branch 'feature/build_color_output_v5.0' into 'release/v5.0'
build system, tools: enable compiler color diagnostics by default, update CMake to 3.24.0 (v5.0) See merge request espressif/esp-idf!20121
This commit is contained in:
commit
154dffb14f
@ -344,6 +344,12 @@ macro(project project_name)
|
||||
# Generate compile_commands.json (needs to come after project call).
|
||||
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
||||
|
||||
# If CMAKE_COLOR_DIAGNOSTICS not set in project CMakeLists.txt or in the environment,
|
||||
# enable it by default.
|
||||
if(NOT DEFINED CMAKE_COLOR_DIAGNOSTICS AND NOT DEFINED ENV{CMAKE_COLOR_DIAGNOSTICS})
|
||||
set(CMAKE_COLOR_DIAGNOSTICS ON)
|
||||
endif()
|
||||
|
||||
# Since components can import third-party libraries, the original definition of project() should be restored
|
||||
# before the call to add components to the build.
|
||||
function(project)
|
||||
|
@ -12,7 +12,6 @@ GENERATORS: Dict[str, Union[str, Dict, list]] = collections.OrderedDict([
|
||||
# - dry_run: command to run in dry run mode
|
||||
# - verbose_flag: verbose flag
|
||||
# - force_progression: one liner status of the progress
|
||||
# - envvar: environment variables
|
||||
('Ninja', {
|
||||
'command': ['ninja'],
|
||||
'version': ['ninja', '--version'],
|
||||
@ -20,7 +19,6 @@ GENERATORS: Dict[str, Union[str, Dict, list]] = collections.OrderedDict([
|
||||
'verbose_flag': '-v',
|
||||
# as opposed to printing the status updates each in a in new line
|
||||
'force_progression': True,
|
||||
'envvar': {}
|
||||
}),
|
||||
])
|
||||
|
||||
@ -30,9 +28,7 @@ if os.name != 'nt':
|
||||
'version': [MAKE_CMD, '--version'],
|
||||
'dry_run': [MAKE_CMD, '-n'],
|
||||
'verbose_flag': 'VERBOSE=1',
|
||||
'force_progression': False,
|
||||
# CLICOLOR_FORCE if set forcing make to print ANSI escape sequence
|
||||
'envvar': {'CLICOLOR_FORCE': '1'}}
|
||||
'force_progression': False}
|
||||
|
||||
URL_TO_DOC = 'https://docs.espressif.com/projects/esp-idf'
|
||||
|
||||
|
@ -233,12 +233,6 @@ class RunTool:
|
||||
ansi_escape = re.compile(r'\x1B(?:[@-Z\\-_]|\[[0-?]*[ -/]*[@-~])')
|
||||
return ansi_escape.sub('', text)
|
||||
|
||||
def prepare_for_print(out: str) -> str:
|
||||
if not output_stream.isatty():
|
||||
# delete escape sequence if we printing in environments where ANSI coloring is disabled
|
||||
return delete_ansi_escape(out)
|
||||
return out
|
||||
|
||||
def print_progression(output: str) -> None:
|
||||
# Print a new line on top of the previous line
|
||||
sys.stdout.write('\x1b[K')
|
||||
@ -279,8 +273,15 @@ class RunTool:
|
||||
output = await read_stream()
|
||||
if not output:
|
||||
break
|
||||
output = prepare_for_print(output)
|
||||
output_file.write(output)
|
||||
output_noescape = delete_ansi_escape(output)
|
||||
# Always remove escape sequences when writing the build log.
|
||||
output_file.write(output_noescape)
|
||||
# If idf.py output is redirected and the output stream is not a TTY,
|
||||
# strip the escape sequences as well.
|
||||
# (There shouldn't be any, but just in case.)
|
||||
if not output_stream.isatty():
|
||||
output = output_noescape
|
||||
|
||||
if self.force_progression and output[0] == '[' and '-v' not in self.args and output_stream.isatty():
|
||||
# print output in progression way but only the progression related (that started with '[') and if verbose flag is not set
|
||||
print_progression(output)
|
||||
@ -304,11 +305,17 @@ def run_target(target_name: str, args: 'PropertyDict', env: Optional[Dict]=None,
|
||||
env = {}
|
||||
|
||||
generator_cmd = GENERATORS[args.generator]['command']
|
||||
env.update(GENERATORS[args.generator]['envvar'])
|
||||
|
||||
if args.verbose:
|
||||
generator_cmd += [GENERATORS[args.generator]['verbose_flag']]
|
||||
|
||||
# By default, GNU Make and Ninja strip away color escape sequences when they see that their stdout is redirected.
|
||||
# If idf.py's stdout is not redirected, the final output is a TTY, so we can tell Make/Ninja to disable stripping
|
||||
# of color escape sequences. (Requires Ninja v1.9.0 or later.)
|
||||
if sys.stdout.isatty():
|
||||
if 'CLICOLOR_FORCE' not in env:
|
||||
env['CLICOLOR_FORCE'] = '1'
|
||||
|
||||
RunTool(generator_cmd[0], generator_cmd + [target_name], args.build_dir, env, custom_error_handler, hints=not args.no_hints,
|
||||
force_progression=force_progression, interactive=interactive)()
|
||||
|
||||
|
@ -689,46 +689,46 @@
|
||||
"versions": [
|
||||
{
|
||||
"linux-amd64": {
|
||||
"sha256": "f3c654b2e226b9d43369e0bd8487c51618d4dbe5a1af929dd32af7e6ca432d60",
|
||||
"size": 45998644,
|
||||
"url": "https://github.com/Kitware/CMake/releases/download/v3.23.1/cmake-3.23.1-linux-x86_64.tar.gz"
|
||||
"sha256": "726f88e6598523911e4bce9b059dc20b851aa77f97e4cc5573f4e42775a5c16f",
|
||||
"size": 47042675,
|
||||
"url": "https://github.com/Kitware/CMake/releases/download/v3.24.0/cmake-3.24.0-linux-x86_64.tar.gz"
|
||||
},
|
||||
"linux-arm64": {
|
||||
"sha256": "74062efddeb935bce3d33694a4db534cef9a650f77a9a153a9f217d9dc385c75",
|
||||
"size": 47458032,
|
||||
"url": "https://github.com/Kitware/CMake/releases/download/v3.23.1/cmake-3.23.1-linux-aarch64.tar.gz"
|
||||
"sha256": "50c3b8e9d3a3cde850dd1ea143df9d1ae546cbc5e74dc6d223eefc1979189651",
|
||||
"size": 48478082,
|
||||
"url": "https://github.com/Kitware/CMake/releases/download/v3.24.0/cmake-3.24.0-linux-aarch64.tar.gz"
|
||||
},
|
||||
"linux-armel": {
|
||||
"sha256": "aa6079237e16cc3b389479b2f7279d07e57f6aedad520e2b3014ef97fb906466",
|
||||
"size": 19330381,
|
||||
"url": "https://dl.espressif.com/dl/cmake/cmake-3.23.1-Linux-armv7l.tar.gz"
|
||||
"sha256": "7dc787ef968dfef92491a4f191b8739ff70f8a649608b811c7a737b52481beb0",
|
||||
"size": 19811327,
|
||||
"url": "https://dl.espressif.com/dl/cmake/cmake-3.24.0-Linux-armv7l.tar.gz"
|
||||
},
|
||||
"linux-armhf": {
|
||||
"sha256": "aa6079237e16cc3b389479b2f7279d07e57f6aedad520e2b3014ef97fb906466",
|
||||
"size": 19330381,
|
||||
"url": "https://dl.espressif.com/dl/cmake/cmake-3.23.1-Linux-armv7l.tar.gz"
|
||||
"sha256": "7dc787ef968dfef92491a4f191b8739ff70f8a649608b811c7a737b52481beb0",
|
||||
"size": 19811327,
|
||||
"url": "https://dl.espressif.com/dl/cmake/cmake-3.24.0-Linux-armv7l.tar.gz"
|
||||
},
|
||||
"macos": {
|
||||
"sha256": "f794ed92ccb4e9b6619a77328f313497d7decf8fb7e047ba35a348b838e0e1e2",
|
||||
"size": 70988516,
|
||||
"url": "https://github.com/Kitware/CMake/releases/download/v3.23.1/cmake-3.23.1-macos-universal.tar.gz"
|
||||
"sha256": "3e0cca74a56d9027dabb845a5a26e42ef8e8b33beb1655d6a724187a345145e4",
|
||||
"size": 72801419,
|
||||
"url": "https://github.com/Kitware/CMake/releases/download/v3.24.0/cmake-3.24.0-macos-universal.tar.gz"
|
||||
},
|
||||
"macos-arm64": {
|
||||
"sha256": "f794ed92ccb4e9b6619a77328f313497d7decf8fb7e047ba35a348b838e0e1e2",
|
||||
"size": 70988516,
|
||||
"url": "https://github.com/Kitware/CMake/releases/download/v3.23.1/cmake-3.23.1-macos-universal.tar.gz"
|
||||
"sha256": "3e0cca74a56d9027dabb845a5a26e42ef8e8b33beb1655d6a724187a345145e4",
|
||||
"size": 72801419,
|
||||
"url": "https://github.com/Kitware/CMake/releases/download/v3.24.0/cmake-3.24.0-macos-universal.tar.gz"
|
||||
},
|
||||
"name": "3.23.1",
|
||||
"name": "3.24.0",
|
||||
"status": "recommended",
|
||||
"win32": {
|
||||
"sha256": "9b509cc4eb7191dc128cfa3f2170036f9cbc7d9d5f93ff7fafc5b2d77b3b40dc",
|
||||
"size": 39070972,
|
||||
"url": "https://github.com/Kitware/CMake/releases/download/v3.23.1/cmake-3.23.1-windows-x86_64.zip"
|
||||
"sha256": "b1ad8c2dbf0778e3efcc9fd61cd4a962e5c1af40aabdebee3d5074bcff2e103c",
|
||||
"size": 40212531,
|
||||
"url": "https://github.com/Kitware/CMake/releases/download/v3.24.0/cmake-3.24.0-windows-x86_64.zip"
|
||||
},
|
||||
"win64": {
|
||||
"sha256": "9b509cc4eb7191dc128cfa3f2170036f9cbc7d9d5f93ff7fafc5b2d77b3b40dc",
|
||||
"size": 39070972,
|
||||
"url": "https://github.com/Kitware/CMake/releases/download/v3.23.1/cmake-3.23.1-windows-x86_64.zip"
|
||||
"sha256": "b1ad8c2dbf0778e3efcc9fd61cd4a962e5c1af40aabdebee3d5074bcff2e103c",
|
||||
"size": 40212531,
|
||||
"url": "https://github.com/Kitware/CMake/releases/download/v3.24.0/cmake-3.24.0-windows-x86_64.zip"
|
||||
}
|
||||
},
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user