aboutsummaryrefslogtreecommitdiffstats
path: root/share/share.qbs
blob: 9349d5c8b64d8e597e7e9fbe83068b1f70feecde (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
140
141
142
143
144
145
146
import qbs
import qbs.File
import qbs.FileInfo
import qbs.TextFile
import qbs.Utilities

Product {
    name: "qbs resources"
    type: ["qbs qml type descriptions", "qbs qml type bundle"]
    Depends { name: "qbsbuildconfig" }

    Group {
        name: "Incredibuild"
        prefix: "../bin/"
        files: ["ibmsvc.xml", "ibqbs.bat"]
        fileTags: []
        qbs.install: qbs.targetOS.contains("windows")
        qbs.installDir: qbsbuildconfig.appInstallDir
    }

    Group {
        name: "Python executables"
        files: ["../src/3rdparty/python/bin/dmgbuild"]
        fileTags: ["qbs resources"]
        qbs.install: true
        qbs.installDir: qbsbuildconfig.libexecInstallDir
        qbs.installSourceBase: "../src/3rdparty/python/bin"
    }

    Group {
        name: "Python packages"
        prefix: "../src/3rdparty/python/**/"
        files: ["*.py"]
        fileTags: ["qbs resources"]
        qbs.install: true
        qbs.installDir: qbsbuildconfig.resourcesInstallDir + "/share/qbs/python"
        qbs.installSourceBase: "../src/3rdparty/python/lib/python2.7/site-packages"
    }

    Group {
        name: "Imports"
        files: ["qbs/imports/qbs/**/*"]
        fileTags: ["qbs resources"]
        qbs.install: true
        qbs.installDir: qbsbuildconfig.resourcesInstallDir + "/share"
        qbs.installSourceBase: "."
    }

    Group {
        name: "Modules"
        files: ["qbs/modules/**/*"]
        fileTags: ["qbs resources"]
        qbs.install: true
        qbs.installDir: qbsbuildconfig.resourcesInstallDir + "/share"
        qbs.installSourceBase: "."
    }

    Group {
        name: "Module providers"
        files: ["qbs/module-providers/**/*"]
        fileTags: ["qbs resources"]
        qbs.install: true
        qbs.installDir: qbsbuildconfig.resourcesInstallDir + "/share"
        qbs.installSourceBase: "."
    }

    Group {
        name: "Examples as resources"
        files: ["../examples/**/*"]
        fileTags: []
        qbs.install: true
        qbs.installDir: qbsbuildconfig.resourcesInstallDir + "/share/qbs"
        qbs.installSourceBase: ".."
    }

    Rule {
        condition: Utilities.versionCompare(product.qbs.version, "1.9.1") >= 0
        multiplex: true
        Artifact {
            filePath: "qbs.qmltypes"
            fileTags: ["qbs qml type descriptions"]
        }
        prepare: {
            var cmd = new JavaScriptCommand();
            cmd.description = "Generating " + output.fileName;
            cmd.highlight = "codegen";
            cmd.sourceCode = function() {
                var tf;
                try {
                    tf = new TextFile(output.filePath, TextFile.WriteOnly);
                    tf.writeLine(Utilities.qmlTypeInfo());
                } finally {
                    if (tf)
                        tf.close();
                }
            };
            return cmd;
        }
    }

    Rule {
        condition: Utilities.versionCompare(product.qbs.version, "1.9.1") >= 0
        multiplex: true
        Artifact {
            filePath: "qbs-bundle.json"
            fileTags: ["qbs qml type bundle"]
        }
        prepare: {
            var cmd = new JavaScriptCommand();
            cmd.description = "Generating " + output.fileName;
            cmd.highlight = "codegen";
            cmd.sourceCode = function() {
                var tf;
                try {
                    var imports = File.directoryEntries(FileInfo.joinPaths(product.sourceDirectory,
                                                                           "qbs", "imports", "qbs"),
                                                        File.Dirs | File.NoDotAndDotDot).filter(
                                function(i) { return i !== "base"; }).concat(
                                Utilities.builtinExtensionNames()).map(
                                function(i) { return "qbs." + i; });
                    imports.sort();
                    var obj = {
                        "name": "qbs",
                        "searchPaths": ["$(QBS_IMPORT_PATH)"],
                        "installPaths": ["$(QBS_IMPORT_PATH)"],
                        "implicitImports": ["__javascriptQt5__"],
                        "supportedImports": ["qbs"].concat(imports)
                    };
                    tf = new TextFile(output.filePath, TextFile.WriteOnly);
                    tf.writeLine(JSON.stringify(obj, undefined, 4));
                } finally {
                    if (tf)
                        tf.close();
                }
            };
            return cmd;
        }
    }

    Group {
        name: "QML Type Info"
        fileTagsFilter: ["qbs qml type descriptions", "qbs qml type bundle"]
        qbs.install: true
        qbs.installDir: qbsbuildconfig.qmlTypeDescriptionsInstallDir
    }
}