[QBS] Referencing Rule properties

Christian Kandeler christian.kandeler at qt.io
Tue Aug 2 12:29:34 CEST 2016


On 08/01/2016 10:24 AM, Dennis Tomas wrote:
> Am 01.08.2016 um 09:20 schrieb Christian Kandeler:
>> On 07/29/2016 09:05 PM, Dennis Tomas wrote:
>>> Rule {
>>>     property string fileName: "resources"
>>>     multiplex: true
>>>     Artifact {
>>>         filePath: baseName + ".qrc" // ReferenceError
>>>         fileTags: ["qrc"]
>>>     }
>>>     prepare: {
>>> [...]
>>>     }
>>> }
>>>
>>> I get a ReferenceError as marked above. Is there a way to somehow
>>> reference baseName from the Artifact's filePath property?
>>
>> Have you tried parent.baseName?
>>
> Yes, this also results in a ReferenceError.

Ah yes. That's because the filePath property is evaluated in a different 
context and at a later stage (so that you can refer to "inputs", for 
instance). This means your approach cannot work as is; you'll have to 
look for a different way to set your output file name. There are lots of 
possibilities; for instance, you could derive it from the name of the 
first input artifact. It just has to be unique.


Christian



More information about the Qbs mailing list