Merge pull request #7646 from theotherjimmy/fix-incr

Tools: Fix incrimental compile dep tracking
pull/7675/head
Cruz Monrreal 2018-08-01 12:32:43 -05:00 committed by GitHub
commit 7f73a6dddf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 9 deletions

View File

@ -1124,10 +1124,14 @@ class Config(object):
Config._check_required_parameters(params) Config._check_required_parameters(params)
params_with_values = [p for p in params.values() if p.value is not None] params_with_values = [p for p in params.values() if p.value is not None]
ctx = { ctx = {
"cfg_params" : [(p.macro_name, str(p.value), p.set_by) "cfg_params": sorted([
for p in params_with_values], (p.macro_name, str(p.value), p.set_by)
"macros": [(m.macro_name, str(m.macro_value or ""), m.defined_by) for p in params_with_values
for m in macros.values()], ]),
"macros": sorted([
(m.macro_name, str(m.macro_value or ""), m.defined_by)
for m in macros.values()
]),
"name_len": max([len(m.macro_name) for m in macros.values()] + "name_len": max([len(m.macro_name) for m in macros.values()] +
[len(m.macro_name) for m in params_with_values] [len(m.macro_name) for m in params_with_values]
+ [0]), + [0]),

View File

@ -312,12 +312,17 @@ class mbedToolchain:
""" Generate a via file for a pile of defines """ Generate a via file for a pile of defines
ARM, GCC, IAR cross compatible ARM, GCC, IAR cross compatible
""" """
option_md5 = md5(' '.join(options).encode('utf-8')).hexdigest() to_write = " ".join(options).encode('utf-8')
via_file = join(self.build_dir, naming.format(option_md5)) new_md5 = md5(to_write).hexdigest()
if not exists(via_file): via_file = join(self.build_dir, naming.format(new_md5))
try:
with open(via_file, "r") as fd:
old_md5 = md5(fd.read().encode('utf-8')).hexdigest()
except IOError:
old_md5 = None
if old_md5 != new_md5:
with open(via_file, "w") as fd: with open(via_file, "w") as fd:
string = " ".join(options) fd.write(to_write)
fd.write(string)
return via_file return via_file
def get_inc_file(self, includes): def get_inc_file(self, includes):