Captive AIR support

Jeff Wilson's Avatar

Jeff Wilson

24 Aug, 2012 06:14 PM

I would like to generate a captive AIR build using GradleFx. To do so, I need to pass the directive "-target bundle" to the adt compiler. The packageAir task action calls createCompilerArguments() method to collect the arguments, which uses the additionalCompilerOptions property. I therefore assume that I should be putting the "-target bundle" directive into the additionalCompilerOptions property.

This approach fails because the mxmlc compiler does not recognize the "-target bundle" directive with the error: "unknown configuration variable 'target'", preventing it from getting the adt compiler.

Is there another way to specify adt compiler directives that is independent of mxmlc directives, or is there an air property that enables captive air compile directives?

  1. Support Staff 1 Posted by Yennick Trevels on 24 Aug, 2012 07:05 PM

    Yennick Trevels's Avatar

    Unfortunately there isn't a build in way to specify these arguments. This is something high on my list to open up the adt compiler options. Right now the AIR support is limited to a standard desktop application.

    What you can do is to write a custom task and call the adt compiler in it (like we do internally in GradleFx), then you have the full freedom. This can look like this:

    task(airBundle) << { project.flexHome + '/lib/adt.jar',
                    fork: true,
                    timeout: 10000,
                    resultproperty: 'airResultProperty',
                    outputproperty: 'airOutputProperty') {
                arg(value: '-package')
                arg(value: '-target')
                arg(value: 'bundle')
            if (['airResultProperty'] != '0') {
                throw new Exception("Packaging failed: ${['antResultProperty']}\n")

    which you can then execute with 'gradle airBundle'.
    I haven't tested this piece of code (copied the biggest part from GradleFx code), but it should be something like this.

  2. 2 Posted by Jeff Wilson on 30 Aug, 2012 06:01 PM

    Jeff Wilson's Avatar

    I ended up by modifying the source for GradleFx 0.5 to add support for captive air packaging. In the modified version, the air complex property now supports a 'captive' property, so adding 'air.captive = "true"' to an air typed build.gradle file results in a captive packaging of the air file.

    Specifically, these are the changes I made:

    In GradleFxConvention.groovy, I added the air.captive complex property and defaulted it to "false" for backward compatibility:

    air = [
        keystore:               "${}.p12",
        storepass:              null,
        applicationDescriptor:  "/src/main/actionscript/${}.xml",
        includeFileTrees:       null,
        captive:                "false"

    In AirPackage.groovy, I made the following 3 changes:

    1) added a new addAirCaptiveOptions() method:

    private void addAirCaptiveOptions(List compilerOptions) {
      if (flexConvention.air.captive == "true") {

    2) I updated the createCompilerArguments() method to call the newly added method:

    private List createCompilerArguments() {
      List airOptions = ["-package"]
            new File(project.buildDir.absolutePath, flexConvention.output).absolutePath,
        return airOptions

    3) Finally, I removed the timeout parameter from the call in the packageAir() method. This was after noting that a 60-second timeout was still failing due to the increased time required by adt to complete a captive air packaging.

    I hope that documenting these enhancements will be be beneficial for both GradleFx users and for the excellent GradleFx project. Enjoy!

  3. Support Staff 3 Posted by Yennick Trevels on 30 Aug, 2012 06:12 PM

    Yennick Trevels's Avatar

    Thanks for sharing Jeff!

    I'll probably try to open up all air packaging options by including
    something like additionalAirOptions, similar to how you can specify
    compiler options with additionalCompilerOptions.
    The timeout is indeed something we propably should provide a property for,
    I'll make an issue for it on the GradleFx issue page.


  4. 4 Posted by plank.michael on 06 Oct, 2014 06:39 AM

    plank.michael's Avatar

    Is this functionality implemented in one of the latest GradleFX versions?
    I would also need to build captive AIR apps.

  5. Support Staff 5 Posted by Yennick Trevels on 06 Oct, 2014 07:25 AM

    Yennick Trevels's Avatar

    no, it hasn't. Currently we only support standard desktop apps and mobile apps.

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:


Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

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