mirror of https://github.com/ARMmbed/mbed-os.git
Raise error when mbed_app.json is bad
parent
067fe9b0e5
commit
1faf44e82b
|
@ -384,6 +384,7 @@ class Config(object):
|
||||||
top_level_dirs may be None (in this case, the constructor will not
|
top_level_dirs may be None (in this case, the constructor will not
|
||||||
search for a configuration file).
|
search for a configuration file).
|
||||||
"""
|
"""
|
||||||
|
config_errors = []
|
||||||
app_config_location = app_config
|
app_config_location = app_config
|
||||||
if app_config_location is None:
|
if app_config_location is None:
|
||||||
for directory in top_level_dirs or []:
|
for directory in top_level_dirs or []:
|
||||||
|
@ -399,8 +400,10 @@ class Config(object):
|
||||||
self.app_config_data = json_file_to_dict(app_config_location) \
|
self.app_config_data = json_file_to_dict(app_config_location) \
|
||||||
if app_config_location else {}
|
if app_config_location else {}
|
||||||
except ValueError as exc:
|
except ValueError as exc:
|
||||||
sys.stderr.write(str(exc) + "\n")
|
|
||||||
self.app_config_data = {}
|
self.app_config_data = {}
|
||||||
|
config_errors.append(
|
||||||
|
ConfigException("Could not parse mbed app configuration from %s"
|
||||||
|
% app_config_location))
|
||||||
|
|
||||||
# Check the keys in the application configuration data
|
# Check the keys in the application configuration data
|
||||||
unknown_keys = set(self.app_config_data.keys()) - \
|
unknown_keys = set(self.app_config_data.keys()) - \
|
||||||
|
@ -433,7 +436,7 @@ class Config(object):
|
||||||
|
|
||||||
self._process_config_and_overrides(self.app_config_data, {}, "app",
|
self._process_config_and_overrides(self.app_config_data, {}, "app",
|
||||||
"application")
|
"application")
|
||||||
self.config_errors = None
|
self.config_errors = config_errors
|
||||||
|
|
||||||
def add_config_files(self, flist):
|
def add_config_files(self, flist):
|
||||||
"""Add configuration files
|
"""Add configuration files
|
||||||
|
@ -806,6 +809,7 @@ class Config(object):
|
||||||
"""
|
"""
|
||||||
# Update configuration files until added features creates no changes
|
# Update configuration files until added features creates no changes
|
||||||
prev_features = set()
|
prev_features = set()
|
||||||
|
self.validate_config()
|
||||||
while True:
|
while True:
|
||||||
# Add/update the configuration with any .json files found while
|
# Add/update the configuration with any .json files found while
|
||||||
# scanning
|
# scanning
|
||||||
|
|
Loading…
Reference in New Issue