[QBS] Referencing Rule properties

Christian Kandeler christian.kandeler at qt.io
Fri Aug 5 13:55:42 CEST 2016


On 08/05/2016 01:40 PM, Dennis Tomas wrote:
> Am 02.08.2016 um 12:29 schrieb Christian Kandeler:
>> 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.
>>
> In my case it's not sufficient for the name to be unique, because I have
> to reference it when using the Q_INIT_RESOURCE macro.

In that case, I suggest that you represent the qrc files as products and 
let your rule derive the file name from product.targetName.


Christian




More information about the Qbs mailing list