aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/extensionsystem/copytransformer.qbs
blob: c306748a8c05ebb0cd5f73ac2e766c7e72df0a2f (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.filePath;
                cmd.description = "Copying '" + cmd.sourceFile + "' to '" + output.filePath + "/'.";
                cmd.highlight = "codegen";
                cmd.targetFilePath = output.filePath + '/' + FileInfo.fileName(cmd.sourceFile);
                cmd.sourceCode = function() { File.copy(sourceFile, targetFilePath); }
                commands.push(cmd);
            }
        }
        return commands;
    }
}