Uploaded image for project: 'Qbs ("Cubes")'
  1. Qbs ("Cubes")
  2. QBS-82

condition inside Depends doesn't work properly

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P1: Critical
    • 0.2
    • 0.2
    • None
    • qbs from git 22c8d5b4298762ba6d9890a859259fa08eff7d85

    Description

      Although having a condition inside a Depends {} block appears to be implemented, and a simple condition:true or condition:false works as expected, it doesn't evaluate properly with more complex things. It doesn't seem to see the scope of the condition correctly:

          Application {
              property bool someProp: true
              Depends {
                  condition: someProp
                  name: 'cpp';
              }
              ...
          }
      

      The above give the error:

      d:\workitems\qbs-bugs>qbs -f conditionaldepends.qbp
      Found project file D:\workitems\qbs-bugs\conditionaldepends.qbp
      ERROR: D:\workitems\qbs-bugs\conditionaldepends.qbp:9 Error while evaluating Depends.condition: Error: Undefined property 'someProp'
      

      It behaves even more weirdly when you use properties from derived products - the base definition is seen but changing its value in the derived has no effect. The attached conditionaldepends_derived.qbp should compile cleanly because someProp is true. (It does compile if you set someProp as true in conditionaldepends_base.qbs). Instead it errors as if the condition was still false:

      d:\workitems\qbs-bugs>qbs architecture:x86_64 -f conditionaldepends_derived.qbp
      Found project file D:\workitems\qbs-bugs\conditionaldepends_derived.qbp
      loading project took:  31 ms
      ERROR: No artifacts generated for product 'conditionaldepends_derived'.
      

      (I've trimmed these examples down to the bone - I do have a genuine use-case for wanting conditional depends to work, but I'd never be conditional on cpp or Qt.core!)

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            jbornema Joerg Bornemann
            tomsci Tom Sutcliffe
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes