Skip to content

Commit f6841b0

Browse files
authored
[csolution-rpc] Add upgrade node into PackReference
1 parent 5b855aa commit f6841b0

File tree

3 files changed

+20
-2
lines changed

3 files changed

+20
-2
lines changed

tools/projmgr/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ include(FetchContent)
2424
FetchContent_Declare(
2525
rpc-interface
2626
DOWNLOAD_EXTRACT_TIMESTAMP ON
27-
URL https://github.com/Open-CMSIS-Pack/csolution-rpc/releases/download/v0.0.8/csolution-rpc.zip
28-
URL_HASH SHA256=e347a98b6130c64d942d360ad31ca49899f3bf3113d40d9c460d6cd8f4c07b11
27+
URL https://github.com/Open-CMSIS-Pack/csolution-rpc/releases/download/v0.0.9/csolution-rpc.zip
28+
URL_HASH SHA256=2be58020a28b7f8cda5da8f6cba8f605f93346beb32805919c5872b8fbc0d541
2929
)
3030
FetchContent_MakeAvailable(rpc-interface)
3131

tools/projmgr/src/ProjMgrRpcServer.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -417,6 +417,9 @@ PackReferenceVector RpcHandler::CollectPackReferences(const string& context) {
417417
packRef.origin = packItem.origin;
418418
packRef.path = packItem.path;
419419
packRef.selected = true; // initially pack is selected;
420+
if (!contextItem.availablePackVersions[packId].empty()) {
421+
packRef.upgrade = contextItem.availablePackVersions[packId];
422+
}
420423
packRefs.push_back(packRef);
421424
}
422425
return packRefs;

tools/projmgr/test/src/ProjMgrRpcTests.cpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -919,6 +919,21 @@ TEST_F(ProjMgrRpcTests, RpcGetUsedItems) {
919919
EXPECT_TRUE(components[1]["options"]["explicitVendor"]);
920920
}
921921

922+
TEST_F(ProjMgrRpcTests, RpcGetUsedItemsLocked) {
923+
string context = "project_with_dfp_components+CM0";
924+
vector<string> contextList = {
925+
context
926+
};
927+
auto requests = CreateLoadRequests("/TestSolution/PackLocking/lock_pack_version.csolution.yml", "", contextList);
928+
requests += FormatRequest(3, "GetUsedItems", json({ { "context", context } }));
929+
const auto& responses = RunRpcMethods(requests);
930+
EXPECT_TRUE(responses[2]["result"]["success"]);
931+
auto packs = responses[2]["result"]["packs"];
932+
EXPECT_EQ(packs[0]["pack"], "ARM::RteTest_DFP");
933+
EXPECT_EQ(packs[0]["resolvedPack"], "ARM::RteTest_DFP@0.1.1");
934+
EXPECT_EQ(packs[0]["upgrade"], "0.2.0");
935+
}
936+
922937
TEST_F(ProjMgrRpcTests, RpcGetPacksInfoSimple) {
923938
string context = "selectable+CM0";
924939
vector<string> contextList = {

0 commit comments

Comments
 (0)