diff options
author | Christian Kandeler <christian.kandeler@nokia.com> | 2012-03-12 12:03:21 +0100 |
---|---|---|
committer | Joerg Bornemann <joerg.bornemann@nokia.com> | 2012-03-22 09:56:18 +0100 |
commit | d8245b48ad53410ad3bf9dd7c14c4311c606071a (patch) | |
tree | 5f82ad3e2139881d0820aae78afb96a73dfddb80 /share/qbs/modules/qbs | |
parent | 4491891d560d763c429de95e0597a957c48332c9 (diff) |
Add support for deployment.
There are two modes.
The first one, which can be thought of as "pre-packaging",
copies all files with a "deploy" tag to a directory specified by the
property qbs.deployRoot.
The second mode is active if the property qbs.deployInfoFile is set. It
simply gathers all files to be deployed and writes their source and
target paths into that file.
Note that deployment of build products (applications, libraries)
is currently not supported, because the necessary concepts do
not exist yet in qbs.
An in-depth discussion of the overall concept can be found at
http://lists.qt-project.org/pipermail/qbs/2012-February/000025.html.
Change-Id: I1ad5319cbb25cc0e5ca0baa130514e59245fd33a
Reviewed-by: Joerg Bornemann <joerg.bornemann@nokia.com>
Diffstat (limited to 'share/qbs/modules/qbs')
-rw-r--r-- | share/qbs/modules/qbs/common.qbs | 50 |
1 files changed, 49 insertions, 1 deletions
diff --git a/share/qbs/modules/qbs/common.qbs b/share/qbs/modules/qbs/common.qbs index aa5916a98..0ac38ff2d 100644 --- a/share/qbs/modules/qbs/common.qbs +++ b/share/qbs/modules/qbs/common.qbs @@ -17,6 +17,8 @@ Module { property string installDir: '.' property string sysroot property string installPrefix: "" + property string deployRoot: "./deployRoot" + property string deployInfoFile PropertyOptions { name: "buildVariant" @@ -49,11 +51,57 @@ Module { cmd.sourceCode = function() { File.remove(output.fileName); if (!File.copy(input.fileName, output.fileName)) - throw "Cannot copy '" + input.fileName + "' to '" + output.fileName + "'"; + throw "Cannot install '" + input.fileName + "' as '" + output.fileName + "'"; } cmd.description = "installing " + FileInfo.fileName(output.fileName); cmd.highlight = "linker"; return cmd; } } + + Rule { + inputs: "deploy" + multiplex: deployInfoFile != null + Artifact { + fileTags: "installed_content" + fileName: { + if (product.modules.qbs.deployInfoFile) + return product.modules.qbs.deployInfoFile + return input.modules.qbs.deployRoot + "/" + input.modules.qbs.installPrefix + + "/" + input.modules.qbs.installDir + "/" + input.fileName + } + } + + prepare: { + var cmd = new JavaScriptCommand() + cmd.deployInfo = [] + if (product.modules.qbs.deployInfoFile) { + for (var i in inputs.deploy) { + var sourceFile = inputs.deploy[i].fileName + var destFile = product.modules.qbs.installPrefix + "/" + + inputs.deploy[i].modules.qbs.installDir + "/" + + FileInfo.fileName(sourceFile) + destFile = destFile.replace(/\/+/g, "/") + destFile = destFile.replace(/\/\.\//g, "/") + cmd.deployInfo.push(sourceFile + "|" + destFile) + } + cmd.description = "Writing deployment information to '" + output.fileName + "'" + cmd.sourceCode = function() { + var deployInfoFile = new TextFile(output.fileName, TextFile.WriteOnly) + for (var i in deployInfo) + deployInfoFile.writeLine(deployInfo[i]) + deployInfoFile.close() + } + } else { + cmd.description = "deploying " + FileInfo.fileName(output.fileName) + cmd.sourceCode = function() { + File.remove(output.fileName) + if (!File.copy(input.fileName, output.fileName)) + throw "Cannot deploy '" + input.fileName + "' to '" + output.fileName + "'" + } + } + cmd.highlight = "linker" + return cmd + } + } } |