[QBS] Get property from parent project

Joerg Bornemann joerg.bornemann at digia.com
Fri May 23 11:20:58 CEST 2014

On 22-May-14 16:14, Christian Kandeler wrote:
> On 05/22/2014 04:00 PM, Tim Hutt wrote:
>> Relatedly, how can I access properties from a Rule's prepare script?
>> E.g. this does not work - it thinks foo is not defined.
>> 		Rule  {
>> 			property  string  foo:  "baz"
>> 			prepare:  {
>> 				var  /a = foo;/
> Yeah, Rules (much like Artifacts) are not first-class items in that they
> don't really support adding custom properties in a meaningful way (i.e.
> you can't access them later from prepare scripts). Maybe that is worth
> changing. Jörg, what's your opinion on this?

I recommend to not make the properties of the Rule item visible in 
Rule.prepare for the following reasons:
   1. The variable inputs that is available in Rule.prepare clashes with 
the property Rule.inputs.
   2. Making the other properties visible doesn't come for free. You'd 
need special cases. E.g. should prepare be visible in prepare?
   3. The gain is questionable. What's the advantage compared to 
defining variables at the start of the script or defining the properties 
outside the Rule item?



More information about the Qbs mailing list