[Qbs] How to use texttemplate module?
Jochen Ulrich
jochen.ulrich at clausmark.com
Wed Sep 9 10:24:30 CEST 2020
Hi Alberto
> But if I modify that file and change the Product type from "text" to "application", then the rule is no longer run.
Yeah, this is how the rules in Qbs work: they are only executed if there is a Product or another Rule which "requests" them to be run.
Meaning: There must be a Product which has the tag of the output artifacts (the artifacts are the product) or a Rule which takes the artifacts as input (the artifacts are processed further).
So if the output of the texttemplate processing does not need to be processed further by Qbs, then you should put it into a separate product with the type "text".
If the output should be processed further (for example you are replacing text inside a .cpp file which should then be compiled into your application),
then you should set the texttemplate.outputTag (see https://doc.qt.io/qbs/qml-qbsmodules-texttemplate.html#outputTag-prop) accordingly.
For example:
Product {
name: "bar"
type: ["application"]
Depends { name: "texttemplate" }
Depends { name: "cpp" }
texttemplate.dict: ({
bar: "BAR",
})
files: ["main.cpp.in"]
texttemplate.outputTag: "cpp"
}
In the example, the rule from the texttemplate module will create an artifact "main.cpp" which is tagged with "cpp" which causes it to be picked up by the cpp module.
Best
Jochen
Am 08.09.20, 23:25 schrieb "Qbs im Auftrag von Alberto Mardegan" <qbs-bounces at qt-project.org im Auftrag von mardy at users.sourceforge.net>:
Hi all,
I'm having some trouble using the texttemplate module, because I
cannot get its rule to execute.
If I run the test file from
https://code.qt.io/cgit/qbs/qbs.git/tree/tests/auto/blackbox/testdata/texttemplate
then everything works.
But if I modify that file and change the Product type from "text" to
"application", then the rule is no longer run.
I also tried to add
Group {
fileTagsFilter: ["text"]
qbs.install: true
}
to the QBS file, but still the texttemplate rule is not executed. Of
course, in my project the product type is not "text" (I have a
QtGuiApplication), so how can I tell QBS that it should run all the
rules which produce a "text" artifact?
Ciao,
Alberto
--
http://www.mardy.it - Geek in un lingua international
_______________________________________________
Qbs mailing list
Qbs at qt-project.org
https://lists.qt-project.org/listinfo/qbs
More information about the Qbs
mailing list