Interview, Moods

GradleFx automated builds

0 Comments 16 December 2011

GradleFx automated builds

I’ve just attended the Flex summit, a great event with 40 members of the Flex community. It was the opportunity to brainstorm about future contributions and it went very well. Some members of the community already posted great articles about what have been said. You can read this remarkable article by Adam Flater, another one by Peter Elst  and some great interviews on Nerd Radio. I’m very confident in the future of Flex because of the level of maturity of our community, and also because it’s a passionate one. To showcase this excitement, I’m working on a graph that will express all the work already done by the community. I’m currently listing several major community projects in a Google Doc. If you want to review this document and add comments, feel free to review this document.

We are looking for committers!!! If you want to participate in the success of Apache Flex, check this blog post. Yennick is one of these talented Flex developers who could become Apache Flex committers. He’s the project leader of GradleFx. I met him in Belgium during the Devoxx conference and he has been kind enough to accept an interview.

“Hi Yennick, can you introduce yourself, your background and your relationship with Flex:”

Hi, my name is Yennick Trevels and together with Steven Dick I started the GradleFx plugin. I work as a RIA Consultant at iDA MediaFoundry in Belgium where I do most of my projects in Java and Flex (desktop, web, mobile, …).

I started out as a Java developer for 3 years, but soon found out that I wanted to focus on frontend development and that’s how I got started with Flex. Flex has been somewhat of a passion for me now because it allows me to create good looking applications with lots of custom components and there are still a lot of oppertunities to create libraries which make our lives easier.

“GradleFx is a Gradle plugin. Can you explain us what Gradle is and who is using it today?”

Gradle is a new build tool which combines the best features of Ant and Maven and leaves the bad things behind. It has dependency management, convention-over-configuration, multi-project support and lot’s of other cool features. Build scripts are written in Groovy where you have access to the Gradle API, which gives your build scripts a lot of flexibility.

Lots of plugins are already available for Gradle, like the Java plugin, Maven plugin, Eclipse & Intellij plugins, Sonar plugin etc. These plugins make your build scripts a lot easier because most of the time the only thing you have to do is configure some variables. So build script in Gradle are shorter/easier and more flexible than Maven or Ant build scripts.

GradleFx uses these same principles because it’s a plugin for Gradle.

“Then I guess that GradleFx is just an extension for building Flex applications. How does it work and what do I need to make it run?”

GradleFx is indeed a plugin to build Flex applications.

First you’ll need to install the Gradle and Flex SDK, add the Gradle bin directory to your PATH environment variable and create a FLEX_HOME environment variable which points to your Flex SDK. Once you have these setup you can start to write your build script (in a build.gradle file). You don’t have to manually download GradleFx because it’s available on the Maven Central repository, so just specify it as a dependency for your build script and apply the plugin, that’s it.

“What are the features that the GradleFx plugin adds to Gradle.”

Right now the plugin has tasks to compile SWC, SWF and AIR projects, clean the build directory, copy your resources to the build directory, create an html wrapper and run FlexUnit tests.

“Automated builds are more and more strategic in our industry and most of the Flex projects are industrialized. In your opinion, what are the key differentiators of GradleFx compared to Ant or Maven for instance?”

Because GradleFx uses convention-over-configuration and builds scripts are written in Groovy your average build script will be a lot shorter and easier to read.

Another big advantage is the flexibility that Groovy offers, if you need to perform some custom functionality that isn’t available yet in any plugin then it’s much easier to write this yourself compared to Ant or Maven. Simple tasks like copying some files can be added in just a few lines of code.

GradleFx can use Ivy or Maven repositories to get its dependencies so you don’t need a separate repository for your existing Maven or Ant based build scripts.

“Can you share with us a sample to manage several project and comment the code?”

Ok, I’ll show you an example of a multi-project build which uses all the conventions provided by GradleFx.

This is the build script of the parent project and these settings are used by all sub-projects. This project doesn’t compile to a SWC or SWF.

//specify the GradleFx plugin as a dependency for this build script. Maven Central will be used to get it.
buildscript {
	repositories {
	dependencies {
		classpath group: 'org.gradlefx', name: 'gradlefx', version: '0.3.2'
//specify settings common to all subprojects
subprojects {
	//apply the GradleFx plugin to this project
	apply plugin: 'gradlefx'
	version = '1.0-SNAPSHOT'
	//define the repositories from which the project dependencies
	//should be downloaded
    	repositories {
        		mavenRepo name: 'yoolab-releases',      url: ""
        		mavenRepo name: 'yoolab-snapshots',     url: ""
	// specify the project dependencies. Notice the 'external' marker,
	// which means that the library will not be compiled in the
	// swc of the subprojects
   	dependencies {
        		external group: 'org.as3commons', name: 'as3commons-collections',
			version: '1.1', ext: 'swc'
        		external group: 'org.as3commons', name: 'as3commons-lang',
			version: '0.3.2', ext: 'swc'

Then we have the build script of a library subproject which will compile to a SWC.

//specify the type of flex project
type = 'swc'
dependencies {
	// specifies a dependency to another subproject. This will compile
	// the other project before compiling this one and use its
	// compiled SWC in this project.
	external project(':util')

And finally we have the build script of the application project which compiles to a SWF.

//specify the type of flex project
type = 'swf'
dependencies {
	// specify two dependencies to library projects. These will be compiled
	// into the SWF file since they belong to the "merged" configuration.
	merged project(':util')
	merged project(':domain')
	//override the dependencies specified in the parent project so they
	//use the "merged" configuration
	merged group: 'org.as3commons', name: 'as3commons-collections',
		version: as3commons_collections_version, ext: 'swc'
	merged group: 'org.as3commons', name: 'as3commons-lang',
		version: as3commons_lang_version, ext: 'swc'
// add another source directory for the locale files. The srcDirs property is a
// GradleFx property which by default has the value ['src/main/actionscript']. This
// is the directory where you need to put your actionscript and mxml files.
additionalCompilerOptions = [

That’s it for this example. You can find more examples in our GradleFx examples repository:

“What are you working on and what will be the next features of GradleFx?”

I just released version 0.4 which contains support for AIR projects.

Upcoming features are mobile projects support, project file generation for Eclipse and Intellij IDEA, automatic downloading of the Flex SDK and AS3Doc generation.

“GradleFx is open-source. How can we contribute?”

You can contribute in a number of ways.

One is by trying out the project and giving feedback on our support forum and/or log issues in our issue tracker on Github.  Or if you feel some documentation is missing, feel free to add it to our wiki on Github (or just tell us so we can add it). It’s the feedback that we get that also makes this project better and we always try to do something with it.

Another way is by forking the project on GitHub, add a feature or improve the code and apply a “pull request”. Then we can integrate those changes and put them in an official release.

“How do we know when a new version of GradleFx is released?”

You can follow me or Steven on twitter, this is where we announce all things related to GradleFx.
Yennick: @SlevinBE
Steven: @stevendick

Some useful links to get started:

Post to Twitter

Share your view

Post a comment

Who am I ?

I'm Michaël CHAIZE, Adobe Flash Platform Evangelist based in Paris. I'm a big fan of Rich Internet Applications and I promote the Flash Platform in the Enterprise world.
You can follow me on twitter:


Follow us on Facebook

© 2018 RIAgora. Powered by WordPress.

Daily Edition Theme by WooThemes - Premium WordPress Themes