Skip to content

Commit da9c10b

Browse files
committed
Expand build reports in the tools
1 parent bc58c1b commit da9c10b

File tree

3 files changed

+32
-9
lines changed

3 files changed

+32
-9
lines changed

tools/build_api.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
import re
1919
import tempfile
20+
import datetime
2021
from types import ListType
2122
from shutil import rmtree
2223
from os.path import join, exists, dirname, basename, abspath, normpath, splitext
@@ -102,6 +103,7 @@ def add_result_to_report(report, result):
102103
report - the report to append to
103104
result - the result to append
104105
"""
106+
result["date"] = str(datetime.datetime.now())
105107
target = result["target_name"]
106108
toolchain = result["toolchain_name"]
107109
id_name = result['id']
@@ -550,6 +552,9 @@ def build_project(src_paths, build_path, target, toolchain_name,
550552
cur_result["output"] = toolchain.get_output() + memap_table
551553
cur_result["result"] = "OK"
552554
cur_result["memory_usage"] = toolchain.map_outputs
555+
cur_result["bin"] = res
556+
cur_result["elf"] = splitext(res)[0] + ".elf"
557+
cur_result.update(toolchain.report)
553558

554559
add_result_to_report(report, cur_result)
555560

tools/config/__init__.py

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
from os.path import dirname, abspath
2121
import sys
2222
from collections import namedtuple
23-
from os.path import splitext
23+
from os.path import splitext, relpath
2424
from intelhex import IntelHex
2525
from jinja2 import FileSystemLoader, StrictUndefined
2626
from jinja2.environment import Environment
@@ -389,25 +389,25 @@ def __init__(self, tgt, top_level_dirs=None, app_config=None):
389389
search for a configuration file).
390390
"""
391391
config_errors = []
392-
app_config_location = app_config
393-
if app_config_location is None:
392+
self.app_config_location = app_config
393+
if self.app_config_location is None:
394394
for directory in top_level_dirs or []:
395395
full_path = os.path.join(directory, self.__mbed_app_config_name)
396396
if os.path.isfile(full_path):
397-
if app_config_location is not None:
397+
if self.app_config_location is not None:
398398
raise ConfigException("Duplicate '%s' file in '%s' and '%s'"
399399
% (self.__mbed_app_config_name,
400-
app_config_location, full_path))
400+
self.app_config_location, full_path))
401401
else:
402-
app_config_location = full_path
402+
self.app_config_location = full_path
403403
try:
404-
self.app_config_data = json_file_to_dict(app_config_location) \
405-
if app_config_location else {}
404+
self.app_config_data = json_file_to_dict(self.app_config_location) \
405+
if self.app_config_location else {}
406406
except ValueError as exc:
407407
self.app_config_data = {}
408408
config_errors.append(
409409
ConfigException("Could not parse mbed app configuration from %s"
410-
% app_config_location))
410+
% self.app_config_location))
411411

412412
# Check the keys in the application configuration data
413413
unknown_keys = set(self.app_config_data.keys()) - \
@@ -527,6 +527,11 @@ def regions(self):
527527
raise ConfigException("Not enough memory on device to fit all "
528528
"application regions")
529529

530+
@property
531+
def report(self):
532+
return {'app_config': self.app_config_location,
533+
'library_configs': map(relpath, self.processed_configs.keys())}
534+
530535
def _process_config_and_overrides(self, data, params, unit_name, unit_kind):
531536
"""Process "config_parameters" and "target_config_overrides" into a
532537
given dictionary

tools/toolchains/__init__.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1393,6 +1393,19 @@ def redirect_symbol(source, sync, build_dir):
13931393
def get_config_macros(self):
13941394
return Config.config_to_macros(self.config_data) if self.config_data else []
13951395

1396+
@property
1397+
def report(self):
1398+
to_ret = {}
1399+
to_ret['c_compiler'] = {'flags': copy(self.flags['c']),
1400+
'symbols': self.get_symbols()}
1401+
to_ret['cxx_compiler'] = {'flags': copy(self.flags['cxx']),
1402+
'symbols': self.get_symbols()}
1403+
to_ret['assembler'] = {'flags': copy(self.flags['asm']),
1404+
'symbols': self.get_symbols(True)}
1405+
to_ret['linker'] = {'flags': copy(self.flags['ld'])}
1406+
to_ret.update(self.config.report)
1407+
return to_ret
1408+
13961409
from tools.settings import ARM_PATH
13971410
from tools.settings import GCC_ARM_PATH
13981411
from tools.settings import IAR_PATH

0 commit comments

Comments
 (0)