aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/extensionsystem/copytransformer.qbs
blob: fc0d7856afda2d93853ee7c3ecfaaf2604e891bd (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
import qbs
import qbs.File
import qbs.FileInfo

Transformer {
    property pathList sourceFiles
    property path targetDirectory
    inputs: sourceFiles
    Artifact { fileName: targetDirectory }
    prepare: {
        var commands = []
        for (var tag in inputs) {
            for (var index in inputs[tag]) {
                var artifact = inputs[tag][index];
                var cmd = new JavaScriptCommand();
                cmd.sourceFile = artifact.fileName;
                cmd.description = "Copying '" + cmd.sourceFile + "' to '" + output.fileName + "/'.";
                cmd.highlight = "codegen";
                cmd.targetFilePath = output.fileName + '/' + FileInfo.fileName(cmd.sourceFile);
                cmd.sourceCode = function() { File.copy(sourceFile, targetFilePath); }
                commands.push(cmd);
            }
        }
        return commands;
    }
}