[QBS] Always build an artifact

Christian Kandeler christian.kandeler at theqtcompany.com
Thu Dec 4 16:13:17 CET 2014


On 12/04/2014 03:00 PM, Stéphane Fabry wrote:
> I tried to do what you explained, but can't get it working.

Sorry, I made two mistakes in my explanation:
     1) You don't need a pseudo-artifact. Just set "alwaysUpdated" to
        false in your real artifact.
     2) This works only in master, not in 1.3.
So, what's a workaround you can use in 1.3? Maybe have a dependency on 
the "obj" tag? If no object file changes, you won't have a new build, right?


Christian

(Btw., in your example you create the "build.txt" file not at the place 
you specified in the Artifact item. To prevent such inconsistencies, we 
recommend using the outputs variable to access these paths.)

> 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




More information about the Qbs mailing list