Skip to content

Commit 9bd7a2f

Browse files
committed
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.
1 parent f2051b2 commit 9bd7a2f

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

tools/config.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,9 @@ def __init__(self, target, top_level_dirs = []):
223223
self.cumulative_overrides = { key: ConfigCumulativeOverride(key)
224224
for key in Target._Target__cumulative_attributes }
225225

226+
self._process_config_and_overrides(self.app_config_data, {}, "app", "application")
227+
self.target_labels = Target.get_target(self.target).get_labels()
228+
226229
# Add one or more configuration files
227230
def add_config_files(self, flist):
228231
for f in flist:
@@ -268,6 +271,12 @@ def _process_config_and_overrides(self, data, params, unit_name, unit_kind):
268271
for label, overrides in data.get("target_overrides", {}).items():
269272
# If the label is defined by the target or it has the special value "*", process the overrides
270273
if (label == '*') or (label in self.target_labels):
274+
# Check for invalid cumulative overrides in libraries
275+
if (unit_kind == 'library' and
276+
any(attr.startswith('target.extra_labels') for attr in overrides.iterkeys())):
277+
raise ConfigException("Target override '%s' in '%s' is only allowed at the application level"
278+
% ("target.extra_labels", ConfigParameter.get_display_name(unit_name, unit_kind, label)))
279+
271280
# Parse out cumulative overrides
272281
for attr, cumulatives in self.cumulative_overrides.iteritems():
273282
if 'target.'+attr in overrides:

0 commit comments

Comments
 (0)