Skip to content

Commit 243b079

Browse files
committed
Pass requires in mbed_app.json test
1 parent dea8ea9 commit 243b079

File tree

4 files changed

+21
-1
lines changed

4 files changed

+21
-1
lines changed

tools/config/__init__.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -543,7 +543,6 @@ def add_config_files(self, flist):
543543
# Check that we didn't already process this file
544544
if full_path in self.processed_configs:
545545
continue
546-
self.processed_configs[full_path] = True
547546
# Read the library configuration and add a "__full_config_path"
548547
# attribute to it
549548
try:
@@ -568,6 +567,13 @@ def add_config_files(self, flist):
568567
raise ConfigException("; ".join(
569568
self.format_validation_error(x, config_file)
570569
for x in errors))
570+
if (
571+
"requires" in self.app_config_data
572+
and cfg["name"] not in self.app_config_data["requires"]
573+
):
574+
continue
575+
576+
self.processed_configs[full_path] = True
571577

572578
cfg["__config_path"] = full_path
573579

tools/config/definitions.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,14 @@
66
"type": "string"
77
}
88
},
9+
"requires_definition": {
10+
"descirption": "Required libraries",
11+
"type": "array",
12+
"items": {
13+
"type": "string",
14+
"pattern": "(^[\\w()_]+$|^[\\w()_]+=.+$)"
15+
}
16+
},
917
"macro_definition": {
1018
"description": "A list of extra macros that will be defined when compiling a project that includes this library.",
1119
"type": "array",

tools/config/schema_app.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@
1616
"macros": {
1717
"$ref": "definitions.json#/macro_definition"
1818
},
19+
"requires": {
20+
"$ref": "definitions.json#/requires_definition"
21+
},
1922
"artifact_name": {
2023
"type": "string"
2124
}

tools/config/schema_lib.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@
1313
"target_overrides": {
1414
"$ref": "definitions.json#/target_overrides_definition"
1515
},
16+
"requires": {
17+
"$ref": "definitions.json#/requires_definition"
18+
},
1619
"macros": {
1720
"$ref": "definitions.json#/macro_definition"
1821
}

0 commit comments

Comments
 (0)