mirror of https://github.com/ARMmbed/mbed-os.git
Added proper support for the extra_labels target override
Due to dependencies between the config/target systems, the config has been modified to preparse the mbed_app.json for overrides. This means that attributes with dependencies in the targets are only valid at the application level. A hard error has been added for these attributes if they are supplied at the library level.pull/2215/head
parent
f2051b217a
commit
9bd7a2fe72
|
@ -223,6 +223,9 @@ class Config:
|
|||
self.cumulative_overrides = { key: ConfigCumulativeOverride(key)
|
||||
for key in Target._Target__cumulative_attributes }
|
||||
|
||||
self._process_config_and_overrides(self.app_config_data, {}, "app", "application")
|
||||
self.target_labels = Target.get_target(self.target).get_labels()
|
||||
|
||||
# Add one or more configuration files
|
||||
def add_config_files(self, flist):
|
||||
for f in flist:
|
||||
|
@ -268,6 +271,12 @@ class Config:
|
|||
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 (label == '*') or (label in self.target_labels):
|
||||
# Check for invalid cumulative overrides in libraries
|
||||
if (unit_kind == 'library' and
|
||||
any(attr.startswith('target.extra_labels') for attr in overrides.iterkeys())):
|
||||
raise ConfigException("Target override '%s' in '%s' is only allowed at the application level"
|
||||
% ("target.extra_labels", ConfigParameter.get_display_name(unit_name, unit_kind, label)))
|
||||
|
||||
# Parse out cumulative overrides
|
||||
for attr, cumulatives in self.cumulative_overrides.iteritems():
|
||||
if 'target.'+attr in overrides:
|
||||
|
|
Loading…
Reference in New Issue