Skip to content
Open
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
14 changes: 9 additions & 5 deletions tools/projmgr/src/ProjMgrRpcServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@

PackReferenceVector& GetPackReferences(const string& context);
PackReferenceVector CollectPackReferences(const string& context);
PackReferenceVector GetPackReferencesForPack(const string& context, const string& packId);
PackReferenceVector GetPackReferencesForPack(const string& context, const RtePackage* pack);
RpcArgs::PackReference& EnsurePackReferenceForPack(const string& context, const string& packId, const string& origin, bool bVersion);
RpcArgs::PackReference& EnsurePackReference(const string& context, const RpcArgs::PackReference& packRef);

Expand Down Expand Up @@ -411,18 +411,22 @@
packRef.origin = packItem.origin;
packRef.path = packItem.path;
packRef.selected = true; // initially pack is selected;
if (!contextItem.availablePackVersions[packId].empty()) {
if (packItem.path.empty() && !contextItem.availablePackVersions[packId].empty()) {
packRef.upgrade = contextItem.availablePackVersions[packId];
}
packRefs.push_back(packRef);
}
return packRefs;
}

PackReferenceVector RpcHandler::GetPackReferencesForPack(const string& context, const string& packId) {
PackReferenceVector RpcHandler::GetPackReferencesForPack(const string& context, const RtePackage* pack) {
PackReferenceVector packRefs;
auto& packId = pack->GetID();
auto path = pack->GetRootFilePath(false);

for(auto& ref : GetPackReferences(context)) {
if(ref.resolvedPack.has_value() && ref.resolvedPack == packId) {
if(ref.resolvedPack.has_value() && ref.resolvedPack == packId ||

Check warning on line 428 in tools/projmgr/src/ProjMgrRpcServer.cpp

View workflow job for this annotation

GitHub Actions / coverage

suggest parentheses around ‘&&’ within ‘||’ [-Wparentheses]

Check warning on line 428 in tools/projmgr/src/ProjMgrRpcServer.cpp

View workflow job for this annotation

GitHub Actions / build-swig (macos-15-intel, amd64)

'&&' within '||' [-Wlogical-op-parentheses]

Check warning on line 428 in tools/projmgr/src/ProjMgrRpcServer.cpp

View workflow job for this annotation

GitHub Actions / build-swig (macos-15-intel, amd64)

'&&' within '||' [-Wlogical-op-parentheses]

Check warning on line 428 in tools/projmgr/src/ProjMgrRpcServer.cpp

View workflow job for this annotation

GitHub Actions / build (ubuntu-22.04,amd64)

suggest parentheses around ‘&&’ within ‘||’ [-Wparentheses]

Check warning on line 428 in tools/projmgr/src/ProjMgrRpcServer.cpp

View workflow job for this annotation

GitHub Actions / build (ubuntu-22.04,arm64)

suggest parentheses around ‘&&’ within ‘||’ [-Wparentheses]

Check warning on line 428 in tools/projmgr/src/ProjMgrRpcServer.cpp

View workflow job for this annotation

GitHub Actions / unittest (macos-15-intel, amd64)

'&&' within '||' [-Wlogical-op-parentheses]

Check warning on line 428 in tools/projmgr/src/ProjMgrRpcServer.cpp

View workflow job for this annotation

GitHub Actions / unittest (ubuntu-22.04, arm64)

suggest parentheses around ‘&&’ within ‘||’ [-Wparentheses]

Check warning on line 428 in tools/projmgr/src/ProjMgrRpcServer.cpp

View workflow job for this annotation

GitHub Actions / build (macos-15-intel,amd64)

'&&' within '||' [-Wlogical-op-parentheses]

Check warning on line 428 in tools/projmgr/src/ProjMgrRpcServer.cpp

View workflow job for this annotation

GitHub Actions / unittest (ubuntu-22.04, amd64)

suggest parentheses around ‘&&’ within ‘||’ [-Wparentheses]

Check warning on line 428 in tools/projmgr/src/ProjMgrRpcServer.cpp

View workflow job for this annotation

GitHub Actions / build-swig (ubuntu-22.04, amd64)

suggest parentheses around ‘&&’ within ‘||’ [-Wparentheses]

Check warning on line 428 in tools/projmgr/src/ProjMgrRpcServer.cpp

View workflow job for this annotation

GitHub Actions / build-swig (ubuntu-22.04, amd64)

suggest parentheses around ‘&&’ within ‘||’ [-Wparentheses]

Check warning on line 428 in tools/projmgr/src/ProjMgrRpcServer.cpp

View workflow job for this annotation

GitHub Actions / unittest (macos-14, arm64)

'&&' within '||' [-Wlogical-op-parentheses]

Check warning on line 428 in tools/projmgr/src/ProjMgrRpcServer.cpp

View workflow job for this annotation

GitHub Actions / build (macos-14,arm64)

'&&' within '||' [-Wlogical-op-parentheses]
ref.path.has_value() && RteFsUtils::Equivalent(ref.path.value(), path)) {

Check warning on line 429 in tools/projmgr/src/ProjMgrRpcServer.cpp

View workflow job for this annotation

GitHub Actions / build-swig (macos-15-intel, amd64)

'&&' within '||' [-Wlogical-op-parentheses]

Check warning on line 429 in tools/projmgr/src/ProjMgrRpcServer.cpp

View workflow job for this annotation

GitHub Actions / build-swig (macos-15-intel, amd64)

'&&' within '||' [-Wlogical-op-parentheses]

Check warning on line 429 in tools/projmgr/src/ProjMgrRpcServer.cpp

View workflow job for this annotation

GitHub Actions / unittest (macos-15-intel, amd64)

'&&' within '||' [-Wlogical-op-parentheses]

Check warning on line 429 in tools/projmgr/src/ProjMgrRpcServer.cpp

View workflow job for this annotation

GitHub Actions / build (macos-15-intel,amd64)

'&&' within '||' [-Wlogical-op-parentheses]

Check warning on line 429 in tools/projmgr/src/ProjMgrRpcServer.cpp

View workflow job for this annotation

GitHub Actions / unittest (macos-14, arm64)

'&&' within '||' [-Wlogical-op-parentheses]

Check warning on line 429 in tools/projmgr/src/ProjMgrRpcServer.cpp

View workflow job for this annotation

GitHub Actions / build (macos-14,arm64)

'&&' within '||' [-Wlogical-op-parentheses]
packRefs.push_back(ref);
}
}
Expand Down Expand Up @@ -487,7 +491,7 @@
if(contains_key(usedPacks, p.id)) {
p.used = true;
}
auto packRefs = GetPackReferencesForPack(context, p.id);
auto packRefs = GetPackReferencesForPack(context, rtePackage);

if(!packRefs.empty()) {
p.references = packRefs;
Expand Down
50 changes: 50 additions & 0 deletions tools/projmgr/test/src/ProjMgrRpcTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1182,6 +1182,56 @@ TEST_F(ProjMgrRpcTests, RpcGetPacksInfoLayer) {
}


TEST_F(ProjMgrRpcTests, RpcGetPacksInfoLocal) {
string context = "incompatible.Debug+CM0";
vector<string> contextList = {
context
};

auto requests = CreateLoadRequests("/TestSolution/PackRequirements/incompatible.csolution.yml", "", contextList);
requests += FormatRequest(3, "GetUsedItems", json({{ "context", context }}));
requests += FormatRequest(4, "GetPacksInfo", json({{ "context", context }, {"all", false}}));

const auto& responses = RunRpcMethods(requests);

EXPECT_TRUE(responses[2]["result"]["success"]);
auto packs = responses[2]["result"]["packs"];
EXPECT_EQ(packs.size(), 2);
EXPECT_EQ(packs[0]["pack"], "ARM::RteTestRequired");
EXPECT_EQ(packs[0]["resolvedPack"], "ARM::RteTestRequired");

string path = packs[0]["path"];
RteUtils::ReplaceAll(path, testinput_folder, "TEST"); ;
EXPECT_EQ(path, "TEST/TestSolution/PackRequirements/packs/required");
EXPECT_EQ(RteUtils::ExtractFileName(packs[0]["origin"]), "incompatible.csolution.yml");

EXPECT_EQ(packs[1]["pack"], "ARM::RteTest_DFP@0.2.0");
EXPECT_EQ(packs[1]["resolvedPack"], "ARM::RteTest_DFP@0.2.0");
EXPECT_EQ(RteUtils::ExtractFileName(packs[1]["origin"]), "incompatible.csolution.yml");

EXPECT_TRUE(responses[3]["result"]["success"]); // get pack infos
auto packInfos = responses[3]["result"]["packs"];
EXPECT_EQ(packInfos.size(), 2);

EXPECT_EQ(packInfos[0]["id"], "ARM::RteTestRequired@1.0.0");
EXPECT_FALSE(packInfos[0].contains("used"));
auto refs = packInfos[0]["references"];
EXPECT_EQ(refs.size(), 1);
EXPECT_TRUE(refs[0].contains("path"));

path = refs[0]["path"];
RteUtils::ReplaceAll(path, testinput_folder, "TEST");

EXPECT_EQ(refs[0]["pack"], "ARM::RteTestRequired");
EXPECT_EQ(refs[0]["resolvedPack"], "ARM::RteTestRequired");
EXPECT_EQ(path, "TEST/TestSolution/PackRequirements/packs/required");

EXPECT_EQ(packInfos[1]["id"], "ARM::RteTest_DFP@0.2.0");
EXPECT_TRUE(packInfos[1].contains("used"));
refs = packInfos[1]["references"];
EXPECT_EQ(refs.size(),1);
EXPECT_FALSE(refs[1].contains("path"));
}

TEST_F(ProjMgrRpcTests, RpcSelectPack) {
string context = "test1.Release+CM0";
Expand Down
Loading