Details
-
Bug
-
Resolution: Done
-
P1: Critical
-
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
For Gerrit Dashboard: QBS-82 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
20858,1 | properly check conditions in Depends items | master | qbs/qbs | Status: MERGED | +2 | 0 |