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

07 May, 2023 04:17 PM
28 Apr, 2023 11:22 PM
23 Apr, 2023 09:43 AM
03 Nov, 2022 01:22 AM
29 Jun, 2022 05:39 PM


04 Aug, 2021 12:50 PM
15 Apr, 2021 06:10 PM
15 Jan, 2021 06:56 PM
09 Mar, 2020 11:11 PM
09 Mar, 2020 11:09 PM
17 Apr, 2019 02:51 PM