Am Mittwoch, den 16.10.2013
schrieb Christian Kandeler <[email protected]>:

> On 10/15/2013 02:58 PM, Kurt Keller wrote:
> >>>     Rule {
> >>>       inputs: ['rpcsrc']
> >>>       Artifact {
> >>>         condition:
> >>> product.moduleProperty(product.moduleName,"generateCLNT")
> >>
> >> This looks like the right approach. Have you tried it?
> >
> > Yes now I have tried it. Qbs alway generates all 4 files. No matter,
> > how the properties generateSVC, generateCLNT, ... are set.
> 
> Looking at the qbs sources, it almost seems as if we simply forget to 
> evaluate the condition... Could you apply this patch and check whether 
> it helps?
> https://codereview.qt-project.org/#change,68361

After applying your patch it works a little bit better. I can now have
constant or expression-conditions like:

  condition: 1 > 0 ? true : false
  condition: true

but it can not resolve

  condition: product.moduleProperty(product.moduleName,"propertyName")

I give a more lengthy example:

Module {
  ...
  ...

  property bool generateHDR: true

  Rule {
    inputs: ['pswRpc']

    Artifact {
      condition: {
        var cond = product.moduleProperty(product.moduleName,"generateHDR");
        print("COND(condition) = " + cond);
        return cond;
      }
      fileTags:  ['hpp', 'rpc_header_file']
      fileName:  {
        var cond = product.moduleProperty(product.moduleName,"generateHDR");
        print("COND(fileName) = " + cond); 
        return input.baseName + '.h
      }
    }

    ...
    ...
}

when i 'run' this QBS reports on stdout:

COND(condition) = undefined
Setting up build graph for configuration qtc_qt511-debug
COND(fileName) = true

So it seems, that qbs does not have the complete 'environment' when
evaluating the condition of the Artifact but it does have the 'complete
environment' when it examines the property 'fileName'.

Regards
Kurt.

_______________________________________________
QBS mailing list
[email protected]
http://lists.qt-project.org/mailman/listinfo/qbs

Reply via email to