From 01addecb8de0469cd97b55efaf7b1bb6b19b48cb Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Wed, 16 Jul 2014 17:13:41 +0200 Subject: 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 --- qbs/imports/QtcAutotest.qbs | 1 + .../copyable_resource/copyable-resource.qbs | 32 ++++++++++++++++++++++ 2 files changed, 33 insertions(+) create mode 100644 qbs/modules/copyable_resource/copyable-resource.qbs (limited to 'qbs') 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; + } + } +} -- cgit v1.2.1