forked from qt-creator/qt-creator
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>
This commit is contained in:
@@ -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.
|
||||
|
32
qbs/modules/copyable_resource/copyable-resource.qbs
Normal file
32
qbs/modules/copyable_resource/copyable-resource.qbs
Normal file
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,26 +0,0 @@
|
||||
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;
|
||||
}
|
||||
}
|
@@ -1,6 +1,5 @@
|
||||
import qbs
|
||||
import qbs.FileInfo
|
||||
import "./copytransformer.qbs" as CopyTransformer
|
||||
import QtcFunctions
|
||||
|
||||
DynamicLibrary {
|
||||
@@ -8,6 +7,7 @@ DynamicLibrary {
|
||||
Depends { name: "ExtensionSystem" }
|
||||
Depends { name: "cpp" }
|
||||
Depends { name: "Qt.core" }
|
||||
Depends { name: "copyable_resource" }
|
||||
targetName: QtcFunctions.qtLibraryName(qbs, name.split('_')[1])
|
||||
destinationDirectory: project.buildDirectory + '/'
|
||||
+ FileInfo.relativePath(project.ide_source_tree, sourceDirectory)
|
||||
@@ -17,8 +17,10 @@ DynamicLibrary {
|
||||
].concat(additionalRPaths)
|
||||
property pathList filesToCopy
|
||||
property pathList additionalRPaths: []
|
||||
CopyTransformer {
|
||||
sourceFiles: product.filesToCopy
|
||||
targetDirectory: product.destinationDirectory
|
||||
Group {
|
||||
name: "resources"
|
||||
fileTags: "copyable_resource"
|
||||
copyable_resource.targetDirectory: product.destinationDirectory
|
||||
files: product.filesToCopy
|
||||
}
|
||||
}
|
||||
|
@@ -4,6 +4,6 @@ import "../../../plugin.qbs" as Plugin
|
||||
Plugin {
|
||||
name: "circular_plugin1"
|
||||
filesToCopy: "plugin.xml"
|
||||
files: ["plugin1.h", "plugin1.cpp"].concat(filesToCopy)
|
||||
files: ["plugin1.h", "plugin1.cpp"]
|
||||
cpp.defines: base.concat(["PLUGIN1_LIBRARY"])
|
||||
}
|
||||
|
@@ -4,6 +4,6 @@ import "../../../plugin.qbs" as Plugin
|
||||
Plugin {
|
||||
name: "circular_plugin2"
|
||||
filesToCopy: "plugin.xml"
|
||||
files: ["plugin2.h", "plugin2.cpp"].concat(filesToCopy)
|
||||
files: ["plugin2.h", "plugin2.cpp"]
|
||||
cpp.defines: base.concat(["PLUGIN2_LIBRARY"])
|
||||
}
|
||||
|
@@ -4,6 +4,6 @@ import "../../../plugin.qbs" as Plugin
|
||||
Plugin {
|
||||
name: "circular_plugin3"
|
||||
filesToCopy: "plugin.xml"
|
||||
files: ["plugin3.h", "plugin3.cpp"].concat(filesToCopy)
|
||||
files: ["plugin3.h", "plugin3.cpp"]
|
||||
cpp.defines: base.concat(["PLUGIN3_LIBRARY"])
|
||||
}
|
||||
|
@@ -10,6 +10,6 @@ Plugin {
|
||||
destinationDirectory + "/../plugin2",
|
||||
destinationDirectory + "/../plugin3"
|
||||
]
|
||||
files: ["plugin1.h", "plugin1.cpp"].concat(filesToCopy)
|
||||
files: ["plugin1.h", "plugin1.cpp"]
|
||||
cpp.defines: base.concat(["PLUGIN1_LIBRARY"])
|
||||
}
|
||||
|
@@ -4,6 +4,6 @@ import "../../../plugin.qbs" as Plugin
|
||||
Plugin {
|
||||
name: "correct_plugin2"
|
||||
filesToCopy: "plugin.spec"
|
||||
files: ["plugin2.h", "plugin2.cpp"].concat(filesToCopy)
|
||||
files: ["plugin2.h", "plugin2.cpp"]
|
||||
cpp.defines: base.concat(["PLUGIN2_LIBRARY"])
|
||||
}
|
||||
|
@@ -6,6 +6,6 @@ Plugin {
|
||||
Depends { name: "correct_plugin2" }
|
||||
filesToCopy: "plugin.spec"
|
||||
additionalRPaths: [destinationDirectory + "/../plugin2"]
|
||||
files: ["plugin3.h", "plugin3.cpp"].concat(filesToCopy)
|
||||
files: ["plugin3.h", "plugin3.cpp"]
|
||||
cpp.defines: base.concat(["PLUGIN3_LIBRARY"])
|
||||
}
|
||||
|
@@ -1,6 +1,5 @@
|
||||
import qbs
|
||||
import QtcAutotest
|
||||
import "../copytransformer.qbs" as CopyTransformer
|
||||
|
||||
QtcAutotest {
|
||||
name: "PluginManager autotest"
|
||||
@@ -15,6 +14,8 @@ QtcAutotest {
|
||||
Group {
|
||||
id: pluginGroup
|
||||
name: "plugins"
|
||||
fileTags: "copyable_resource"
|
||||
copyable_resource.targetDirectory: product.destinationDirectory + "/plugins"
|
||||
files: [
|
||||
"plugins/otherplugin.xml",
|
||||
"plugins/plugin1.xml",
|
||||
@@ -22,11 +23,6 @@ QtcAutotest {
|
||||
]
|
||||
}
|
||||
|
||||
CopyTransformer {
|
||||
sourceFiles: pluginGroup.files
|
||||
targetDirectory: product.destinationDirectory + "/plugins"
|
||||
}
|
||||
|
||||
files: "tst_pluginmanager.cpp"
|
||||
cpp.defines: base.concat(['PLUGINMANAGER_TESTS_DIR="' + destinationDirectory + '"'])
|
||||
}
|
||||
|
@@ -1,7 +1,5 @@
|
||||
import qbs
|
||||
|
||||
import QtcAutotest
|
||||
import "../copytransformer.qbs" as CopyTransformer
|
||||
|
||||
QtcAutotest {
|
||||
name: "ExtensionSystem pluginspec autotest"
|
||||
@@ -13,6 +11,8 @@ QtcAutotest {
|
||||
Group {
|
||||
id: testSpecsGroup
|
||||
name: "test specs"
|
||||
fileTags: "copyable_resource"
|
||||
copyable_resource.targetDirectory: product.destinationDirectory + "/testspecs"
|
||||
files: [
|
||||
"testspecs/simplespec.xml",
|
||||
"testspecs/simplespec_experimental.xml",
|
||||
@@ -28,6 +28,8 @@ QtcAutotest {
|
||||
Group {
|
||||
id: testDependenciesGroup
|
||||
name: "test dependencies"
|
||||
fileTags: "copyable_resource"
|
||||
copyable_resource.targetDirectory: product.destinationDirectory + "/testdependencies"
|
||||
files: [
|
||||
"testdependencies/spec1.xml",
|
||||
"testdependencies/spec2.xml",
|
||||
@@ -39,21 +41,8 @@ QtcAutotest {
|
||||
Group {
|
||||
id: specGroup
|
||||
name: "spec"
|
||||
fileTags: "copyable_resource"
|
||||
copyable_resource.targetDirectory: product.destinationDirectory + "/testdir"
|
||||
files: ["testdir/spec.xml"]
|
||||
}
|
||||
|
||||
CopyTransformer {
|
||||
sourceFiles: testSpecsGroup.files
|
||||
targetDirectory: product.destinationDirectory + "/testspecs"
|
||||
}
|
||||
|
||||
CopyTransformer {
|
||||
sourceFiles: testDependenciesGroup.files
|
||||
targetDirectory: product.destinationDirectory + "/testdependencies"
|
||||
}
|
||||
|
||||
CopyTransformer {
|
||||
sourceFiles: specGroup.files
|
||||
targetDirectory: product.destinationDirectory + "/testdir"
|
||||
}
|
||||
}
|
||||
|
@@ -6,7 +6,7 @@ Plugin {
|
||||
files: [
|
||||
"testplugin.h", "testplugin.cpp",
|
||||
"testplugin_global.h"
|
||||
].concat(filesToCopy)
|
||||
]
|
||||
filesToCopy: "testplugin.xml"
|
||||
cpp.defines: base.concat(["MYPLUGIN_LIBRARY"])
|
||||
}
|
||||
|
Reference in New Issue
Block a user