mirror of https://github.com/ARMmbed/mbed-os.git
Added scanning for JSON files in the resource scanner
Also added a method to add new macros to the toolchain instance. Both of these changes are needed by the configuration mechanism.
parent
83b5b474a0
commit
031cc7fbc5
|
@ -34,7 +34,6 @@ import tools.hooks as hooks
|
|||
from hashlib import md5
|
||||
import fnmatch
|
||||
|
||||
|
||||
#Disables multiprocessing if set to higher number than the host machine CPUs
|
||||
CPU_COUNT_MIN = 1
|
||||
|
||||
|
@ -55,6 +54,7 @@ def compile_worker(job):
|
|||
'results': results
|
||||
}
|
||||
|
||||
|
||||
class Resources:
|
||||
def __init__(self, base_path=None):
|
||||
self.base_path = base_path
|
||||
|
@ -82,6 +82,7 @@ class Resources:
|
|||
# Other files
|
||||
self.hex_files = []
|
||||
self.bin_files = []
|
||||
self.json_files = []
|
||||
|
||||
def __add__(self, resources):
|
||||
if resources is None:
|
||||
|
@ -118,12 +119,15 @@ class Resources:
|
|||
|
||||
self.hex_files += resources.hex_files
|
||||
self.bin_files += resources.bin_files
|
||||
self.json_files += resources.json_files
|
||||
|
||||
return self
|
||||
|
||||
def relative_to(self, base, dot=False):
|
||||
for field in ['inc_dirs', 'headers', 's_sources', 'c_sources',
|
||||
'cpp_sources', 'lib_dirs', 'objects', 'libraries',
|
||||
'lib_builds', 'lib_refs', 'repo_dirs', 'repo_files', 'hex_files', 'bin_files']:
|
||||
'lib_builds', 'lib_refs', 'repo_dirs', 'repo_files',
|
||||
'hex_files', 'bin_files', 'json_files']:
|
||||
v = [rel_path(f, base, dot) for f in getattr(self, field)]
|
||||
setattr(self, field, v)
|
||||
if self.linker_script is not None:
|
||||
|
@ -132,7 +136,8 @@ class Resources:
|
|||
def win_to_unix(self):
|
||||
for field in ['inc_dirs', 'headers', 's_sources', 'c_sources',
|
||||
'cpp_sources', 'lib_dirs', 'objects', 'libraries',
|
||||
'lib_builds', 'lib_refs', 'repo_dirs', 'repo_files', 'hex_files', 'bin_files']:
|
||||
'lib_builds', 'lib_refs', 'repo_dirs', 'repo_files',
|
||||
'hex_files', 'bin_files', 'json_files']:
|
||||
v = [f.replace('\\', '/') for f in getattr(self, field)]
|
||||
setattr(self, field, v)
|
||||
if self.linker_script is not None:
|
||||
|
@ -164,7 +169,6 @@ class Resources:
|
|||
|
||||
return '\n'.join(s)
|
||||
|
||||
|
||||
# Support legacy build conventions: the original mbed build system did not have
|
||||
# standard labels for the "TARGET_" and "TOOLCHAIN_" specific directories, but
|
||||
# had the knowledge of a list of these directories to be ignored.
|
||||
|
@ -329,6 +333,10 @@ class mbedToolchain:
|
|||
|
||||
return list(set(self.symbols)) # Return only unique symbols
|
||||
|
||||
# Extend the internal list of macros
|
||||
def add_macros(self, new_macros):
|
||||
self.macros.extend(new_macros)
|
||||
|
||||
def get_labels(self):
|
||||
if self.labels is None:
|
||||
toolchain_labels = [c.__name__ for c in getmro(self.__class__)]
|
||||
|
@ -472,6 +480,9 @@ class mbedToolchain:
|
|||
elif ext == '.bin':
|
||||
resources.bin_files.append(file_path)
|
||||
|
||||
elif ext == '.json':
|
||||
resources.json_files.append(file_path)
|
||||
|
||||
return resources
|
||||
|
||||
def scan_repository(self, path):
|
||||
|
|
Loading…
Reference in New Issue