summaryrefslogtreecommitdiff
path: root/qbs
diff options
context:
space:
mode:
authorChristian Kandeler <christian.kandeler@digia.com>2014-07-16 17:13:41 +0200
committerChristian Kandeler <christian.kandeler@digia.com>2014-07-17 13:08:30 +0200
commit01addecb8de0469cd97b55efaf7b1bb6b19b48cb (patch)
tree3b8c70908f3d6357d29de47e1e24e41fe6e2fe9f /qbs
parent0c00f44a2d1683926f72a6fcd5eba63f3ed9db8b (diff)
downloadqt-creator-01addecb8de0469cd97b55efaf7b1bb6b19b48cb.tar.gz
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>
Diffstat (limited to 'qbs')
-rw-r--r--qbs/imports/QtcAutotest.qbs1
-rw-r--r--qbs/modules/copyable_resource/copyable-resource.qbs32
2 files changed, 33 insertions, 0 deletions
diff --git a/qbs/imports/QtcAutotest.qbs b/qbs/imports/QtcAutotest.qbs
index 376c2f91c6..0bd37a905b 100644
--- a/qbs/imports/QtcAutotest.qbs
+++ b/qbs/imports/QtcAutotest.qbs
@@ -5,6 +5,7 @@ import QtcProduct
QtcProduct {
type: "application"
Depends { name: "Qt.test" }
+ Depends { name: "copyable_resource" }
targetName: "tst_" + name.split(' ').join("")
// This needs to be absolute, because it is passed to one of the source files.
diff --git a/qbs/modules/copyable_resource/copyable-resource.qbs b/qbs/modules/copyable_resource/copyable-resource.qbs
new file mode 100644
index 0000000000..d8dda99a91
--- /dev/null
+++ b/qbs/modules/copyable_resource/copyable-resource.qbs
@@ -0,0 +1,32 @@
+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;
+ }
+ }
+}