Upcoming SlideShare
Loading in...5




Belgian Flex Usergroup presentation by Yennick Trevels from the GradleFX team.

Belgian Flex Usergroup presentation by Yennick Trevels from the GradleFX team.



Total Views
Views on SlideShare
Embed Views



10 Embeds 2,440 2426 4 2 2 1 1 1 1 1 1



Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
Post Comment
Edit your comment

GradleFX GradleFX Presentation Transcript

  • GradleFxFlex Build ToolBy Yennick Trevels & Steven Dick
  • Yennick TrevelsiDA MediaFoundryJava & Flex @SlevinBE Free Time Programming Reading Gaming
  • GradleAn introduction
  • FeaturesConvention over ConfigurationGradleMulti-project supportDependency ManagementGroovy scriptingSource file change detection
  • GradleExamplesubprojects { apply plugin: gradlefx version = 1.0-SNAPSHOT repositories { mavenCentral() mavenRepo name: yoolab-releases, url: "" mavenRepo name: yoolab-snapshots, url: "" } dependencies { external group: org.springextensions.actionscript, name: spring-actionscript-core, version: 1.2-SNAPSHOT, ext: swc 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 external group: org.graniteds, name: granite-swc, version: 2.2.0.SP1, ext: swc external group: org.graniteds, name: granite-essentials-swc, version: ‘2.2.0.SP1, ext: swc }}
  • GradleProjectsOne or more projects per buildOne or more tasks per projectOne build.gradle file per project
  • GradleSubprojectsProject structureSettings file (settings.gradle) include client, domain, util, assets‘Configuration Injectionsubprojects { apply plugin: gradlefx version = 1.0-SNAPSHOT repositories { mavenCentral() }}
  • GradleTasksBlock of code that defines part of a buildCreate a new tasktask(showText, dependsOn: ‘projectB:compile’) << , println “I’m executing after the compile task"}Configure an existing Tasktask(copy, type: Copy) { from(file(srcDir)) into(buildDir)}
  • GradleTasksAdding behaviourcompile.doLast { println “Compilation complete"}Executing a task>gradle showText
  • GradleMethodsStructure build logictask(showText) << { printList(*‘john’, ‘Alfred’, ‘Elise’+)}def printList(names) { names.each() { name -> println name }}
  • GradleClassesDefined in build script rootProjectDir/buildSrc/src/main/ standalone project
  • GradleCustom task classclass CopyResources extends DefaultTask { public CopyResources() { description = copies the resources to the build directory } @TaskAction def copyResources() { project.resourceDirs.each { resourceDir -> def fromLocation = project.file(resourceDir).path def toLocation = project.buildDir.path + fromLocation + to + toLocation) project.copy { from fromLocation into toLocation } } }}
  • GradleConvention propertiesProperties exposed by pluginsSimple or complex propertiesHave a default value (convention)Can be overriddenExample:srcDirs = [src/main/flex]  convention = [‘src/main/actionscript’]htmlWrapper.title = ‘My html wrapper page title‘  default = project name
  • GradleRepositoriesrepositories { mavenCentral() mavenLocal() mavenRepo name: yoolab-releases, url: "" mavenRepo name: yoolab-snapshots, url: ""}
  • GradleDependenciesLibraries/other projects used by a projectLibrary Dependencydependencies { merged group: org.graniteds, name: granite-swc, version: graniteds_version, ext: swc‘}Project Dependencymerged project(:projectname)
  • GradleConfigurationsBundles a set of dependenciesVaries between pluginsmerged group: org.graniteds, name: granite-swc, version: graniteds_version, ext: swc‘ ‘merged’ configuration
  • GradleThree-phase buildInitialization ProjectInstance {Determines projects for build name;Project instance creation }Configuration phase ProjectInstance {Runs build script of every project name = “my project” ;Configures project objects }Execution phaseExecute the tasks
  • GradleThree-phase buildAfterEvaluateRuns after project is configuredproject.afterEvaluate { project.description = + “ is my sample project”}
  • GradleAnt supportAnt project importSupport for Ivy repositoriesRun Ant tasks with project.flexHome + /lib/mxmlc.jar, dir: project.flexHome + /frameworks, fork: true, resultproperty: ‘antResultProperty’, outputproperty: ‘antOutputProperty’) , arg(value: ‘-keep-as3-metadata+=Autowired,RemoteClass’)}println*‘antOutputProperty’+
  • GradleMaven supportSupport for Maven repositoriesMaven plugin for Java based projects
  • GradleGradle wrapperRun Gradle without installing Gradlebatch/shell scriptHow?task wrapper(type: Wrapper) { gradleVersion = ‘1.0’}simple/ gradlew gradlew.bat gradle/wrapper/ gradle-wrapper.jar
  • GradleFxFlex builds just got easier!
  • FeaturesSWC, SWF & AIRGradleFxClean & copy resources tasksHtml wrapper generationFlexUnit support
  • GradleFxTaskscleancompilepackagecopyResourcespublishcreateHtmlWrappertest
  • GradleFxSetupFlex SDKCreate FLEX_HOME environment variable  conventionORSet flexHome convention property  custom configurationApply Pluginbuildscript { repositories { mavenCentral() } dependencies { classpath group: org.gradlefx, name: gradlefx, version: 0.4.1 }}apply plugin: gradlefx
  • GradleFxProject typeDefines to which type of archive the sources will be compiled toConvention property  typePossible values  ‘swc’, ‘swf’ or ‘air’Exampletype = ‘swc’
  • GradleFxBasic conventionssources  src/main/actionscript (srcDirs property)resources  src/main/resources (resourceDirs property)test sources  src/test/actionscript (testDirs property)test resources  src/test/resources (testResourceDirs property)mxml main class  Main.mxml in src/main/actionscript/ (mainClass property)build directory  build (project.buildDir property)
  • GradleFxSome advanced propertiesCompiler optionsadditionalCompilerOptions propertyOne item per compiler option additionalCompilerOptions = [ -use-network=true, -locale=en_US, -keep-as3-metadata+=Autowired,RemoteClass‘ ]JVM optionsjvmArguments property jvmArguments = [-Xmx1024m,-Xms512m]
  • GradleFxDependency managementConfigurationsMerged (-compiler.library-path)Internal (-compiler.include-libraries)External (-compiler.external-library-path)Rsl (-runtime-shared-library-path)TestExampleexternal group: org.as3commons, name: as3commons-eventbus, version: 1.1, ext: swcmerged group: org.graniteds, name: granite-swc, version: 2.2.0.SP1, ext: swc
  • GradleFxAIR project required stepsCreate AIR descriptor fileConvention "/src/main/actionscript/$,“Custom value air.applicationDescriptor: "/src/main/flex/airdescriptor.xml“CertificateNeeded to sign the AIR packagePKCS12 formatPassword requiredConvention "$,“Custom value air.keystore: "certificate.p12“ air.storepass = "mypassword"
  • GradleFxFlexUnit required stepsSpecify FlexUnit homeConvention FLEXUNIT_HOME environment variableCustom value flexUnit.home = c:/flexunit/4.1Specify Flash Player executableConvention FLASH_PLAYER_EXE environment variableCustom value flexunit.command = ‘c:/flashplayer/flashplayer_10.exe’Specify FlexUnit ant task jar nameLocated in FlexUnit home directoryCustom value flexUnit.antTasksJar = flexUnitTasks-4.1.0-8.jar
  • GradleFxFlexUnit required stepsSpecify FlexUnit dependenciesdependencies { test files( "${flexUnit.home}/flexunit-4.1.0-8-flex_4.1.0.16076.swc", "${flexUnit.home}/flexunit-uilistener-4.1.0-8-", "${flexUnit.home}/flexunit-cilistener-4.1.0-8-“)}Specify testRunner classtestClass = MyTestRunner.mxml
  • GradleFxDEMO
  • GradleFxWhat’s to come?IDEA and Eclipse project generation supportAS3Doc generationFlex SDK maven artifact support?
  • GradleFxWhere to go nextGradleFx site: & Support: tracker: