aboutsummaryrefslogtreecommitdiffstats
path: root/share/qbs/imports/qbs/base/InstallPackage.qbs
blob: 7793b7c2e1d0b70dacf0b42bc8e9a676c07b4ddc (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
import qbs
import qbs.TextFile

Product {
    type: ["archiver.archive"]
    builtByDefault: false
    Depends { name: "archiver" }
    archiver.type: "tar"
    archiver.workingDirectory: qbs.installRoot

    Rule {
        multiplex: true
        inputsFromDependencies: ["installable"]
        Artifact {
            filePath: product.name + ".tarlist"
            fileTags: ["archiver.input-list"]
        }
        prepare: {
            var cmd = new JavaScriptCommand();
            cmd.silent = true;
            cmd.sourceCode =function() {
                var ofile = new TextFile(output.filePath, TextFile.WriteOnly);
                for (var i = 0; i < inputs["installable"].length; ++i) {
                    var inp = inputs["installable"][i];
                    var installedFilePath = inp.moduleProperty("qbs", "installDir")
                            + '/' + inp.fileName;
                    while (installedFilePath[0] === '/')
                        installedFilePath = installedFilePath.substring(1);
                    ofile.writeLine(installedFilePath);
                }
                ofile.close();
            };
            return [cmd];
        }
    }
}