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
4 changes: 3 additions & 1 deletion libs/rtemodel/src/RteComponent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -571,7 +571,7 @@ void RteComponentAggregate::AddComponent(RteComponent* c)
RtePackage* devicePack = GetTarget()->GetEffectiveDevicePackage();
if (insertedPack == devicePack)
return; // component from device pack is already installed
if (insertedPack && devicePack && pack != devicePack) {
if (insertedPack && devicePack && pack && pack != devicePack) {
const string& packVersion = pack->GetVersionString();
const string& insertedPackVersion = insertedPack->GetVersionString();
if (VersionCmp::Compare(packVersion, insertedPackVersion) < 0)
Expand Down Expand Up @@ -610,6 +610,8 @@ void RteComponentAggregate::SetComponentInstance(RteComponentInstance* ci, int c
m_selectedVariant = ei->GetCvariantName();
m_selectedVersion = ei->GetVersionString();
AssignAttribute("layer", *ci);
AssignAttribute("explicitVendor", *ci);
AssignAttribute("explicitVersion", *ci);

if (m_components.empty()) {
if (c) {
Expand Down
6 changes: 5 additions & 1 deletion libs/rtemodel/src/RteItem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -250,9 +250,13 @@ void RteItem::SetAttributesFomComponentId(const std::string& componentId)
if (componentId.find(RteConstants::SUFFIX_CVENDOR) != string::npos) {
string vendor = RteUtils::RemoveSuffixByString(id, RteConstants::SUFFIX_CVENDOR);
AddAttribute("Cvendor", vendor);
SetAttribute("explicitVendor", true);
id = RteUtils::RemovePrefixByString(componentId, RteConstants::SUFFIX_CVENDOR);
}
AddAttribute("Cversion", RteUtils::GetSuffix(id, RteConstants::PREFIX_CVERSION_CHAR));
auto explicitVersion = RteUtils::GetSuffix(id, RteConstants::PREFIX_CVERSION_CHAR, true);
AddAttribute("explicitVersion", explicitVersion);
AddAttribute("Cversion", RteUtils::GetSuffix(explicitVersion, RteConstants::PREFIX_CVERSION_CHAR));

id = RteUtils::GetPrefix(id, RteConstants::PREFIX_CVERSION_CHAR);
list<string> segments;
RteUtils::SplitString(segments, id, RteConstants::COLON_CHAR);
Expand Down
16 changes: 14 additions & 2 deletions libs/rtemodel/src/RteProject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include "RteProject.h"

#include "RteComponent.h"
#include "RteConstants.h"
#include "RteFile.h"
#include "RteGenerator.h"
#include "RteModel.h"
Expand Down Expand Up @@ -366,7 +367,7 @@ RteComponentInstance* RteProject::AddComponent(RteComponent* c, int instanceCoun
if (!ci) {
ci = new RteComponentInstance(this);
AddItem(ci);
m_components[c->GetID()] = ci;
m_components[id] = ci;
ci->Init(c);
// check if we have previous aggregate with Excluded flag for the target
}
Expand Down Expand Up @@ -832,7 +833,18 @@ bool RteProject::Apply()
}
}
ci = AddComponent(c, count, target, ci);
ci->AssignAttribute("layer", *a);
// pass aggregate options and create ymlID attribute
if(!ci->IsApi()) {
ci->AssignAttribute("layer", *a);
ci->AssignAttribute("explicitVendor", *a);
ci->AssignAttribute("explicitVersion", *a);
string ymlID = RteUtils::GetPrefix(ci->GetID(), RteConstants::PREFIX_CVERSION_CHAR);
if(!a->GetAttributeAsBool("explicitVendor")) {
ymlID = RteUtils::RemovePrefixByString(ymlID, RteConstants::SUFFIX_CVENDOR);
}
ymlID += a->GetAttribute("explicitVersion");
ci->AddAttribute("ymlID", ymlID);
}

// add API if any
RteApi* api = c->GetApi(target, true);
Expand Down
14 changes: 14 additions & 0 deletions libs/rtemodel/test/src/RteItemTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ TEST(RteItemTest, ComponentAttributesFromId) {
RteItem item("component", nullptr);
item.SetAttributesFomComponentId(id);
EXPECT_EQ(id, item.GetComponentID(true));
EXPECT_EQ(item.GetAttribute("explicitVersion"), "@9.9.9");
EXPECT_TRUE(item.GetAttributeAsBool("explicitVendor"));

id = "Class&Bundle:Group:Sub&Variant@9.9.9";
item.SetAttributesFomComponentId(id);
Expand All @@ -98,6 +100,18 @@ TEST(RteItemTest, ComponentAttributesFromId) {
id = "Class:Group:&Variant";
item.SetAttributesFomComponentId(id);
EXPECT_EQ("Class:Group&Variant", item.GetComponentID(true));

id = "Group:Sub";
item.SetAttributesFomComponentId(id);
EXPECT_EQ(id, item.GetComponentID(true));
EXPECT_TRUE(item.GetAttribute("explicitVersion").empty());
EXPECT_FALSE(item.GetAttributeAsBool("explicitVendor"));

id = "Group:Sub@^9.0.0";
item.SetAttributesFomComponentId(id);
EXPECT_EQ(id, item.GetComponentID(true));
EXPECT_EQ(item.GetAttribute("explicitVersion"),"@^9.0.0");
EXPECT_EQ(item.GetVersionString(),"^9.0.0");
}

TEST(RteItemTest, SemVer) {
Expand Down
4 changes: 2 additions & 2 deletions tools/projmgr/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ include(FetchContent)
FetchContent_Declare(
rpc-interface
DOWNLOAD_EXTRACT_TIMESTAMP ON
URL https://github.com/Open-CMSIS-Pack/csolution-rpc/releases/download/v0.0.1/csolution-rpc.zip
URL_HASH SHA256=b86a9e63c5d269c9375fe7c389234a05e7ce59ebb26bde81858b669e5664f3f6
URL https://github.com/Open-CMSIS-Pack/csolution-rpc/releases/download/v0.0.2/csolution-rpc.zip
URL_HASH SHA256=bc00342a240d2fded19981524bb286c91541504d4271e936f68c646a8b62908f
)
FetchContent_MakeAvailable(rpc-interface)

Expand Down
6 changes: 5 additions & 1 deletion tools/projmgr/include/ProjMgrRpcServerData.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@

#include "RpcInterface.h"

#include <optional>

using namespace std;

class RteTarget;
Expand All @@ -30,8 +32,10 @@ class RpcDataCollector {
RpcArgs::ComponentInstance FromComponentInstance(const RteComponentInstance* rteCi) const;
RteItem* GetTaxonomyItem(const RteComponentGroup* rteGroup) const;

protected:
std::optional<RpcArgs::Options> OptionsFromRteItem(const RteItem* item) const;
std::string ResultStringFromRteItem(const RteItem* item) const;

protected:
void CollectCtBundles(RpcArgs::CtClass& ctClass, RteComponentGroup* rteClass) const;
void CollectCtChildren(RpcArgs::CtTreeItem& parent, RteComponentGroup* rteGroup, const string& bundleName) const;
void CollectCtAggregates(RpcArgs::CtTreeItem& parent, RteComponentGroup* rteGroup, const string& bundleName) const;
Expand Down
4 changes: 2 additions & 2 deletions tools/projmgr/include/ProjMgrWorker.h
Original file line number Diff line number Diff line change
Expand Up @@ -908,10 +908,10 @@ class ProjMgrWorker {
* @param context item
* @return true if there is no error
*/
bool ValidateContext(ContextItem& context);
RteItem::ConditionResult ValidateContext(ContextItem& context);

/**
* @brief populate active target set
* @brief populate active target set
* @param active target set command line option
* @return true if there is no error
*/
Expand Down
Loading
Loading