aboutsummaryrefslogtreecommitdiffstats
path: root/qtc-super.qbs
blob: c924e13cf78376cab8464cd36cab5b3984aee124 (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
import qbs
import qbs.File
import qbs.FileInfo
import qbs.TextFile

Project {
    name: "Qt Creator Super Project"

    qbsSearchPaths: ["qtcreator/qbs"]

    Probe {
        id: submodules
        property var modules: []

        configure: {
            var mods = [];
            var gitmodules = new TextFile(FileInfo.joinPaths(path, ".gitmodules"));
            var module = null;
            while (!gitmodules.atEof()) {
                var line = gitmodules.readLine();
                var modLine = line.match(/^\[submodule "([^"]+)"\]$/);
                if (modLine) {
                    module = { _name: modLine[1] };
                    mods.push(module);
                } else if (module) {
                    var propLine = line.match(/^\t([^ =]+) *= *(.*)$/);
                    if (propLine)
                        module[propLine[1]] = propLine[2];
                    else
                        console.warn("Malformed line in .gitmodules: " + line);
                }
            }
            modules = mods;
        }
    }

    SubProject {
        filePath: "qtcreator/qtcreator.qbs"
        Properties {
            additionalPlugins: {
                var plugins = [];
                submodules.modules.forEach(function(module) {
                    var modulePath = module.path;
                    var qbsBase = FileInfo.fileName(modulePath);
                    if (qbsBase !== "qtcreator") { // skip qtcreator submodule
                        var file = FileInfo.joinPaths(path, modulePath, "plugins", qbsBase,
                                                 qbsBase + ".qbs");
                        if (!File.exists(file))
                            file = FileInfo.joinPaths(path, modulePath, qbsBase + ".qbs");
                        if (File.exists(file))
                            plugins.push(file);
                    }
                });
                return plugins;
            }
        }
    }
}