summaryrefslogtreecommitdiff
path: root/tests/auto/blackbox/testdata/rule-with-non-required-inputs/rule-with-non-required-inputs.qbs
blob: 9d861b674415274405f2df69e42425dfe3c76c54 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import qbs.TextFile

Product {
    name: "p"
    type: ["p.out"]

    property bool enableTagger

    FileTagger {
        condition: enableTagger
        patterns: ["*.inp"]
        fileTags: ["p.in"]
    }

    Rule {
        multiplex: true
        requiresInputs: false
        inputs: ["p.in"]
        Artifact {
            filePath: "output.txt"
            fileTags: ["p.out"]
        }
        prepare: {
            var cmd = new JavaScriptCommand();
            cmd.description = "generating " + output.fileName;
            cmd.sourceCode = function() {
                var f = new TextFile(output.filePath, TextFile.WriteOnly);
                f.write('(');
                var inputsList = inputs["p.in"];
                if (inputsList) {
                    for (var i = 0; i < inputsList.length; ++i)
                        f.write(inputsList[i].fileName + ',');
                }
                f.write(')');
            };
            return [cmd];
        }
    }

    files: ["a.inp", "b.inp", "c.inp"]
}