aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/blackbox/testdata/product-dependencies-by-type/product-dependencies-by-type.qbs
blob: 8e1f291f39b939edbf01ae11c6c73e1bd7e81b2f (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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
import qbs.TextFile

Project {
    CppApplication {
        consoleApplication: true
        name: "no-match"
        files: "main.cpp"
    }

    Project {
        CppApplication {
            consoleApplication: true
            name: "app1"
            files: "main.cpp"
        }
        CppApplication {
            consoleApplication: true
            name: "app2"
            files: "main.cpp"
        }
        CppApplication {
            consoleApplication: true
            name: "app3"
            files: "main.cpp"
        }
        Product {
            type: myconfig.typeDecider ? ["application"] : []
            Depends { name: "cpp" }
            Depends { name: "myconfig" }
            consoleApplication: true
            name: "app4"
            files: "main.cpp"
        }
        Product {
            name: "other-product"
            type: "other"
            Rule {
                multiplex: true
                Artifact {
                    filePath: "output.txt"
                    fileTags: "other"
                }
                prepare: {
                    var cmd = new JavaScriptCommand();
                    cmd.description = "creating " + output.filePath;
                    cmd.sourceCode = function() {
                        var f = new TextFile(output.filePath, TextFile.WriteOnly);
                    }
                    return cmd;
                }
            }
            Export {
                Depends { productTypes: "other2" }
            }
        }
        Product {
            name: "yet-another-product"
            type: "other2"
            Rule {
                multiplex: true
                Artifact {
                    filePath: "output.txt"
                    fileTags: "other2"
                }
                prepare: {
                    var cmd = new JavaScriptCommand();
                    cmd.description = "creating " + output.filePath;
                    cmd.sourceCode = function() {
                        var f = new TextFile(output.filePath, TextFile.WriteOnly);
                    }
                    return cmd;
                }
            }
        }
        Product {
            name: "helper"
            Export {
                Depends { productTypes: "other" }
            }
        }

        CppApplication {
            condition: false
            consoleApplication: true
            name: "disabled-app"
            files: "main.cpp"
        }

        DynamicLibrary {
            Depends { name: "cpp" }
            name: "lib-product"
            files: "main.cpp"
            Properties {
                condition: qbs.targetOS.includes("darwin")
                bundle.isBundle: false
            }
        }

        CppApplication {
            type: base.concat(["app-list"])
            consoleApplication: true
            name: "app list"
            Depends {
                productTypes: ["application"]
                limitToSubProject: true
            }
            Depends { name: "helper" }
            files: ["main.cpp"]

            Rule {
                multiplex: true
                inputsFromDependencies: ["application", "other", "other2"]
                Artifact {
                    filePath: "app-list.txt"
                    fileTags: "app-list"
                }
                prepare: {
                    var cmd = new JavaScriptCommand();
                    cmd.description = "collecting apps";
                    cmd.sourceCode = function() {
                        var file = new TextFile(output.filePath, TextFile.WriteOnly);
                        for (var i = 0; i < inputs["application"].length; ++i)
                            file.writeLine(inputs["application"][i].filePath);
                        for (i = 0; i < inputs["other"].length; ++i)
                            file.writeLine(inputs["other"][i].filePath);
                        for (i = 0; i < inputs["other2"].length; ++i)
                            file.writeLine(inputs["other2"][i].filePath);
                        file.close();
                    };
                    return cmd;
                }
            }
        }
        Product {
            name: "dummy"
            Depends { productTypes: [] }
        }
    }
}