[QBS] Artifacts within Transformers; condition does not work

Kurt Keller kk at parity-software.com
Fri Jun 27 16:41:04 CEST 2014


Am Freitag, den 27.06.2014
schrieb Christian Kandeler <christian.kandeler at digia.com>:

> 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.

Thank you very much - quick and good answer! This way it works
perfectly (at the expense of looking a bit more complicated)


Regards 
Kurt.



More information about the Qbs mailing list