[Qbs] Rule.Return dynamic list for outputArtifacts

Christian Kandeler christian.kandeler at qt.io
Tue Jul 21 15:45:40 CEST 2020


On Tue, 21 Jul 2020 15:10:38 +0300
Карелин Павел <hkarel at yandex.ru> wrote:

> I recently needed to develop a rule for a sip generator (see below). 
> Basically, the rule works well, but yesterday it failed. At the output, 
> sip-generator create 6 cpp-files of the following format: 
> sip_corepartX.cpp (this is justified from the point of view of parallel 
> compilation, cpp-file sizes can be tens of megabytes). These 6 cpp-files 
> are reflected in the outputArtifacts parameter. However, yesterday I 
> came across a small sip-file, and the generated cpp-files turned out to 
> be not 6, but only 5. Naturally, my rule failed.
> 
> Question: how can I resolve my situation?

Do I understand you correctly that you don't really know in advance how many files will be generated, i.e. the -j parameter just specifies a maximum?
Then you either need to find a way to find out the value beforehand (by analyzing the input in some way), or, if that is not possible, you cheat and call the tool already in the outputArtifactsScript; the prepare script then just sets up a dummy command. 
Note that this loses concurrency, as rule execution happens in the main thread. But this might be acceptable for short-running tools.


Christian


More information about the Qbs mailing list