copytransformer.qbs 891 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
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();
16 17
                cmd.sourceFile = artifact.filePath;
                cmd.description = "Copying '" + cmd.sourceFile + "' to '" + output.filePath + "/'.";
18
                cmd.highlight = "codegen";
19
                cmd.targetFilePath = output.filePath + '/' + FileInfo.fileName(cmd.sourceFile);
20 21 22 23 24 25 26
                cmd.sourceCode = function() { File.copy(sourceFile, targetFilePath); }
                commands.push(cmd);
            }
        }
        return commands;
    }
}