[QBS] Artifacts within Transformers; condition does not work
Christian Kandeler
christian.kandeler at digia.com
Fri Jun 27 15:57:06 CEST 2014
On 06/27/2014 03:26 PM, Kurt Keller wrote:
> I am using Qbs 1.2.1:
>
> I would like to have a Transformer which should create two artifacts on
> windows and only one on linux, depending on one single input file:
>
>
> Transformer {
> inputs: "version.h.in"
>
> Artifact {
> fileName: "version.h"
> fileTags: "hpp"
> }
>
> Artifact {
> // condition: qbs.targetOS.contains("windows")
> condition: false
> fileName: "resource.rc"
> fileTags: "rc"
> }
>
> prepare: {
> for (var tag in outputs) {
> for (var index in outputs[tag]) {
> var artifact = outputs[tag][index].filePath;
> print("file = " + artifact);
> }
> }
> }
> }
>
> There are always both artifact file paths printed, the condition inside
> the Artifact item for file tags 'rc' does not do anything.
>
> Is this a bug or is this my mistake?
Conditions on artifacts do not work or at least not the way one might
think they do. If you need a dynamic number of output artifacts, please
use a Rule instead of a Transformer (just make up some tag that only
matches your version.h.in file). There, use the "outputArtifacts"
property instead of "Artifact" items. See
http://qt-project.org/doc/qbs-1.2/rule-item.html for details.
Christian
More information about the Qbs
mailing list