[QBS] RFC: Deployment support for qbs

joerg.bornemann at nokia.com joerg.bornemann at nokia.com
Thu Feb 23 08:38:13 CET 2012


Hi Mathieu,

What do you mean by "only making one of those"?
If you're instantiating a transformer like in tests/manual/transformers, you're creating exactly one artifact (== target in make terms).

To adapt your example, the sourceCode in JavaScriptCommand would need a function to start a process and read its output. Until that's implemented, you can put your code to create the installer into a separate script:

---sketch---
Transformer {
    Artifact {
        fileName: "installer.exe"
    }
    prepare: {
        var cmd = new Command("python", "createInstaller.py");
        cmd.description = "create installer";
        return cmd;
    }
}
---sketch---


BR,

Jörg

________________________________
From: ext Mathieu Bouchard [mbouchar at gmail.com]
Sent: 23 February 2012 03:20
To: Bornemann Joerg (Nokia-MP/Berlin)
Cc: Kandeler Christian (Nokia-MP/Berlin); qbs at qt-project.org
Subject: Re: [QBS] RFC: Deployment support for qbs

Yes, something like QMAKE_EXTRA_TARGETS. I am calling system(git describe --tags) and I get the output and pass it to makensis in a custom target:

SCM_VERSION = $$system(git describe --tags)
!isEmpty(QMAKE_SH) {
    # qmake in a unix shell requires escaping on the parenthesis
    VI_VERSION = $$system(python -c 'print\\(\\"$${SCM_VERSION}\\".split\\(\\"-\\"\\)[0]\\)')
} else {
    VI_VERSION = $$system(python -c 'print(\\"$${SCM_VERSION}\\".split(\\"-\\")[0])')
}

win32 {
    createinstaller.target = installer
    createinstaller.commands = $${QMAKE_COPY} \"$${TARGET_FILENAME}\" \"$${DESTDIR_WIN}\" &&
    createinstaller.commands += cd \"$$PWD/win32\" && makensis -DVIVERSION=$${VI_VERSION} -DVERSION=$${SCM_VERSION} installer.nsi
    createinstaller.depends = first
    QMAKE_EXTRA_TARGETS += createinstaller
}

How do we tell qbs to only make one of those?

On Wed, Feb 22, 2012 at 5:28 AM, Joerg Bornemann <joerg.bornemann at nokia.com<mailto:joerg.bornemann at nokia.com>> wrote:
On 22/02/2012 06:54, ext Mathieu Bouchard wrote:

You could also probably cover more platforms by adding custom targets
support. For example, I currently use some "undocumented" qmake
functions to add custom targets to the build process. They are used to
provide a "make installer" target on Windows that calls makensis to
create an installer file. On OSX, this is used to call macqtdeploy.

If I understand you correctly, you want something like QMAKE_EXTRA_TARGETS or QMAKE_EXTRA_COMPILERS.

There is support for adding custom artifacts and transformers.
See tests/manual/transformers for an example.


BR,

Jörg

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/qbs/attachments/20120223/01972de9/attachment.html>


More information about the Qbs mailing list