[Qbs] dependency tracking

Dan Pat dannix84 at gmail.com
Tue Sep 15 19:10:13 CEST 2020

 Probably, I haven't made myself clear enough. Here's an example setup.
This is a dummy generator's module definition:

import qbs

import qbs.FileInfo

import qbs.TextFile

Module {

    id: testgen

    Rule {

        inputs: ["genxx"]

        Artifact {

            id: artifact

            filePath: FileInfo.path(input.filePath)  + "/" +
FileInfo.baseName(input.filePath) + "-gen.cpp"

            fileTags: ["cpp"]


        prepare: {

            var cmd = new JavaScriptCommand();

            cmd.description =  'Running test generator';

            cmd.sourceCode = function(){

                var file = new TextFile(output.filePath, TextFile.WriteOnly);

                file.write("const int c = 5;");



            return cmd;




This is a dependent product's description:

import qbs
{    Group {        name: "generatorInput"        files: [
"testinput.h"        ]        fileTags: ['hpp', "genxx"]    }
    Group {        files:[            "a.h"        ]    }
    Depends {name: "cpp" }    Depends {name: "testgen" }

"testinput.h" file contains "#include "a.h" directive. Changing
testinput.h results in a generator run followed by a C++ compiler run.
Changing a.h results in no action, although in this case the generator
is intended to reprocess its input.

вт, 15 сент. 2020 г. в 17:47, Dan Pat <dannix84 at gmail.com>:

> Yes, the product does depend on the 'cpp' module. The include paths are
> fine, since the same header files are later used by the compiler. A little
> more detail: I use the Group language item to tag such headers
> appropriately.
> Assuming that the generator inputs tag is "genxx", the fileTags of the
> Group is  fileTags: ['hpp', 'genxx'].
> пн, 14 сент. 2020 г. в 20:52, Jochen Ulrich <jochen.ulrich at clausmark.com>:
>> But it will only scan for dependent header files if the product using the
>> code generator depends on the `cpp` module and if the `cpp.includePaths`
>> are set up correctly, right?
>> Is this the case?
>> Best
>> Jochen
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/qbs/attachments/20200915/0418a006/attachment.html>

More information about the Qbs mailing list