[QBS] Dependency to Transformer Artifact

Stephan Gatzka stephan.gatzka at gmail.com
Sun Jul 19 12:06:22 CEST 2015

Hi again,

I wrote a small qbs module to generate version information from an
version input file. So I have a Module consisting of a Transformer which
has an Artifact item with fileTags: ["version"].

The version.h file is correctly generated but the c file including
version.h is not rebuild. So I think I missed to add a dependency to
that fileTag in my CppAppliction product but I don't know ho to do.

This is the code of the module generateVersion.qbs:

import qbs.TextFile

Module {
  Transformer {
    inputs: "version.h.in"

    Artifact {
      filePath: "version.h"
      fileTags: ["version"]

    prepare: {
      var cmd = new JavaScriptCommand();
      cmd.description = "Processing '" + input.fileName + "'";
      cmd.highlight = "codegen";
      cmd.sourceCode = function()  {
        var file = new TextFile(input.fileName);
        var content = file.readAll();
        content = content.replace(/##VERSION_STR##/g, product.version);
        file = new TextFile(output.fileName,  TextFile.WriteOnly);
      return  cmd;

This is the interesting part of my product:

Application {
  name: "application"
  profiles: targetProcessor
  version: "2.4.5"

  Depends { name: "cpp" }
  Depends { name: "generateVersion" }

  files: [

Any help would be very appreciated.



More information about the Qbs mailing list