Skip to content

Commit 8b49f0e

Browse files
authored
[projmgr] Add component maxInstances to cbuild.yml
1 parent ac3765b commit 8b49f0e

File tree

5 files changed

+13
-1
lines changed

5 files changed

+13
-1
lines changed

tools/projmgr/include/ProjMgrYamlParser.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,7 @@ static constexpr const char* YAML_LINKER = "linker";
150150
static constexpr const char* YAML_LINK_TIME_OPTIMIZE = "link-time-optimize";
151151
static constexpr const char* YAML_MAP = "map";
152152
static constexpr const char* YAML_MASK = "mask";
153+
static constexpr const char* YAML_MAX_INSTANCES = "maxInstances";
153154
static constexpr const char* YAML_MEMORY = "memory";
154155
static constexpr const char* YAML_MESSAGES = "messages";
155156
static constexpr const char* YAML_MISC = "misc";

tools/projmgr/schemas/common.schema.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -550,6 +550,11 @@
550550
"type": "integer",
551551
"description": "Allows to use multiple instances of component configuration files instead of default 1."
552552
},
553+
"MaxInstancesType": {
554+
"title": "maxInstances:",
555+
"type": "integer",
556+
"description": "Maximum allowed instances of a component in a project. Default is 1 for one instance."
557+
},
553558
"TargetTypes": {
554559
"title": "target-types:\nDocumentation: https://open-cmsis-pack.github.io/cmsis-toolbox/YML-Input-Format/#target-types",
555560
"type": "array",
@@ -1657,7 +1662,8 @@
16571662
"files": { "$ref": "#/definitions/FilesType" },
16581663
"generator": { "$ref": "#/definitions/ComponentGeneratorType" },
16591664
"from-pack": { "$ref": "#/definitions/PackID" },
1660-
"instances": { "$ref": "#/definitions/InstancesType" }
1665+
"instances": { "$ref": "#/definitions/InstancesType" },
1666+
"maxInstances": { "$ref": "#/definitions/MaxInstancesType" }
16611667
},
16621668
"additionalProperties": false
16631669
},

tools/projmgr/src/ProjMgrCbuild.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,9 @@ void ProjMgrCbuild::SetComponentsNode(YAML::Node node, const ContextItem* contex
131131
if (component.item->instances > 1) {
132132
SetNodeValue(componentNode[YAML_INSTANCES], to_string(component.item->instances));
133133
}
134+
if (rteComponent->HasMaxInstances()) {
135+
SetNodeValue(componentNode[YAML_MAX_INSTANCES], to_string(rteComponent->GetMaxInstances()));
136+
}
134137
SetNodeValue(componentNode[YAML_CONDITION], rteComponent->GetConditionID());
135138
SetNodeValue(componentNode[YAML_FROM_PACK], rteComponent->GetPackageID());
136139
SetNodeValue(componentNode[YAML_SELECTED_BY], componentItem->component);

tools/projmgr/test/data/TestSolution/Instances/ref/instances.Debug+RteTest_ARMCM3.cbuild.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ build:
4646
components:
4747
- component: ARM::RteTest:[email protected]
4848
instances: 2
49+
maxInstances: 2
4950
from-pack: ARM::[email protected]
5051
selected-by: RteTest:ComponentLevel
5152
files:

tools/projmgr/test/data/TestSolution/ref/pre-include+CM0.cbuild.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ build:
8181
category: doc
8282
version: 0.1.1
8383
- component: ARM::RteTest:[email protected]
84+
maxInstances: 2
8485
from-pack: ARM::[email protected]
8586
selected-by: RteTest:ComponentLevel
8687
files:

0 commit comments

Comments
 (0)