Best way to build .swf AND .swcAir artifacts for a single project?
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!
Comments are currently closed for this discussion. You can start a new one.
Keyboard shortcuts
Generic
? | 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
Support Staff 1 Posted by Yennick Trevels on 17 Mar, 2015 07:28 PM
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 Posted by wenslayer on 23 Mar, 2015 09:29 PM
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.
wenslayer closed this discussion on 15 Apr, 2015 01:44 AM.