Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion tools/projmgr/schemas/common.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -1006,7 +1006,6 @@
"title": "components:\nDocumentation: https://open-cmsis-pack.github.io/cmsis-toolbox/YML-Input-Format/#components",
"type": "array",
"description": "List of software components that are added from packs. Can be applied in *.cproject.yml and *.clayer.yml files.",
"uniqueItems": true,
"minItems": 1,
"items": { "$ref": "#/definitions/ComponentType" }
},
Expand Down
2 changes: 1 addition & 1 deletion tools/projmgr/src/ProjMgrWorker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3757,7 +3757,7 @@ bool ProjMgrWorker::AddComponent(const ComponentItem& src, const string& layer,
if (CheckContextFilters(src.type, context)) {
for (auto& [dstNode, layer] : dst) {
if (dstNode.component == src.component) {
ProjMgrLogger::Get().Error("conflict: component '" + dstNode.component + "' is declared multiple times", context.name);
ProjMgrLogger::Get().Error("conflict: component '" + dstNode.component + "' is listed multiple times", context.name);
return false;
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
layer:
components:
- component: RteTest:CORE
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
project:
components:
- component: Startup
- component: RteTest:CORE
layers:
- layer: ./duplicateComponents.clayer.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
project:
components:
- component: Startup
- component: RteTest:CORE
- component: RteTest:CORE
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
solution:
target-types:
- type: CM0
device: RteTest_ARMCM0

build-types:
- type: Debug
compiler: AC6

packs:
- pack: ARM::RteTest
- pack: ARM::RteTest_DFP

projects:
- project: ./Cproject/duplicateComponents_cproject.cproject.yml
- project: ./Clayer/duplicateComponents_clayer.cproject.yml
36 changes: 36 additions & 0 deletions tools/projmgr/test/src/ProjMgrUnitTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7384,3 +7384,39 @@ TEST_F(ProjMgrUnitTests, TargetSetDependencies) {
EXPECT_FALSE(cbuildIdx["build-idx"]["cbuilds"][0]["depends-on"].IsDefined());
EXPECT_FALSE(cbuildIdx["build-idx"]["cbuilds"][1]["depends-on"].IsDefined());
}

TEST_F(ProjMgrUnitTests, DuplicateComponents) {
Comment thread
brondani marked this conversation as resolved.
StdStreamRedirect streamRedirect;

const string csolution = testinput_folder + "/TestSolution/DuplicateComponents/duplicateComponents.csolution.yml";

char* argv[9];
argv[1] = (char*)"convert";
argv[2] = (char*)"--solution";
argv[3] = (char*)csolution.c_str();
argv[4] = (char*)"-o";
argv[5] = (char*)testoutput_folder.c_str();
argv[6] = (char*)"--context";
argv[7] = (char*)"duplicateComponents_cproject";
argv[8] = (char*)"--no-check-schema";

EXPECT_EQ(1, RunProjMgr(8, argv, m_envp));
auto errStr = streamRedirect.GetErrorString();
EXPECT_NE(string::npos, errStr.find("error csolution: conflict: component 'RteTest:CORE' is listed multiple times"));

argv[7] = (char*)"duplicateComponents_clayer";
EXPECT_EQ(1, RunProjMgr(8, argv, m_envp));
errStr = streamRedirect.GetErrorString();
EXPECT_NE(string::npos, errStr.find("error csolution: conflict: component 'RteTest:CORE' is listed multiple times"));

// Run with "--no-check-schema"
argv[7] = (char*)"duplicateComponents_cproject";
EXPECT_EQ(1, RunProjMgr(9, argv, m_envp));
errStr = streamRedirect.GetErrorString();
EXPECT_NE(string::npos, errStr.find("error csolution: conflict: component 'RteTest:CORE' is listed multiple times"));

argv[7] = (char*)"duplicateComponents_clayer";
EXPECT_EQ(1, RunProjMgr(9, argv, m_envp));
errStr = streamRedirect.GetErrorString();
EXPECT_NE(string::npos, errStr.find("error csolution: conflict: component 'RteTest:CORE' is listed multiple times"));
}
Loading