aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/blackbox/testdata/product-dependencies-by-type/product-dependencies-by-type.qbs
blob: 73c9c695da627566733e18256d29178be9f8659d (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
import qbs
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"
        }
        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.contains("darwin")
                bundle.isBundle: false
            }
        }

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

            Rule {
                multiplex: true
                inputsFromDependencies: "application"
                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);
                        file.close();
                    };
                    return cmd;
                }
            }
        }
    }
}