mirror of
https://github.com/espressif/esp-idf.git
synced 2024-09-20 00:36:01 -04:00
tools: default to text output format in 'idf.py size'
This commit is contained in:
parent
f644d71d26
commit
bfc17ce35a
@ -1,4 +1,4 @@
|
|||||||
# A CMake script to run size tool commands supporting OUTPUT_FORMAT and
|
# A CMake script to run size tool commands supporting SIZE_OUTPUT_FORMAT and
|
||||||
# OUTPUT_JSON environment variables from within ninja or make or another
|
# OUTPUT_JSON environment variables from within ninja or make or another
|
||||||
# cmake-based build runner.
|
# cmake-based build runner.
|
||||||
#
|
#
|
||||||
@ -12,10 +12,16 @@ cmake_minimum_required(VERSION 3.16)
|
|||||||
|
|
||||||
set(IDF_SIZE_CMD ${IDF_SIZE_TOOL})
|
set(IDF_SIZE_CMD ${IDF_SIZE_TOOL})
|
||||||
|
|
||||||
if(DEFINED ENV{SIZE_OUTPUT_FORMAT})
|
if(NOT DEFINED ENV{SIZE_OUTPUT_FORMAT} OR "$ENV{SIZE_OUTPUT_FORMAT}" STREQUAL "default")
|
||||||
|
# Format not passed to "idf.py size" explicitly, or this target was invoked
|
||||||
|
# from make/ninja directly (without idf.py)
|
||||||
|
if(DEFINED OUTPUT_JSON AND OUTPUT_JSON)
|
||||||
|
# honor the legacy OUTPUT_JSON variable, if set
|
||||||
|
list(APPEND IDF_SIZE_CMD "--format=json")
|
||||||
|
endif()
|
||||||
|
elseif(DEFINED ENV{SIZE_OUTPUT_FORMAT})
|
||||||
|
# specific format was requested
|
||||||
list(APPEND IDF_SIZE_CMD "--format=$ENV{SIZE_OUTPUT_FORMAT}")
|
list(APPEND IDF_SIZE_CMD "--format=$ENV{SIZE_OUTPUT_FORMAT}")
|
||||||
elseif(DEFINED OUTPUT_JSON AND OUTPUT_JSON)
|
|
||||||
list(APPEND IDF_SIZE_CMD "--format=json")
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(DEFINED IDF_SIZE_MODE)
|
if(DEFINED IDF_SIZE_MODE)
|
||||||
|
@ -44,8 +44,7 @@ def action_extensions(base_actions: Dict, project_path: str) -> Any:
|
|||||||
for hint in generate_hints(stdout, stderr):
|
for hint in generate_hints(stdout, stderr):
|
||||||
yellow_print(hint)
|
yellow_print(hint)
|
||||||
|
|
||||||
if output_format:
|
os.environ['SIZE_OUTPUT_FORMAT'] = output_format
|
||||||
os.environ['SIZE_OUTPUT_FORMAT'] = output_format
|
|
||||||
ensure_build_directory(args, ctx.info_name)
|
ensure_build_directory(args, ctx.info_name)
|
||||||
run_target('all', args, force_progression=GENERATORS[args.generator].get('force_progression', False),
|
run_target('all', args, force_progression=GENERATORS[args.generator].get('force_progression', False),
|
||||||
custom_error_handler=tool_error_handler)
|
custom_error_handler=tool_error_handler)
|
||||||
@ -338,12 +337,13 @@ def action_extensions(base_actions: Dict, project_path: str) -> Any:
|
|||||||
'global_action_callbacks': [validate_root_options],
|
'global_action_callbacks': [validate_root_options],
|
||||||
}
|
}
|
||||||
|
|
||||||
# Default value is intentionally blank, so that we know if the user explicitly specified
|
# 'default' is introduced instead of simply setting 'text' as the default so that we know
|
||||||
# the format and override the OUTPUT_JSON variable if it is set
|
# if the user explicitly specified the format or not. If the format is not specified, then
|
||||||
|
# the legacy OUTPUT_JSON CMake variable will be taken into account.
|
||||||
size_options = [{'names': ['--format', 'output_format'],
|
size_options = [{'names': ['--format', 'output_format'],
|
||||||
'type': click.Choice(['text', 'csv', 'json']),
|
'type': click.Choice(['default', 'text', 'csv', 'json']),
|
||||||
'help': 'Specify output format: text, csv or json.',
|
'help': 'Specify output format: text (same as "default"), csv or json.',
|
||||||
'default': ''}]
|
'default': 'default'}]
|
||||||
|
|
||||||
build_actions = {
|
build_actions = {
|
||||||
'actions': {
|
'actions': {
|
||||||
|
Loading…
Reference in New Issue
Block a user