mirror of https://github.com/ARMmbed/mbed-os.git
[build tools] Fixed masked out configuration error
parent
f45dc15aa8
commit
41daccf8d9
|
@ -121,6 +121,7 @@ def get_config(src_path, target, toolchain_name):
|
||||||
resources += resources.features[feature]
|
resources += resources.features[feature]
|
||||||
|
|
||||||
prev_features = features
|
prev_features = features
|
||||||
|
config.validate_config()
|
||||||
|
|
||||||
cfg, macros = config.get_config_data()
|
cfg, macros = config.get_config_data()
|
||||||
features = config.get_features()
|
features = config.get_features()
|
||||||
|
@ -229,6 +230,7 @@ def build_project(src_path, build_path, target, toolchain_name,
|
||||||
resources += resources.features[feature]
|
resources += resources.features[feature]
|
||||||
|
|
||||||
prev_features = features
|
prev_features = features
|
||||||
|
config.validate_config()
|
||||||
|
|
||||||
# And add the configuration macros to the toolchain
|
# And add the configuration macros to the toolchain
|
||||||
toolchain.add_macros(config.get_config_data_macros())
|
toolchain.add_macros(config.get_config_data_macros())
|
||||||
|
@ -394,6 +396,7 @@ def build_library(src_paths, build_path, target, toolchain_name,
|
||||||
resources += resources.features[feature]
|
resources += resources.features[feature]
|
||||||
|
|
||||||
prev_features = features
|
prev_features = features
|
||||||
|
config.validate_config()
|
||||||
|
|
||||||
# And add the configuration macros to the toolchain
|
# And add the configuration macros to the toolchain
|
||||||
toolchain.add_macros(config.get_config_data_macros())
|
toolchain.add_macros(config.get_config_data_macros())
|
||||||
|
|
|
@ -40,6 +40,7 @@ class ConfigParameter:
|
||||||
self.value = data.get("value", None)
|
self.value = data.get("value", None)
|
||||||
self.required = data.get("required", False)
|
self.required = data.get("required", False)
|
||||||
self.macro_name = data.get("macro_name", "MBED_CONF_%s" % self.sanitize(self.name.upper()))
|
self.macro_name = data.get("macro_name", "MBED_CONF_%s" % self.sanitize(self.name.upper()))
|
||||||
|
self.config_errors = []
|
||||||
|
|
||||||
# Return the full (prefixed) name of a parameter.
|
# Return the full (prefixed) name of a parameter.
|
||||||
# If the parameter already has a prefix, check if it is valid
|
# If the parameter already has a prefix, check if it is valid
|
||||||
|
@ -242,6 +243,7 @@ class Config:
|
||||||
# unit_name: the unit (library/application) that defines this parameter
|
# unit_name: the unit (library/application) that defines this parameter
|
||||||
# unit_kind: the kind of the unit ("library" or "application")
|
# unit_kind: the kind of the unit ("library" or "application")
|
||||||
def _process_config_and_overrides(self, data, params, unit_name, unit_kind):
|
def _process_config_and_overrides(self, data, params, unit_name, unit_kind):
|
||||||
|
self.config_errors = []
|
||||||
self._process_config_parameters(data.get("config", {}), params, unit_name, unit_kind)
|
self._process_config_parameters(data.get("config", {}), params, unit_name, unit_kind)
|
||||||
for label, overrides in data.get("target_overrides", {}).items():
|
for label, overrides in data.get("target_overrides", {}).items():
|
||||||
# If the label is defined by the target or it has the special value "*", process the overrides
|
# If the label is defined by the target or it has the special value "*", process the overrides
|
||||||
|
@ -268,6 +270,9 @@ class Config:
|
||||||
full_name = ConfigParameter.get_full_name(name, unit_name, unit_kind, label)
|
full_name = ConfigParameter.get_full_name(name, unit_name, unit_kind, label)
|
||||||
if full_name in params:
|
if full_name in params:
|
||||||
params[full_name].set_value(v, unit_name, unit_kind, label)
|
params[full_name].set_value(v, unit_name, unit_kind, label)
|
||||||
|
else:
|
||||||
|
self.config_errors.append(ConfigException("Attempt to override undefined parameter '%s' in '%s'"
|
||||||
|
% (full_name, ConfigParameter.get_display_name(unit_name, unit_kind, label))))
|
||||||
return params
|
return params
|
||||||
|
|
||||||
# Read and interpret configuration data defined by targets
|
# Read and interpret configuration data defined by targets
|
||||||
|
@ -376,4 +381,10 @@ class Config:
|
||||||
raise ConfigException("Feature '%s' is not a supported features" % feature)
|
raise ConfigException("Feature '%s' is not a supported features" % feature)
|
||||||
|
|
||||||
return features
|
return features
|
||||||
|
|
||||||
|
# Validate configuration settings. This either returns True or raises an exception
|
||||||
|
def validate_config(self):
|
||||||
|
if self.config_errors:
|
||||||
|
raise self.config_errors[0]
|
||||||
|
return True
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue