Skip to content

Commit 4bea975

Browse files
authored
Merge branch 'main' into use-node-24
2 parents e957f8d + b0e588e commit 4bea975

3 files changed

Lines changed: 61 additions & 5 deletions

File tree

tools/packchk/src/ValidateSyntax.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -641,6 +641,7 @@ void ValidateSyntax::InitFeatures()
641641
m_featureTableDevice["SON"] = FeatureEntry("SON", "<feature type=\"SON\" n=\"16\" name=\"SSON Package\"/>", "16-no-lead SSON Package");
642642
m_featureTableDevice["SOP"] = FeatureEntry("SOP", "<feature type=\"SOP\" n=\"16\" name=\"SSOP Package\"/>", "16-lead SSOP Package");
643643
m_featureTableDevice["DIP"] = FeatureEntry("DIP", "<feature type=\"DIP\" n=\"16\" name=\"Dual In-Line Package\"/>", "16-lead Dual In-Line Package");
644+
m_featureTableDevice["LGA"] = FeatureEntry("LGA", "<feature type=\"LGA\" n=\"141\" name=\"LGA Package\"/>", "141-lead LGA Package");
644645
m_featureTableDevice["PackageOther"] = FeatureEntry("Other Package Type", "<feature type=\"PackageOther\" n=\"44\" name=\"My other Package\"/>", "44-contacts My other Package");
645646
m_featureTableDevice["IOs"] = FeatureEntry("Inputs/Outputs", "<feature type=\"IOs\" n=\"112\" name=\"General Purpose I/Os, 5V tolerant\"/>", "112 General Purpose I/Os, 5V tolerant");
646647
m_featureTableDevice["ExtInt"] = FeatureEntry("External Interrupts", "<feature type=\"ExtInt\" n=\"12\"/>", "12 External Interrupts");
@@ -687,6 +688,7 @@ void ValidateSyntax::InitFeatures()
687688
m_featureTableDevice["LTE Cat-M"] = FeatureEntry("LTE Cat-M", "<feature type=\"LTE Cat-M\"/>", "LTE Cat-M");
688689
m_featureTableDevice["NB-IoT"] = FeatureEntry("NB-IoT", "<feature type=\"NB-IoT\"/>", "NB-IoT");
689690
m_featureTableDevice["NFC"] = FeatureEntry("NFC", "<feature type=\"NFC\"/>", "NFC");
691+
m_featureTableDevice["NPU"] = FeatureEntry("NPU", "<feature type=\"NPU\" n=\"Ethos-U85\" m=\"256MACs\"/>", "NPU");
690692
m_featureTableDevice["WirelessOther"] = FeatureEntry("WirelessOther", "<feature type=\"WirelessOther\"/>", "WirelessOther");
691693
m_featureTableDevice["I/O"] = FeatureEntry("I/O", "<feature type=\"I/O\"/>", "I/O");
692694
m_featureTableDevice["D/A"] = FeatureEntry("D/A", "<feature type=\"D/A\"/>", "D/A");

tools/projmgr/src/ProjMgrRpcServer.cpp

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ class RpcHandler : public RpcMethods {
128128

129129
PackReferenceVector& GetPackReferences(const string& context);
130130
PackReferenceVector CollectPackReferences(const string& context);
131-
PackReferenceVector GetPackReferencesForPack(const string& context, const string& packId);
131+
PackReferenceVector GetPackReferencesForPack(const string& context, const RtePackage* pack);
132132
RpcArgs::PackReference& EnsurePackReferenceForPack(const string& context, const string& packId, const string& origin, bool bVersion);
133133
RpcArgs::PackReference& EnsurePackReference(const string& context, const RpcArgs::PackReference& packRef);
134134

@@ -411,18 +411,22 @@ PackReferenceVector RpcHandler::CollectPackReferences(const string& context) {
411411
packRef.origin = packItem.origin;
412412
packRef.path = packItem.path;
413413
packRef.selected = true; // initially pack is selected;
414-
if (!contextItem.availablePackVersions[packId].empty()) {
414+
if (packItem.path.empty() && !contextItem.availablePackVersions[packId].empty()) {
415415
packRef.upgrade = contextItem.availablePackVersions[packId];
416416
}
417417
packRefs.push_back(packRef);
418418
}
419419
return packRefs;
420420
}
421421

422-
PackReferenceVector RpcHandler::GetPackReferencesForPack(const string& context, const string& packId) {
422+
PackReferenceVector RpcHandler::GetPackReferencesForPack(const string& context, const RtePackage* pack) {
423423
PackReferenceVector packRefs;
424+
auto& packId = pack->GetID();
425+
auto path = pack->GetRootFilePath(false);
426+
424427
for(auto& ref : GetPackReferences(context)) {
425-
if(ref.resolvedPack.has_value() && ref.resolvedPack == packId) {
428+
if(ref.resolvedPack.has_value() && ref.resolvedPack == packId ||
429+
ref.path.has_value() && RteFsUtils::Equivalent(ref.path.value(), path)) {
426430
packRefs.push_back(ref);
427431
}
428432
}
@@ -487,7 +491,7 @@ RpcArgs::PacksInfo RpcHandler::GetPacksInfo(const string& context, const bool& a
487491
if(contains_key(usedPacks, p.id)) {
488492
p.used = true;
489493
}
490-
auto packRefs = GetPackReferencesForPack(context, p.id);
494+
auto packRefs = GetPackReferencesForPack(context, rtePackage);
491495

492496
if(!packRefs.empty()) {
493497
p.references = packRefs;

tools/projmgr/test/src/ProjMgrRpcTests.cpp

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1182,6 +1182,56 @@ TEST_F(ProjMgrRpcTests, RpcGetPacksInfoLayer) {
11821182
}
11831183

11841184

1185+
TEST_F(ProjMgrRpcTests, RpcGetPacksInfoLocal) {
1186+
string context = "incompatible.Debug+CM0";
1187+
vector<string> contextList = {
1188+
context
1189+
};
1190+
1191+
auto requests = CreateLoadRequests("/TestSolution/PackRequirements/incompatible.csolution.yml", "", contextList);
1192+
requests += FormatRequest(3, "GetUsedItems", json({{ "context", context }}));
1193+
requests += FormatRequest(4, "GetPacksInfo", json({{ "context", context }, {"all", false}}));
1194+
1195+
const auto& responses = RunRpcMethods(requests);
1196+
1197+
EXPECT_TRUE(responses[2]["result"]["success"]);
1198+
auto packs = responses[2]["result"]["packs"];
1199+
EXPECT_EQ(packs.size(), 2);
1200+
EXPECT_EQ(packs[0]["pack"], "ARM::RteTestRequired");
1201+
EXPECT_EQ(packs[0]["resolvedPack"], "ARM::RteTestRequired");
1202+
1203+
string path = packs[0]["path"];
1204+
RteUtils::ReplaceAll(path, testinput_folder, "TEST"); ;
1205+
EXPECT_EQ(path, "TEST/TestSolution/PackRequirements/packs/required");
1206+
EXPECT_EQ(RteUtils::ExtractFileName(packs[0]["origin"]), "incompatible.csolution.yml");
1207+
1208+
EXPECT_EQ(packs[1]["pack"], "ARM::RteTest_DFP@0.2.0");
1209+
EXPECT_EQ(packs[1]["resolvedPack"], "ARM::RteTest_DFP@0.2.0");
1210+
EXPECT_EQ(RteUtils::ExtractFileName(packs[1]["origin"]), "incompatible.csolution.yml");
1211+
1212+
EXPECT_TRUE(responses[3]["result"]["success"]); // get pack infos
1213+
auto packInfos = responses[3]["result"]["packs"];
1214+
EXPECT_EQ(packInfos.size(), 2);
1215+
1216+
EXPECT_EQ(packInfos[0]["id"], "ARM::RteTestRequired@1.0.0");
1217+
EXPECT_FALSE(packInfos[0].contains("used"));
1218+
auto refs = packInfos[0]["references"];
1219+
EXPECT_EQ(refs.size(), 1);
1220+
EXPECT_TRUE(refs[0].contains("path"));
1221+
1222+
path = refs[0]["path"];
1223+
RteUtils::ReplaceAll(path, testinput_folder, "TEST");
1224+
1225+
EXPECT_EQ(refs[0]["pack"], "ARM::RteTestRequired");
1226+
EXPECT_EQ(refs[0]["resolvedPack"], "ARM::RteTestRequired");
1227+
EXPECT_EQ(path, "TEST/TestSolution/PackRequirements/packs/required");
1228+
1229+
EXPECT_EQ(packInfos[1]["id"], "ARM::RteTest_DFP@0.2.0");
1230+
EXPECT_TRUE(packInfos[1].contains("used"));
1231+
refs = packInfos[1]["references"];
1232+
EXPECT_EQ(refs.size(),1);
1233+
EXPECT_FALSE(refs[1].contains("path"));
1234+
}
11851235

11861236
TEST_F(ProjMgrRpcTests, RpcSelectPack) {
11871237
string context = "test1.Release+CM0";

0 commit comments

Comments
 (0)