Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing required pack msg #1788

Merged
merged 5 commits into from
Oct 1, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
11 changes: 10 additions & 1 deletion tools/projmgr/src/ProjMgrWorker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,16 @@ bool ProjMgrWorker::CollectRequiredPdscFiles(ContextItem& context, const std::st
filteredPack.name +
(reqVersion.empty() ? "" : "@" + reqVersion);
errFound = true;
m_contextErrMap[context.name].insert("required pack: " + packageName + " not installed");
string errMsg = "required pack: " + packageName + " not installed";
const auto& packs = context.csolution->cbuildPack.packs;
auto itr = find_if(packs.begin(), packs.end(), [&](const ResolvedPackItem& item) {
return (item.pack == packageName);
});
// If the pack is from cbuild-pack.yml file, append additional information to the error message
if (itr != packs.end()) {
errMsg += ", version fixed in *.cbuild-pack.yml file";
}
m_contextErrMap[context.name].insert(errMsg);
context.missingPacks.push_back(filteredPack);
}
continue;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
cbuild-pack:
resolved-packs:
- resolved-pack: ARM::RteTest_DFP@0.1.0
brondani marked this conversation as resolved.
Show resolved Hide resolved
selected-by-pack:
- ARM::RteTest_DFP@>=0.1.1
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# yaml-language-server: $schema=https://raw.githubusercontent.com/Open-CMSIS-Pack/devtools/main/tools/projmgr/schemas/csolution.schema.json

solution:
target-types:
- type: CM0
device: RteTest_ARMCM0@>=0.1.1
packs:
- pack: ARM::RteTest_DFP
brondani marked this conversation as resolved.
Show resolved Hide resolved
projects:
- project: ./project_with_dfp_components.cproject.yml
18 changes: 18 additions & 0 deletions tools/projmgr/test/src/ProjMgrUnitTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6469,3 +6469,21 @@ TEST_F(ProjMgrUnitTests, MissingFile) {
const string expectedOutStr = ".*/missing.cproject.yml:7:11 - error csolution: file '.*/TestSolution/missing.c' was not found";
EXPECT_TRUE(regex_search(streamRedirect.GetErrorString(), regex(expectedOutStr)));
}

TEST_F(ProjMgrUnitTests, RunProjMgrSolution_pack_version_not_available) {
char* argv[7];
StdStreamRedirect streamRedirect;
std::string errExpected = "required pack: ARM::RteTest_DFP@0.1.0 not installed, version fixed in *.cbuild-pack.yml file";

const string& csolution = testinput_folder + "/TestSolution/PackLocking/pack_version_not_available.csolution.yml";
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*)"--cbuildgen";
EXPECT_EQ(1, RunProjMgr(7, argv, 0));

auto errStr = streamRedirect.GetErrorString();
EXPECT_NE(string::npos, errStr.find(errExpected));
}
Loading