Possible to add Flexunit dependencies to .actionScriptProperties using flashbuilder plugin

Nicolas Estrada's Avatar

Nicolas Estrada

03 Apr, 2013 05:10 PM


First of all, great tool, been working great so far for command line stuff. However the flashbuilder plugin's classpath is still a little incomplete. Anyhow my first question is in the title. Is it possible the same way the gradle eclipse plugins adds configurations (in my case it would be configurations.test). Of course the obvious workaround is to is directly use Flash builder however since the SDK is now a dependency (and not the one supplied by the IDE) why not?

Also I work with a bunch of legacy projects, which don't have seperate src and resource folders for the main and test AS3 files. Since the scaffold plugin is not customizable, I'm forced to run $gradle flashbuilder -x scaffold yet the default resource directories are still added to the .actionScriptProperties despite the fact that they don't exist. Anyhow nothing big, just was hoping that the flashbuilder plugin was a little more parametrizable by convention properties.

Best regards,


ps. Oh and I found a couple of bugs regarding the inputs and outputs of the various gradlefx tasks, for instance with flexUnit if I change the toDir property, I'm forced to reset the outputs as such:

def testOutput = "${project.buildDir}/reports"
flexUnit {
    player = 'air'
    verbose = true
    toDir = testOutput
    workingDir = "${project.buildDir}"
    localTrusted = true

Same thing for the asdoc tag, no biggie but the outputs should probably not be determined post task execution.

  1. Support Staff 1 Posted by Yennick Trevels on 05 Apr, 2013 06:45 AM

    Yennick Trevels's Avatar

    Hi Nicolas,

    Regarding the inputs and outputs, it looks like the flexUnit task has no inputs/outputs defined, so that's something we should fix. I will be doing a rework of this task when I find some time to make it more flexible.

    Then about your main question. Currently this task does not add the test dependencies to the actionScriptProperties file and it's also not configurable. But what you probably can do is edit this file right after the flashbuilder task has run and add those test dependencies there. Something like this (not tested though):

    flashbuilder.doLast {
        def xml = new XmlParser().parse projectDir.absolutePath + '/' + '.actionScriptProperties'
        //add the test dependencies
        Node libNode = xml.compiler.libraryPath[0]
        configurations['test'].files.each() { file ->
             new Node(libNode, 'libraryPathEntry', [
                    kind: 3, //libtype swc 
                    linkType: LINKTYPE_TEST, //not sure which int value this should be  
                    path: file.path, 
                    useDefaultLinkType: false
        //save the edited xml again
        file(path).withWriter { out ->
            XmlUtil.serialize xml, out
  2. Support Staff 2 Posted by Maxime Cowez on 06 Apr, 2013 10:41 PM

    Maxime Cowez's Avatar

    ##Test dependencies

    Unfortunately there is an answer to your why not? question. The reason that the test dependencies are not generated for a FlashBuilder (FB) project, is that FB "automagically" generates unit test dependencies when you run unit tests from within the IDE and there is absolutely nothing you can do to prevent it.
    If you use different dependencies (or different versions) than the ones generated by FB, they will all end up on the class path and screw things up magnificently. You simply can't use your custom unit test dependencies through FB.

    So when I wrote this plugin, I figured there are three use cases (please correct me if I missed anything):

    • you either use FB's built-in unit test mechanism (which forces you to use a particular dependency set)
    • or you use GradleFx' unit testing capabilities
    • or you use both, but then you use de dependencies declared in the build script with GradleFx and you use FB's built-in dependencies with FB

    That's why I decided not to include test dependencies in the generated FB properties files. Perhaps we could enhance this by issuing a proper warning message instead of just failing silently.

    ##Source directories

    As for the customization of the plugin: you sure have a valid point and I will look into it whenever I find some time ;)
    But for your specfic case that won't be necessary, since the source directories are generated from GradleFx' core plugin which is configurable. The defaults are (as described in the docs:

    • srcDirs = ['src/main/actionscript']
    • resourceDirs = ['src/main/resources']
    • testDirs = ['src/test/actionscript']
    • testResourceDirs = ['src/test/resources']

    So configuring your build script like this should give you a classic FB configuration:

    srcDirs = ['src']
    resourceDirs = ['src']
    testDirs = ['src']
    testResourceDirs = ['src']

    or perhaps even less verbose (note: I haven't tested any of this):

    srcDirs = resourceDirs = testDirs = testResourceDirs = ['src']

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