[QBS] Always build an artifact

Stéphane Fabry sf at xris.eu
Thu Dec 4 15:00:20 CET 2014


Yes i was using a transformer,

I tried to do what you explained, but can't get it working.
Here is the minimal project I tried:

importqbs1.0

import  qbs.TextFile

import  qbs.FileInfo

Product  {

     name:  "Build  Tag"

     type:  "buildtag"

     targetName:  "buildtag.txt"

     Group  {

         name:  "Fake  input"

         files:  "fake.in"

         fileTags:  ["in_tag"]

     }

     Rule  {

         inputs:  ["in_tag"]

         Artifact  {

             filePath:  "buildtag.txt"

             fileTags:  "buildtag"

         }

         Artifact  {

             alwaysUpdated:  false

             filePath:  "fakeOutput"

         }

         prepare:  {

             var  cmd  =  new  JavaScriptCommand();

             cmd.description  =  "Update  build  date  tag  !"

             cmd.sourceCode  =  function()  {

                 var  file  =  new  TextFile("./buildtag.txt",  TextFile.WriteOnly);

                 var  today  =  new  Date()

                 file.writeLine(today.toISOString());

                 file.close();

             }

             return  cmd;

         }

     }

}


Thanks



Le 04-12-14 10:59, Christian Kandeler a écrit :
> On 12/03/2014 10:18 PM, Stéphane Fabry wrote:
>> I'm trying to create an artefact (a simple text file) that contain the
>> last date of build,
>> so i just need to write the date 'now' each time the project is build.
>>
>> The problem is I don't know how to tell qbs to rebuild the artefact each
>> time the project is build (or partially build) ?
>>
>> Has someone an idea how to do this ?
> Yeah, we really should add some rule property that makes this kind of
> thing straightforward. You could file a bug report to enhance the
> visibility of this issue.
> I assume you are using a Transformer item now? The workaround is to use
> a rule instead (give some random input tag, as there needs to be at
> least one) and in this rule, in addition to your real output artifact,
> declare a second one that you will never create and set its
> "alwaysUpdated" property to false (the filePath can be anything, as long
> as it's uniqe). This should achieve what you want.
>
>
> Christian
>
> _______________________________________________
> QBS mailing list
> QBS at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/qbs

-- 
*Stéphane Fabry*, Project & IT Manager
+32 (0)4 367 07 92
*X-RIS* | /X-Ray Imaging Solutions/
www.xris.eu/contact.html
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/qbs/attachments/20141204/f9f0df5a/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: QBS-XXX.zip
Type: application/x-zip-compressed
Size: 826 bytes
Desc: not available
URL: <http://lists.qt-project.org/pipermail/qbs/attachments/20141204/f9f0df5a/attachment.bin>


More information about the Qbs mailing list