-
Notifications
You must be signed in to change notification settings - Fork 60
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Define $generator_id and $pack_id variables in generator arguments #1007
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -743,6 +743,26 @@ string RtePackage::ConstructID() | |
} | ||
|
||
|
||
string RtePackage::GetPackYamlID() const | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Couldn't There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The class ProjMgrUtils is part of the projmgr tool, so either the class or function needs to be migrated to some other location in the code base or it needs to be duplicated like I've done. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not sure if we want to introduce the YAML format awareness into the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We are already considering to unify component, API, and pack IDs across tools and libraries. RTE model will use then format used in .cproject/.csolution. This happens not for 2.0 release, but soon. therefore I agree with @brondani not to introduce extra methods in RTE model. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do you have a way to fetch the generator of interest from the callback class? |
||
{ | ||
string res; | ||
|
||
const auto& vendor = GetVendorString().empty() ? "" : GetVendorString() + "::"; | ||
const vector<pair<const char*, const string&>> elements = { | ||
{"", vendor}, | ||
{"", GetName()}, | ||
{"@", GetVersionString()}, | ||
}; | ||
|
||
for (const auto& element : elements) { | ||
if (!element.second.empty()) { | ||
res += element.first + element.second; | ||
} | ||
} | ||
return res; | ||
} | ||
|
||
|
||
string RtePackage::GetPackageID(bool withVersion) const | ||
{ | ||
if (withVersion) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,6 +30,7 @@ build: | |
category: sourceC | ||
generator: | ||
id: RteTestGeneratorIdentifier | ||
from-pack: ARM::[email protected] | ||
Torbjorn-Svensson marked this conversation as resolved.
Show resolved
Hide resolved
|
||
files: | ||
- file: ${CMSIS_PACK_ROOT}/ARM/RteTestGenerator/0.1.0/Templates/RteTestGen.c.template | ||
category: genSource | ||
|
@@ -46,6 +47,7 @@ build: | |
selected-by: RteTest:CORE | ||
generators: | ||
- generator: RteTestGeneratorIdentifier | ||
from-pack: ARM::[email protected] | ||
path: ../data/TestGenerator/MultipleComponents/RteTestGeneratorIdentifier | ||
gpdsc: ../data/TestGenerator/MultipleComponents/RteTestGeneratorIdentifier/RteTestGen_ARMCM0/RteTest.gpdsc | ||
command: | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,12 +31,14 @@ build: | |
category: sourceC | ||
generator: | ||
id: RteTestGeneratorIdentifier | ||
from-pack: ARM::[email protected] | ||
- component: ARM::RteTest:[email protected] | ||
condition: Cortex-M Device | ||
from-pack: ARM::[email protected] | ||
selected-by: RteTest:CORE | ||
generators: | ||
- generator: RteTestGeneratorIdentifier | ||
from-pack: ARM::[email protected] | ||
path: ../data/TestGenerator/layer/RTE/Device | ||
gpdsc: ../data/TestGenerator/layer/RTE/Device/RteTestGen_ARMCM0/RteTest.gpdsc | ||
command: | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,18 +31,21 @@ build: | |
category: sourceC | ||
generator: | ||
id: RteTestGeneratorIdentifier | ||
from-pack: ARM::[email protected] | ||
- component: ARM::Device:RteTest Generated Component:[email protected] | ||
condition: RteDevice | ||
from-pack: ARM::[email protected] | ||
selected-by: Device:RteTest Generated Component:RteTestWithKey | ||
generator: | ||
id: RteTestGeneratorWithKey | ||
from-pack: ARM::[email protected] | ||
- component: ARM::RteTest:[email protected] | ||
condition: Cortex-M Device | ||
from-pack: ARM::[email protected] | ||
selected-by: RteTest:CORE | ||
generators: | ||
- generator: RteTestGeneratorIdentifier | ||
from-pack: ARM::[email protected] | ||
path: ../data/TestGenerator/GeneratedFiles/RteTestGeneratorIdentifier | ||
gpdsc: ../data/TestGenerator/GeneratedFiles/RteTestGeneratorIdentifier/RteTestGen_ARMCM0/RteTest.gpdsc | ||
command: | ||
|
@@ -71,6 +74,7 @@ build: | |
- ../../../../output/test-gpdsc-multiple-generators.Debug+CM0.cbuild.yml | ||
- --foo=bar | ||
- generator: RteTestGeneratorWithKey | ||
from-pack: ARM::[email protected] | ||
path: ../data/TestGenerator/GeneratedFiles/RteTestGeneratorWithKey | ||
gpdsc: ../data/TestGenerator/GeneratedFiles/RteTestGeneratorWithKey/RteTestGen_ARMCM0/RteTest.gpdsc | ||
command: | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,12 +31,14 @@ build: | |
category: sourceC | ||
generator: | ||
id: RteTestGeneratorIdentifier | ||
from-pack: ARM::[email protected] | ||
- component: ARM::RteTest:[email protected] | ||
condition: Cortex-M Device | ||
from-pack: ARM::[email protected] | ||
selected-by: RteTest:CORE | ||
generators: | ||
- generator: RteTestGeneratorIdentifier | ||
from-pack: ARM::[email protected] | ||
path: ../data/TestGenerator/RTE/Device | ||
gpdsc: ../data/TestGenerator/RTE/Device/RteTestGen_ARMCM0/RteTest.gpdsc | ||
command: | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,6 +29,7 @@ build: | |
selected-by: Device:RteTest Generated Component:RteTestGenFiles | ||
generator: | ||
id: RteTestGeneratorIdentifier | ||
from-pack: ARM::[email protected] | ||
files: | ||
- file: ${CMSIS_PACK_ROOT}/ARM/RteTestGenerator/0.1.0/Templates/RteTest.gpdsc.template | ||
category: genAsset | ||
|
@@ -66,6 +67,7 @@ build: | |
selected-by: CORE | ||
generators: | ||
- generator: RteTestGeneratorIdentifier | ||
from-pack: ARM::[email protected] | ||
path: gendir | ||
gpdsc: gendir/RteTestGen_ARMCM0/RteTest.gpdsc | ||
command: | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems
$pack_id
and$generator_id
are deviating from the standard way of declaring/expanding/using variables such as$P #P $S $D $B $G
:https://open-cmsis-pack.github.io/Open-CMSIS-Pack-Spec/main/html/pdsc_generators_pg.html#element_generators
Concerning implementation look at
RteCallback::ExpandString
.@slhultgren We have discussed about the use of
[Gvendor][::Gtool][@Gversion]
as generator id. As long as the vendor guarantees theGtool
uniqueness, wouldn't it be sufficient?#434 (comment)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It was intention to use longer names than a single letter as it's hard to give an idea of what the variable means with only one letter.
The vendor can never guarantee that the generator id is unique among all combinations of packs, so by just specifying what pack the generator comes from, it will allow it to be uniquely identifiable in the cbuild.yml file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @brondani,
I'm not sure to catch the point about Gvendor/Gtool/Gversion, since my problem currently with these are:
1.1. Gtool is defined as "Plain text name", this sounds almost like a human-readable description, not something to rely on functionally
1.2. There is no implementation yet supporting this AFAIK
Technically I guess Gvendor/Gtool/Gversion could work, as long as:
but honestly I don't think any of these two points are feasible in practice (not worth the effort; The alternative of just allowing to specify the pack id is a lot simpler to maintain and double check on an organizational level. Each pack is more self-contained).
Currently my view on the Gvendor/Gtool/Gversion is that they provide some abstraction for calling generators (potentially from other packs??) but I don't think this level of abstraction is necessary or maybe not even useful?
Most likely when defining a component using a generator, we will know/expect some kind of behavior of the generator that we call, so most likely we just want to be able to call a generator from (at most) another pack (that we already know).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@slhultgren
Not really different from other identifiers such as the pack name itself.
Right, if we want to benefit from the spec we should start implementing it. I thought we agreed here this was the best approach to follow?
Gvendor
should be unique. Each vendor would be responsible for their ownGtool
identifiers.I guess for the same reason it’s possible to specify
Cvendor
for components: if omitted it can be inherited from pack vendor, but it does not have to.If you now strongly believe the
from-pack
is a better approach, I would recommend to update the specification.