0
GradleFxFlex Build ToolBy Yennick Trevels & Steven Dick
Yennick TrevelsiDA MediaFoundryJava & Flex                   @SlevinBE                        Free Time                   ...
GradleAn introduction
FeaturesConvention over ConfigurationGradleMulti-project supportDependency ManagementGroovy scriptingSource file change de...
GradleExamplesubprojects {  apply plugin: gradlefx    version = 1.0-SNAPSHOT    repositories {      mavenCentral()      ma...
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 In...
GradleTasksBlock of code that defines part of a buildCreate a new tasktask(showText, dependsOn: ‘projectB:compile’) << ,  ...
GradleTasksAdding behaviourcompile.doLast {              println “Compilation complete"}Executing a task>gradle showText
GradleMethodsStructure build logictask(showText) << {              printList(*‘john’, ‘Alfred’, ‘Elise’+)}def printList(na...
GradleClassesDefined in         build script         rootProjectDir/buildSrc/src/main/         standalone project
GradleCustom task classclass CopyResources extends DefaultTask {    public CopyResources() {      description = copies the...
GradleConvention propertiesProperties exposed by pluginsSimple or complex propertiesHave a default value (convention)Can b...
GradleRepositoriesrepositories {    mavenCentral()    mavenLocal()    mavenRepo name: yoolab-releases, url: "http://projec...
GradleDependenciesLibraries/other projects used by a projectLibrary Dependencydependencies {             merged group: org...
GradleConfigurationsBundles a set of dependenciesVaries between pluginsmerged group: org.graniteds, name: granite-swc, ver...
GradleThree-phase buildInitialization                       ProjectInstance {Determines projects for build                ...
GradleThree-phase buildAfterEvaluateRuns after project is configuredproject.afterEvaluate {               project.descript...
GradleAnt supportAnt project importSupport for Ivy repositoriesRun Ant tasks with GradleExampleant.java(jar: project.flexH...
GradleMaven supportSupport for Maven repositoriesMaven plugin for Java based projects
GradleGradle wrapperRun Gradle without installing Gradlebatch/shell scriptHow?task wrapper(type: Wrapper) {              g...
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 configu...
GradleFxProject typeDefines to which type of archive the sources will be compiled toConvention property  typePossible val...
GradleFxBasic conventionssources  src/main/actionscript (srcDirs property)resources  src/main/resources (resourceDirs pr...
GradleFxSome advanced propertiesCompiler optionsadditionalCompilerOptions propertyOne item per compiler option            ...
GradleFxDependency managementConfigurationsMerged (-compiler.library-path)Internal (-compiler.include-libraries)External (...
GradleFxAIR project required stepsCreate AIR descriptor fileConvention             "/src/main/actionscript/$,project.name-...
GradleFxFlexUnit required stepsSpecify FlexUnit homeConvention             FLEXUNIT_HOME environment variableCustom value ...
GradleFxFlexUnit required stepsSpecify FlexUnit dependenciesdependencies {  test files( "${flexUnit.home}/flexunit-4.1.0-8...
GradleFxDEMO
GradleFxWhat’s to come?IDEA and Eclipse project generation supportAS3Doc generationFlex SDK maven artifact support?
GradleFxWhere to go nextGradleFx site: https://github.com/GradleFx/GradleFxSource: https://github.com/GradleFx/GradleFxDoc...
Upcoming SlideShare
Loading in...5
×

GradleFX

4,809

Published on

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

Published in: Technology
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
4,809
On Slideshare
0
From Embeds
0
Number of Embeds
4
Actions
Shares
0
Downloads
20
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Transcript of "GradleFX"

  1. 1. GradleFxFlex Build ToolBy Yennick Trevels & Steven Dick
  2. 2. Yennick TrevelsiDA MediaFoundryJava & Flex @SlevinBE Free Time Programming Reading Gaming
  3. 3. GradleAn introduction
  4. 4. FeaturesConvention over ConfigurationGradleMulti-project supportDependency ManagementGroovy scriptingSource file change detection
  5. 5. GradleExamplesubprojects { apply plugin: gradlefx version = 1.0-SNAPSHOT repositories { mavenCentral() mavenRepo name: yoolab-releases, url: "http://projects.yoolab.org/maven/content/repositories/releases" mavenRepo name: yoolab-snapshots, url: "http://projects.yoolab.org/maven/content/repositories/snapshots" } 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 }}
  6. 6. GradleProjectsOne or more projects per buildOne or more tasks per projectOne build.gradle file per project
  7. 7. GradleSubprojectsProject structureSettings file (settings.gradle) include client, domain, util, assets‘Configuration Injectionsubprojects { apply plugin: gradlefx version = 1.0-SNAPSHOT repositories { mavenCentral() }}
  8. 8. 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)}
  9. 9. GradleTasksAdding behaviourcompile.doLast { println “Compilation complete"}Executing a task>gradle showText
  10. 10. GradleMethodsStructure build logictask(showText) << { printList(*‘john’, ‘Alfred’, ‘Elise’+)}def printList(names) { names.each() { name -> println name }}
  11. 11. GradleClassesDefined in build script rootProjectDir/buildSrc/src/main/ standalone project
  12. 12. 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 logger.info(from + fromLocation + to + toLocation) project.copy { from fromLocation into toLocation } } }}
  13. 13. 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
  14. 14. GradleRepositoriesrepositories { mavenCentral() mavenLocal() mavenRepo name: yoolab-releases, url: "http://projects.yoolab.org/maven/content/repositories/releases" mavenRepo name: yoolab-snapshots, url: "http://projects.yoolab.org/maven/content/repositories/snapshots"}
  15. 15. GradleDependenciesLibraries/other projects used by a projectLibrary Dependencydependencies { merged group: org.graniteds, name: granite-swc, version: graniteds_version, ext: swc‘}Project Dependencymerged project(:projectname)
  16. 16. GradleConfigurationsBundles a set of dependenciesVaries between pluginsmerged group: org.graniteds, name: granite-swc, version: graniteds_version, ext: swc‘ ‘merged’ configuration
  17. 17. 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
  18. 18. GradleThree-phase buildAfterEvaluateRuns after project is configuredproject.afterEvaluate { project.description = project.name + “ is my sample project”}
  19. 19. GradleAnt supportAnt project importSupport for Ivy repositoriesRun Ant tasks with GradleExampleant.java(jar: project.flexHome + /lib/mxmlc.jar, dir: project.flexHome + /frameworks, fork: true, resultproperty: ‘antResultProperty’, outputproperty: ‘antOutputProperty’) , arg(value: ‘-keep-as3-metadata+=Autowired,RemoteClass’)}println ant.properties*‘antOutputProperty’+
  20. 20. GradleMaven supportSupport for Maven repositoriesMaven plugin for Java based projects
  21. 21. GradleGradle wrapperRun Gradle without installing Gradlebatch/shell scriptHow?task wrapper(type: Wrapper) { gradleVersion = ‘1.0’}simple/ gradlew gradlew.bat gradle/wrapper/ gradle-wrapper.jar gradle-wrapper.properties
  22. 22. GradleFxFlex builds just got easier!
  23. 23. FeaturesSWC, SWF & AIRGradleFxClean & copy resources tasksHtml wrapper generationFlexUnit support
  24. 24. GradleFxTaskscleancompilepackagecopyResourcespublishcreateHtmlWrappertest
  25. 25. 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
  26. 26. GradleFxProject typeDefines to which type of archive the sources will be compiled toConvention property  typePossible values  ‘swc’, ‘swf’ or ‘air’Exampletype = ‘swc’
  27. 27. 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)
  28. 28. 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]
  29. 29. 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
  30. 30. GradleFxAIR project required stepsCreate AIR descriptor fileConvention "/src/main/actionscript/$,project.name-.xml“Custom value air.applicationDescriptor: "/src/main/flex/airdescriptor.xml“CertificateNeeded to sign the AIR packagePKCS12 formatPassword requiredConvention "$,project.name-.p12“Custom value air.keystore: "certificate.p12“ air.storepass = "mypassword"
  31. 31. 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
  32. 32. 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-4.1.0.16076.swc", "${flexUnit.home}/flexunit-cilistener-4.1.0-8-4.1.0.16076.swc“)}Specify testRunner classtestClass = MyTestRunner.mxml
  33. 33. GradleFxDEMO
  34. 34. GradleFxWhat’s to come?IDEA and Eclipse project generation supportAS3Doc generationFlex SDK maven artifact support?
  35. 35. GradleFxWhere to go nextGradleFx site: https://github.com/GradleFx/GradleFxSource: https://github.com/GradleFx/GradleFxDocumentation: https://github.com/GradleFx/GradleFx/wikiExamples: https://github.com/GradleFx/GradleFx-ExamplesHelp & Support: http://gradlefx.tenderapp.com/homeBug tracker: https://github.com/GradleFx/GradleFx/issuesChangelog: https://github.com/GradleFx/GradleFx/blob/master/CHANGELOG.textile
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×