[QBS] Multiply Artifacts in the rule

Christian Kandeler christian.kandeler at digia.com
Mon Oct 28 17:05:18 CET 2013

On 10/28/2013 04:48 PM, Fischer Pavel wrote:
> Thank you for the reply, but it doesn't help. It's still undefined.
> Here is the sample project. Perhaps there is more than one error.

The print statement in the attached project has exactly the same problem 
as the one in your last post.
I have attached a version of your module file that prints the file name 
of the output artifact, which I assume the code was supposed to do. It 
works as expected.

-------------- next part --------------
import qbs.base
import qbs.TextFile
import qbs.FileInfo

Module {
    name: "enum"

	Depends { name: "cpp" }

    FileTagger {
        pattern: "*.enum"
        fileTags: ["enum"]

    Rule {
        inputs: ["enum"]

        Artifact {
            fileName: input.fileName.replace(/enum$/,'h')
            fileTags: ["hpp"]
        Artifact {
            fileName: input.fileName.replace(/enum$/,'cpp')
            fileTags: ["cpp"]

        prepare: {
            var cmd = new JavaScriptCommand();
            cmd.description = "Generate enum class " + FileInfo.fileName(input.fileName);
            cmd.highlight = "codegen";
            cmd.sourceCode = function() {
                for (var index in outputs) {
					print("Output: " + index);
					for (var items in outputs[index]) {


            return cmd;

More information about the Qbs mailing list