mirror of https://github.com/ARMmbed/mbed-os.git
Merge pull request #6658 from theotherjimmy/lib-override-target
Allow library configs to override target configspull/6686/head
commit
42d77ecd13
|
@ -117,7 +117,7 @@ class ConfigParameter(object):
|
||||||
unit_name, unit_kind, label)))
|
unit_name, unit_kind, label)))
|
||||||
prefix = temp[0]
|
prefix = temp[0]
|
||||||
# Check if the given parameter prefix matches the expected prefix
|
# Check if the given parameter prefix matches the expected prefix
|
||||||
if (unit_kind == "library" and prefix != unit_name) or \
|
if (unit_kind == "library" and prefix not in [unit_name, "target"]) or \
|
||||||
(unit_kind == "target" and prefix != "target"):
|
(unit_kind == "target" and prefix != "target"):
|
||||||
raise ConfigException(
|
raise ConfigException(
|
||||||
"Invalid prefix '%s' for parameter name '%s' in '%s'" %
|
"Invalid prefix '%s' for parameter name '%s' in '%s'" %
|
||||||
|
@ -858,21 +858,20 @@ class Config(object):
|
||||||
params[full_name].set_value(val, tname, "target")
|
params[full_name].set_value(val, tname, "target")
|
||||||
return params
|
return params
|
||||||
|
|
||||||
def get_lib_config_data(self):
|
def get_lib_config_data(self, target_data):
|
||||||
""" Read and interpret configuration data defined by libraries. It is
|
""" Read and interpret configuration data defined by libraries. It is
|
||||||
assumed that "add_config_files" above was already called and the library
|
assumed that "add_config_files" above was already called and the library
|
||||||
configuration data exists in self.lib_config_data
|
configuration data exists in self.lib_config_data
|
||||||
|
|
||||||
Arguments: None
|
Arguments: None
|
||||||
"""
|
"""
|
||||||
all_params, macros = {}, {}
|
macros = {}
|
||||||
for lib_name, lib_data in self.lib_config_data.items():
|
for lib_name, lib_data in self.lib_config_data.items():
|
||||||
all_params.update(self._process_config_and_overrides(lib_data, {},
|
self._process_config_and_overrides(
|
||||||
lib_name,
|
lib_data, target_data, lib_name, "library")
|
||||||
"library"))
|
|
||||||
_process_macros(lib_data.get("macros", []), macros, lib_name,
|
_process_macros(lib_data.get("macros", []), macros, lib_name,
|
||||||
"library")
|
"library")
|
||||||
return all_params, macros
|
return target_data, macros
|
||||||
|
|
||||||
def get_app_config_data(self, params, macros):
|
def get_app_config_data(self, params, macros):
|
||||||
""" Read and interpret the configuration data defined by the target. The
|
""" Read and interpret the configuration data defined by the target. The
|
||||||
|
@ -902,10 +901,9 @@ class Config(object):
|
||||||
Arguments: None
|
Arguments: None
|
||||||
"""
|
"""
|
||||||
all_params = self.get_target_config_data()
|
all_params = self.get_target_config_data()
|
||||||
lib_params, macros = self.get_lib_config_data()
|
lib_params, macros = self.get_lib_config_data(all_params)
|
||||||
all_params.update(lib_params)
|
self.get_app_config_data(lib_params, macros)
|
||||||
self.get_app_config_data(all_params, macros)
|
return lib_params, macros
|
||||||
return all_params, macros
|
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _check_required_parameters(params):
|
def _check_required_parameters(params):
|
||||||
|
|
Loading…
Reference in New Issue