aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/blackbox/testdata/concurrent-executor/concurrent-executor.qbs
blob: 802aa1450a52f9ebd956389115809439b04901b4 (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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
import qbs.File
import qbs.TextFile
import "util.js" as Utils

Product {
    type: ["final1", "final2"]
    Group {
        files: ["dummy1.input"]
        fileTags: ["input1"]
    }
    Group {
        files: ["dummy2.input"]
        fileTags: ["input2"]
    }
    Rule {
        inputs: ["input1"]
        Artifact {
            filePath: project.buildDirectory + "/dummy1.final"
            fileTags: ["final1"]
        }
        prepare: {
            var cmds = [];
            for (var i = 0; i < 10; ++i) {
                var cmd = new JavaScriptCommand();
                cmd.silent = true;
                cmd.createFile = i == 9;
                cmd.sourceCode = function() {
                    if (createFile) {
                        console.info("Creating file");
                        var file = new TextFile(output.filePath, TextFile.WriteOnly);
                        file.close();
                    }
                };
                cmds.push(cmd);
            }
            return cmds;
        }
    }
    Rule {
        inputs: ["input2"]
        Artifact {
            filePath: "dummy.intermediate"
            fileTags: ["intermediate"]
        }
        prepare: {
            var cmd = new JavaScriptCommand();
            cmd.silent = true;
            cmd.sourceCode = function() { };
            return [cmd];
        }
    }
    Rule {
        inputs: ["intermediate"]
        outputFileTags: "final2"
        prepare: {
            do
                Utils.sleep(6000);
            while (!File.exists(project.buildDirectory + "/dummy1.final"));
            var cmd = new JavaScriptCommand();
            cmd.silent = true;
            cmd.sourceCode = function() { };
            return [cmd];
        }
    }
}