[QBS] Avoid clean up of generated files

Christian Kandeler Christian.Kandeler at qt.io
Fri Sep 16 02:33:48 CEST 2016


Stefan Tappe wrote:

> in our project we are using a code generator in order to generate some ‘*.h’ and ‘*.cpp’ files. The code generation is automatically triggered by a qbs 
> rule, that among other things generates a list of output artifacts.  For some reason we want to be able to perform the build, even if the code generation 
> is not possible. Therefore we add the generated files to our svn-repository.  Unfortunately the generated files are deleted if a project cleanup is 
> performed.

I would hope so; otherwise there'd be a bug ;)

> Is there any  way to avoid the cleanup process for selected files or a certain rule.
 
No, but I think you can achieve what you want like this: Rather than setting the destination directory of the generated files to the source directory (which I assume you are doing at the moment), simply create them in the build directory as normal and add a second command to the respective rule(s) that copies the just-generated file to the source directory. This copy would not be listed by an Artifact item or outputArtifacts script, so qbs won't know about it. This way, the copy belongs to you, rather than to qbs.


Christian


More information about the Qbs mailing list