summaryrefslogtreecommitdiff
path: root/tests/auto/blackbox/testdata/wildcards-and-rules/wildcards-and-rules.qbs
blob: f6662529d078ebecbd3154a85909cc9f640f13b6 (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
import qbs.TextFile

Product {
    name: "wildcards-and-rules"
    type: "mytype"
    files: ["*.inp", "*.dep"]
    FileTagger {
        patterns: "*.inp"
        fileTags: ["inp"]
    }
    FileTagger {
        patterns: "*.dep"
        fileTags: ["dep"]
    }
    Rule {
        multiplex: true
        inputs: ["inp"]
        explicitlyDependsOn: ["dep"]
        Artifact {
            filePath: "test.mytype"
            fileTags: product.type
        }
        prepare: {
            var cmd = new JavaScriptCommand();
            cmd.description = "Creating output artifact";
            cmd.highlight = "codegen";
            cmd.sourceCode = function() {
                var file = new TextFile(output.filePath, TextFile.WriteOnly);
                for (var i = 0; i < inputs.inp.length; ++i)
                    file.writeLine(inputs.inp[i].fileName);
                file.close();
            }
            return cmd;
        }
    }
}