[Qbs] Dynamic generation of the resource file

Denis Shienkov denis.shienkov at gmail.com
Sun Oct 3 09:17:26 CEST 2021


Hi,

no, I meant do not use the Qt.core.resiurceXXX stuff at all.

I meant - just to generate the resource files manually, using the Qbs 
XML service.

e.g. in one rule - just to use the 'tmap' tags as input to generate the 
'qrc' artifacts,

and in the second rule - just to use the 'bin' tabs as input to generate 
the 'qrc' artifacts too.

02.10.2021 17:01, Карелин Павел пишет:
> Denis, if you can suggest how to generate a second resource file - I 
> will only be glad.
>
> Now I assume that the name of the dynamic resource file depends on the 
> parameters
>   Qt.core.resourceFileBaseName: "trigrams"
>   Qt.core.resourcePrefix: "trigrams"
>
> And I don't understand how to specify another file name.
>
> --
> Pavel
>
> 02.10.2021 09:17, Denis Shienkov пишет:
>>
>> Hi,
>>
>> > how to add another "qresource prefix" section to this resource 
>> file, for example "binary"?
>>
>> But, for what? You can create/generate just a second resource file 
>> with the binaries.
>>
>> BR, Denis
>>
>> 01.10.2021 22:47, Карелин Павел пишет:
>>> Good time of day, colleagues
>>>
>>> I previously asked how to dynamically create a resource file for 
>>> project QGit (https://github.com/hkarel/qgit). The answer was 
>>> received (see correspondence below).
>>> I got the following solution:
>>>
>>>     Group {
>>>         name: "trigrams"
>>>         fileTags: "trigrams"
>>>         files: FileInfo.joinPaths(product.sourceDirectory, 
>>> "spellcheck/sonnet/trigrams/*")
>>>     }
>>>
>>>     Group {
>>>         fileTagsFilter: ["trigrams-map"]
>>>         fileTags: ["qt.core.resource_data"]
>>>     }
>>>     Qt.core.resourceFileBaseName: "trigrams"
>>>     Qt.core.resourcePrefix: "trigrams"
>>>
>>>     Rule {
>>>         id: idtrigrams
>>>         inputs: ["trigrams"]
>>>         explicitlyDependsOnFromDependencies: ["trigrams-generator"]
>>>
>>>         Artifact {
>>>             fileTags: ["trigrams-map"]
>>>             filePath: FileInfo.joinPaths(project.buildDirectory, 
>>> "trigrams", input.baseName + ".tmap")
>>>         }
>>>         prepare: {
>>>             var runUtl = 
>>> explicitlyDependsOn["trigrams-generator"][0].filePath
>>>             var outputFile = 
>>> FileInfo.joinPaths(project.buildDirectory, "trigrams", 
>>> input.baseName + ".tmap");
>>>
>>>             var cmd = new Command(runUtl, [input.filePath, outputFile]);
>>>             cmd.description = "sonnet parse trigrams";
>>>             cmd.highlight = "filegen";
>>>             return cmd;
>>>         }
>>>     }
>>>
>>> As a result, such a resource file is created:
>>>
>>> <!DOCTYPE RCC>
>>> <RCC version="1.0">
>>>     <qresource prefix="trigrams">
>>>         <file 
>>> alias="en_US.tmap">/home/hkarel/CProjects/QGit/build/Debug/trigrams/en_US.tmap</file>
>>>         <file 
>>> alias="ru_RU.tmap">/home/hkarel/CProjects/QGit/build/Debug/trigrams/ru_RU.tmap</file>
>>>     </qresource>
>>> </RCC>
>>>
>>> Question: how to add another "qresource prefix" section to this 
>>> resource file, for example "binary"?
>>> So that the resource file looks like this:
>>>
>>> <!DOCTYPE RCC>
>>> <RCC version="1.0">
>>>     <qresource prefix="trigrams">
>>>         <file 
>>> alias="en_US.tmap">/home/hkarel/CProjects/QGit/build/Debug/trigrams/en_US.tmap</file>
>>>         <file 
>>> alias="ru_RU.tmap">/home/hkarel/CProjects/QGit/build/Debug/trigrams/ru_RU.tmap</file>
>>>     </qresource>
>>>     <qresource prefix="binary">
>>>         <file 
>>> alias="file1.bin">/home/hkarel/CProjects/QGit/build/Debug/binary_res/file1.bin</file>
>>>         <file 
>>> alias="file2.bin">/home/hkarel/CProjects/QGit/build/Debug/binary_res/file1.bin</file>
>>>     </qresource>
>>> </RCC>
>>>
>>> --
>>> BR, Pavel
>>>
>>>
>>>
>>> -------- Перенаправленное сообщение --------
>>> Тема: 	Re: [Qbs] Build and run a AuxiliaryApplication before build a 
>>> MainApplication
>>> Дата: 	Mon, 22 Feb 2021 11:00:18 +0100
>>> От: 	Christian Kandeler <christian.kandeler at qt.io>
>>> Кому: 	qbs at qt-project.org
>>>
>>>
>>>
>>> On 2/19/21 5:43 PM, Карелин Павел wrote:
>>>> Project QGit__micro is attached.
>>>> The situation is reproduced 
>>>
>>> I've attached the corrected qbs files.
>>>
>>>
>>>
>>> Christian
>>>
>>>
>>>
>>> _______________________________________________
>>> Qbs mailing list
>>> Qbs at qt-project.org
>>> https://lists.qt-project.org/listinfo/qbs
>>
>> _______________________________________________
>> Qbs mailing list
>> Qbs at qt-project.org
>> https://lists.qt-project.org/listinfo/qbs
>
>
> _______________________________________________
> Qbs mailing list
> Qbs at qt-project.org
> https://lists.qt-project.org/listinfo/qbs
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/qbs/attachments/20211003/cd0b2496/attachment-0001.html>


More information about the Qbs mailing list