Re: [Qbs] How to use texttemplate module?

2020-09-09 Thread Alberto Mardegan
On 09/09/20 11:25, Christian Kandeler wrote:
> But it has to be, or at least appear as a dependency of the product type 
> somewhere.
> Otherwise there's no path from the source artifact to the product type.
> A detailed explanation is here:
> https://doc.qt.io/qbs/qml-qbslanguageitems-rule.html#rules-and-product-types
> 
> In your concrete product, just add something like this:
> type: base.concat("text")

Thanks!

But then, wouldn't it be a good idea to add

additionalProductTypes: [product.texttemplate.outputTag]

to the texttemplate module? I see that several other modules are doing
something like that. Would you consider a patch adding it?

Ciao,
  Alberto

-- 
http://www.mardy.it - Geek in un lingua international
___
Qbs mailing list
Qbs@qt-project.org
https://lists.qt-project.org/listinfo/qbs


Re: [Qbs] How to use texttemplate module?

2020-09-09 Thread Christian Kandeler
On Wed, 9 Sep 2020 00:24:36 +0300
Alberto Mardegan  wrote:

> Of course, in my project the product type is not "text"

But it has to be, or at least appear as a dependency of the product type 
somewhere.
Otherwise there's no path from the source artifact to the product type.
A detailed explanation is here:
https://doc.qt.io/qbs/qml-qbslanguageitems-rule.html#rules-and-product-types

In your concrete product, just add something like this:
type: base.concat("text")


Christian
___
Qbs mailing list
Qbs@qt-project.org
https://lists.qt-project.org/listinfo/qbs


Re: [Qbs] How to use texttemplate module?

2020-09-09 Thread Jochen Ulrich
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" 
:

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@qt-project.org
https://lists.qt-project.org/listinfo/qbs

___
Qbs mailing list
Qbs@qt-project.org
https://lists.qt-project.org/listinfo/qbs