[QBS] Referencing Rule properties

Christian Kandeler christian.kandeler at qt.io
Mon Aug 8 11:37:10 CEST 2016


On 08/05/2016 06:45 PM, Dennis Tomas wrote:
> I've hacked Qbs to make the rule available to the output artifact and
> the prepare function:
> https://github.com/dtomas/qbs/commit/716cc901b124903866a3ba1370e1085804342d8d
>
> What do you think of it?

I'm not sure. The evaluation depends on whether we think of multiplex 
rules whose output artifact has a fixed name, but is not a product 
target artifact, as exotic or not. You might want to file a suggestion 
in JIRA about making user-provided rule properties available at rule 
execution time.
Meanwhile, here's another idea for your concrete use case: Let the 
product provide a mapping between file tags and output file names:

Product {
     property var tagMap: ({ qm: "translations", assets: "assets", /* 
... */})
     // ...
}

Rule {
     Artifact {
         filePath: product.tagMap[Object.keys(inputs)[0]] + ".qrc"
         fileTags: "qrc"
     }
     // ...
}

Ths should be exactly what you want, I think.


Christian






More information about the Qbs mailing list