Handling multiplatform concerns

Hello everyone,

We’ve encountered the following uses cases in Griffon projects and we’d like to know what alternatives may exist to cover them (using the build DSL already if possible)

  • define dependencies that should be resolved per platform (such as macosx, windows32, linux, etc)
  • run an application with all dependencies (general and platform specific) using the application plugin.
  • create binary distributions (again with the application plugin) for each target platform. This requires
    • selecting all general and platform specific jars
  • tweaking the generated launch script (e.g, -Xdock:icon is not a valid JVM arg on Linux and Windows VMS)

I believe the Android tooling performs an elaborate platform matrix that delivers similar features, which of course relies on the Gradle model. Question is, how to make it work? I wish it was as simple as saying

dependencies {
    griffon 'org.codehaus.griffon:griffon-core:2.3.0'

    platform {
        macosx  { compile 'com.apple:unicorns:1.0.0' }
        windows { compile 'com.microsoft:dragons:1.2.3' }

run {
    platform {
        macosx {
            jvmArgs = ['-XDock:icon=path/to/app.icns']

Then it would a simple matter to define the target platform to run as a project property or pick it up as a default from System properties.

This hints at one of the priorities we talked about at the Gradle Summit, variant aware dependency management.

@daz anything worth sharing about the plan for this?

We are currently working actively on a solution that will make it easy to do something like this when using the new configuration model. You’ll be able to define platforms, variants for those platforms, and different dependencies for those variants.

This work is being done in collaboration with the Android Tooling team. They had to do a lot trickery with configurations and dependencies to make this work in the current Android plugin. Pretty soon they will release a new (experimental) plugin that will be based on the new Software Component model, and will be able to leverage some of the upcoming variant-aware dependency management features.

Stay tuned!

Lovely! this feature will enable tighter integration with platform specific features required by our users :smile: