Files
qt-creator/qbs/modules/copyable_resource/copyable-resource.qbs
Christian Kandeler 01addecb8d qbs build: Get rid of CopyTransformer.
That item was using a directory as an output artifact, which was only
working by accident and often caused warning messages about failure to
remove files.
Use a proper module instead, which is the nicer solution anyway.

Change-Id: Ib75a0ce26a24c78eb5421367995a8fc72f6a3c2a
Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
2014-07-17 13:08:30 +02:00

33 lines
1.2 KiB
QML

import qbs
import qbs.File
import qbs.FileInfo
Module {
property path targetDirectory
additionalProductTypes: "copied_resource"
Rule {
inputs: ["copyable_resource"]
outputFileTags: ["copied_resource"]
outputArtifacts: {
var destinationDir = input.moduleProperty("copyable_resource", "targetDirectory");
if (!destinationDir) {
// If the destination directory has not been explicitly set, replicate the
// structure from the source directory in the build directory.
destinationDir = project.buildDirectory + '/'
+ FileInfo.relativePath(project.sourceDirectory, input.filePath);
}
return [{
filePath: destinationDir + '/' + input.fileName,
fileTags: ["copied_resource"]
}];
}
prepare: {
var cmd = new JavaScriptCommand();
cmd.description = "Copying " + FileInfo.fileName(input.fileName);
cmd.highlight = "codegen";
cmd.sourceCode = function() { File.copy(input.filePath, output.filePath); };
return cmd;
}
}
}