[Qbs] Deployment and dependency bundling

Alberto Mardegan mardy at users.sourceforge.net
Mon Dec 23 16:28:19 CET 2019


On 28/11/19 23:08, Alberto Mardegan wrote:
>   Whether one prepares macOS bundles, AppImage files of MSI installers,
> one has to go through the dependency collection step, which is largely
> similar for all platforms. To be more explicit, I'm referring to the
> kind of job that on macOS is performed by the macdeployqt tool, and that
> seems to be asked in https://bugreports.qt.io/browse/QBS-956.

I've been trying to implement a "deployment" module in order to achieve
the first step of this process, that is copying all of the application's
dependencies into the build directory. However, I'm having some issues
with the module's rule.

I've got it working to some point by adding these properties to the Rule:

    inputsFromDependencies: ["application", "dynamiclibrary"]
    multiplex: true
    outputFileTags: ["deployed_library"]

but this causes the Rule to be run only for the application's
dependencies, and not for the application itself. Adding

    inputs: ["application"]

seems to solve the issue, however for some strange reason (at least,
strange to me) if the Product using this module is not an application,
but a shared library, QBS will try to also build the product as an
application (and this will fail, not last because main() is not
defined). This is not a big issue, since anyway I'd expect this module
to be used only for applications, but if possible I'd like to avoid
hardcoding the input to "application".

I also tried replacing the `inputs` property with

   inputs: products.type

but this causes QBS to fail with this error:

============
ERROR: Cycle detected in rule dependencies:
[deployed_library][application,deployed_library,desktopfile,dynamiclibrary,qm]
/home/mardy/src/git/mappero/qbs/modules/deployment/Deployment.qbs:26:18
============

Or maybe my approach is totally off, and it would be better to implement
dependency deployment as a Product (since, ultimately, one would use it
to obtain a MacOS package, an AppImage or a MSI package?)?
Then, I suppose, just `inputsFromDependencies: ["application"]` would be
enough?

Ciao,
  Alberto

-- 
http://www.mardy.it - Geek in un lingua international


More information about the Qbs mailing list