Skip to content

Commit

Permalink
Save the original pack info for bootstrap components (#652)
Browse files Browse the repository at this point in the history
* Save the original pack info for bootstrap components

Co-authored-by: Evgueni Driouk <[email protected]>
  • Loading branch information
edriouk and Evgueni Driouk authored Jul 13, 2023
1 parent 3e6154d commit abe15a9
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
10 changes: 9 additions & 1 deletion libs/rtemodel/src/RteInstance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1295,7 +1295,15 @@ void RteComponentInstance::Init(RteComponent* c)
RemoveAttribute("isDefaultVariant");
m_ID = c->GetID();

// get package info
// use the original pack of bootstrap component if available
if (c->HasAttribute("selectable") ) {
RteItem* packInfo = c->GetFirstChild("package");
if (packInfo) {
m_packageAttributes.SetAttributes(packInfo->GetAttributes());
}
return;
}
// get package info from the component itself
RtePackage* package = c->GetPackage();
if (package) {
m_packageAttributes.SetAttributes(package->GetAttributes());
Expand Down
2 changes: 1 addition & 1 deletion libs/rtemodel/src/RteProject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2266,7 +2266,7 @@ void RteProject::CreateXmlTreeElementContent(XMLTreeElement* parentElement) cons
e->SetTag("components");
for (itc = m_components.begin(); itc != m_components.end(); itc++) {
RteComponentInstance* ci = itc->second;
if (ci && !ci->IsApi() && !ci->IsGenerated())
if (ci && ci->IsSelectable() && !ci->IsApi())
ci->CreateXmlTreeElement(e);
}
e = new XMLTreeElement(parentElement);
Expand Down
7 changes: 6 additions & 1 deletion libs/rtemodel/src/RteTarget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1197,13 +1197,18 @@ void RteTarget::AddFilteredComponent(RteComponent* c)
if (inserted->HasAttribute("generator") || c->HasAttribute("generator") || c->GetGpdscFile(this) == inserted->GetGpdscFile(this)) {
string packPath = inserted->GetPackage()->GetAbsolutePackagePath();
if (packPath != GetProject()->GetProjectPath()) // default gpdsc cannot be un-selected
inserted->SetAttribute("selectable", "1"); // sets selecatble attribute to allow un-selection of a generated bootsrtrap component
inserted->SetAttribute("selectable", "1"); // sets selectable attribute to allow un-selection of a generated bootstrap component
// for boot-strap components add doc file and description
if (inserted->GetDescription().empty()) {
inserted->SetText(c->GetDescription());
} if (inserted->GetDocFile().empty()) {
inserted->AddAttribute("doc", c->GetDocFile(), false);
}
// add pack info
inserted->RemoveChild("package", true);
RteItem* packInfo = new RteItem("package", inserted);
packInfo->SetAttributes(pack->GetAttributes());
inserted->AddChild(packInfo); // add bootstrap pack info as a child.
}
return; // generated component always has priority
}
Expand Down

0 comments on commit abe15a9

Please sign in to comment.