Best way to build .swf AND .swcAir artifacts for a single project?

wenslayer's Avatar


06 Mar, 2015 10:14 PM

I'm investigating migrating a complex multi-module Flash/Air build from Ant to Gradle. One the things I'm trying to figure out how to build two artifacts from the same project: a .swf, targeting Flash on the desktop, and a .swcAir, targeting Air on mobile. Is there a way I can build both artifacts from the same project in one invocation?

I'm currently working around this using ConfigSlurper + environments and passing a property on the command line to build the project for either Flash or Air (tailoring the buildDir, type and additionalCompilerOptions). This works fine for build CI purposes (it just has to be built twice using a different environment property), but doesn't help when we want to generate IDEA project files, as they only support what environment is active when invoked.

Any suggestions on the feasibility to either:
* Build two artifacts for one project in a single invocation (e.g.: 'gradle :project:compile' produces .swc and .swcAir)? * Generate IDEA project files that support building both the Flash and AIR variants of a project's artifacts?

Looking at this from a different perspective, I suppose we could have a peer project for building the other variant (e.g.: project FooBar and FooBarAir) but point the sources for the *Air project to its non-Air peer's src directory. This would potentially "pollute" the directory tree with pairs, but could preserve the 1:1 relationship between project and artifact, and allow IDEA project file creation to support both types. If this sounds like the most feasible way, any ideas on some clever Groovy script to configure a set of projects in one blurb (vs. spelling out each one)?

Thanks for your advice!

  1. Support Staff 1 Posted by Yennick Trevels on 17 Mar, 2015 07:28 PM

    Yennick Trevels's Avatar

    When having to build multiple artifacts, I generally recommend to to use multiple projects, one for each artifact. Each of these use a library which contains the shared code. These projects are sub-projects of one root project, which only has a build file with common build logic in it.
    This keeps everything nicely separated, allows you to build multiple artifacts with one single call and should allow you to generate IDEA project files for each project.

  2. 2 Posted by wenslayer on 23 Mar, 2015 09:29 PM

    wenslayer's Avatar

    Thanks Yennick, I decided to pursue an approach with a 1:1 project:artifact mapping, and abandon the use of an environment to determine the artifact to build. It is working much better.

  3. wenslayer closed this discussion on 15 Apr, 2015 01:44 AM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts


? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac

Recent Discussions

21 Jun, 2017 06:38 AM
10 Jun, 2017 04:16 PM
24 Mar, 2017 07:10 PM
19 Mar, 2017 04:39 AM
22 Jan, 2017 07:46 AM


11 Oct, 2016 01:18 PM
20 Sep, 2016 04:36 PM
06 Sep, 2016 08:05 PM
03 Aug, 2016 11:15 AM
01 Jun, 2016 05:20 PM
03 May, 2016 09:17 PM