<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
</head>
<body text="#000000" bgcolor="#FFFFFF">
Hi everybody,<br>
<br>
Since QBS is not yet managing automatic generation of rc file from
properties (version, name...) of a CppApplication, I would like to
create a generic qbs file so that I can call it from any project and
do the job. <br>
<br>
This should : <br>
- generating a rc file from an input rc file (product.rc.in) where I
replace some part with properties (version, name, copyright...) of
the calling product<br>
- add the generated RC file to the calling product so that it is
compiled<br>
<br>
The transformer I created looks like the one at theend of this mail.
In order to the generated.rc to be compiled I add an associated
Group item<br>
<br>
1) The rc file is well generated but is not compiled, did I made a
mistake anywhere in the Transformer Artifact or Group <br>
2) What is the best solution (Module, Product...) to put this
transformer and group in a separate file I can use from any project
with a simple Depends{ name : "generated.qbs"} call or something
equivalent. I have tried using another product, but in this case the
properties (product.version) are not the one of the calling product
and it is impossible to automatically add the file to the calling
product. (Export{files:["generatedRC"}} does not work<br>
<br>
Many thanks in advance for help. <br>
<br>
Regards<br>
<br>
<br>
<br>
<span style=" color:#800000;"> version</span><span
style=" color:#c0c0c0;"> </span>:<span style=" color:#c0c0c0;"> </span><span
style=" color:#008000;">"1.3.4"</span>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#c0c0c0;"> </span>Transformer<span style=" color:#c0c0c0;"> </span>{</pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#800000;">inputs</span>:<span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">"product.rc.in"</span></pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#c0c0c0;"> </span>Artifact<span style=" color:#c0c0c0;"> </span>{</pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#800000;">fileName</span>:<span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">"generated.rc"</span></pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#800000;">fileTags</span>:<span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">"generatedRC"</span></pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#c0c0c0;"> </span>}</pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#800000;">prepare</span>:<span style=" color:#c0c0c0;"> </span>{</pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">var</span><span style=" color:#c0c0c0;"> </span><span style=" font-style:italic; color:#2985c7;">cmd</span><span style=" color:#c0c0c0;"> </span>=<span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">new</span><span style=" color:#c0c0c0;"> </span>JavaScriptCommand();</pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#c0c0c0;"> </span><span style=" font-style:italic; color:#2985c7;">cmd</span>.description<span style=" color:#c0c0c0;"> </span>=<span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">"Processing</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">'"</span><span style=" color:#c0c0c0;"> </span>+<span style=" color:#c0c0c0;"> </span>input.fileName<span style=" color:#c0c0c0;"> </span>+<span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">"'"</span>;</pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#c0c0c0;"> </span><span style=" font-style:italic; color:#2985c7;">cmd</span>.highlight<span style=" color:#c0c0c0;"> </span>=<span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">"codegen"</span>;</pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#c0c0c0;"> </span><span style=" font-style:italic; color:#2985c7;">cmd</span>.sourceCode<span style=" color:#c0c0c0;"> </span>=<span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">function</span>()<span style=" color:#c0c0c0;"> </span>{</pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">var</span><span style=" color:#c0c0c0;"> </span><span style=" font-style:italic; color:#2985c7;">file</span><span style=" color:#c0c0c0;"> </span>=<span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">new</span><span style=" color:#c0c0c0;"> </span>TextFile(input.fileName);</pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">var</span><span style=" color:#c0c0c0;"> </span><span style=" font-style:italic; color:#2985c7;">content</span><span style=" color:#c0c0c0;"> </span>=<span style=" color:#c0c0c0;"> </span><span style=" font-style:italic; color:#2985c7;">file</span>.readAll();</pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#c0c0c0;"> </span><span style=" font-style:italic; color:#2985c7;">file</span>.close()</pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#c0c0c0;"> </span><span style=" font-style:italic; color:#2985c7;">content</span><span style=" color:#c0c0c0;"> </span>=<span style=" color:#c0c0c0;"> </span><span style=" font-style:italic; color:#2985c7;">content</span>.replace(<span style=" color:#008000;">/##VERSION_STR##/g</span>,<span style=" color:#c0c0c0;"> </span>product.version);</pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#c0c0c0;"> </span><span style=" font-style:italic; color:#2985c7;">file</span><span style=" color:#c0c0c0;"> </span>=<span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">new</span><span style=" color:#c0c0c0;"> </span>TextFile(output.fileName,<span style=" color:#c0c0c0;"> </span>TextFile.WriteOnly);</pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#c0c0c0;"> </span><span style=" font-style:italic; color:#2985c7;">file</span>.truncate();</pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#c0c0c0;"> </span><span style=" font-style:italic; color:#2985c7;">file</span>.write(<span style=" font-style:italic; color:#2985c7;">content</span>);</pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#c0c0c0;"> </span><span style=" font-style:italic; color:#2985c7;">file</span>.close();</pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#c0c0c0;"> </span>}</pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">return</span><span style=" color:#c0c0c0;"> </span><span style=" font-style:italic; color:#2985c7;">cmd</span>;</pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#c0c0c0;"> </span>}</pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#c0c0c0;"> </span>}</pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#c0c0c0;"> </span>Group{</pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#800000;">name</span>:<span style=" color:#008000;">"RCFile"</span></pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#800000;">fileTagsFilter</span>:<span style=" color:#008000;">"generatedRC"</span></pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" color:#c0c0c0;"> </span>}</pre>
<pre style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">
</pre>
<pre style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">
</pre>
<br>
</body>
</html>