Rocking the Gradle! -...

38
Peter Walker COO, Gradleware Inc. EMail: [email protected] LinkedIn : http://www.linkedin.com/in/peterbwalker Twitter: @petebryanwalker Summit: June 13th-14th, Santa Clara, CA www.gradlesummit.com Rocking the Gradle! Friday, April 12, 13

Transcript of Rocking the Gradle! -...

Peter WalkerCOO, Gradleware Inc.EMail: [email protected] : http://www.linkedin.com/in/peterbwalkerTwitter: @petebryanwalkerSummit: June 13th-14th, Santa Clara, CA www.gradlesummit.com

Rocking the Gradle!

Friday, April 12, 13

2

Why Gradle?Friday, April 12, 13

Declarative vs.Imperative

Friday, April 12, 13

DemoSource Sets

Friday, April 12, 13

Friday, April 12, 13

Declarative YES

Rigid NO

Friday, April 12, 13

Extensible Build Language

vs.

Build Framework

Friday, April 12, 13

Extensible Build Language

vs.

Build Framework

sourceSets

Friday, April 12, 13

Extensible Build Language

vs.

Build Framework

sourceSets

apply plugin: ‘java’apply from: ‘integration-test’

Friday, April 12, 13

Extensible Build Language

vs.

Build Framework

sourceSetsintegrationTest

apply plugin: ‘java’apply from: ‘integration-test’

Friday, April 12, 13

Friday, April 12, 13

Friday, April 12, 13

Friday, April 12, 13

products 'webserver', 'permissionkeybuilder', 'sitebuilder', 'logicbuilder', 'viwebuilder', 'virtualbacview', 'wapbuilder', 'testnbalance' dependencies { compile project(':common') compile project(':comm') } doc { summary '''TBD.''' } modules 'testnbalance' requiresLicense false launcher { mainClass 'com.controlj.green.testbalance.userinterface.Application' useJavawOnWindows true forceClientVM true }

Friday, April 12, 13

apply plugin: 'android' version='1.0' android { target 'android-16' productFlavors { free { packageName = 'org.gradle.sample.free' } paid } buildTypes { custom } } sourceSets { // Add an additional main source directory and resource directory main.java.srcDir 'some-dir' main.resources.srcDir 'some-resources' // A source set for each product flavor and build type is also available for configuration free.java.srcDir 'some-free-dir' }

Friday, April 12, 13

apply plugin: 'android' version='1.0' android { target 'android-16' productFlavors { free { packageName = 'org.gradle.sample.free' } paid } buildTypes { custom } } sourceSets { // Add an additional main source directory and resource directory main.java.srcDir 'some-dir' main.resources.srcDir 'some-resources' // A source set for each product flavor and build type is also available for configuration free.java.srcDir 'some-free-dir' }

Not my dad’s Java project

Friday, April 12, 13

apply plugin: 'android' version='1.0' android { target 'android-16' productFlavors { free { packageName = 'org.gradle.sample.free' } paid } buildTypes { custom } } sourceSets { // Add an additional main source directory and resource directory main.java.srcDir 'some-dir' main.resources.srcDir 'some-resources' // A source set for each product flavor and build type is also available for configuration free.java.srcDir 'some-free-dir' }

Not my dad’s Java project

// queryable

Friday, April 12, 13

apply plugin: 'android' version='1.0' android { target 'android-16' productFlavors { free { packageName = 'org.gradle.sample.free' } paid } buildTypes { custom } } sourceSets { // Add an additional main source directory and resource directory main.java.srcDir 'some-dir' main.resources.srcDir 'some-resources' // A source set for each product flavor and build type is also available for configuration free.java.srcDir 'some-free-dir' }

// deeply integrated

Not my dad’s Java project

// queryable

Friday, April 12, 13

Rich imperative Layer

Friday, April 12, 13

DemoIncremental Build

Friday, April 12, 13

Friday, April 12, 13

Multi Module Builds

Friday, April 12, 13

DemoMulti-Project Build

Friday, April 12, 13

Friday, April 12, 13

Build Masters Delight

Friday, April 12, 13

DemoGradle Wrapper

Friday, April 12, 13

Friday, April 12, 13

DemoInit Scripts

Friday, April 12, 13

Friday, April 12, 13

org.gradle.daemon=true org.gradle.java.home=/Library/Java/JavaVirtualMachines/1.7.0.jdk/Contents/Home org.gradle.jvmargs=-Xmx512M

Build Environment

Project specific gradle.properties

Friday, April 12, 13

Integration

Friday, April 12, 13

Friday, April 12, 13

ant.delete dir: 'someDir' ant { ftp(server: "ftp.comp.org", userid: 'me', ...) { fileset(dir: "htdocs/manual") { include name: "**/*.html" } // high end myFileTree.addToAntBuilder(ant, 'fileset') } mkdir dir: 'someDir' }

Ant Tasks

‣ Gradle provides an instance of the Groovy AntBuilder

Friday, April 12, 13

<project>  <target name="hello" depends="intro"> <echo>Hello, from Ant</echo>  </target> </project>

Importing Ant Builds

ant.importBuild 'build.xml' hello.doFirst { println 'Here comes Ant' } task intro << { println 'Hello, from Gradle'}

>gradle helloHello, from GradleHere comes Ant[ant:echo] Hello, from Ant

Friday, April 12, 13

Friday, April 12, 13

Migration

Friday, April 12, 13

Q & A

Background

Friday, April 12, 13

Peter WalkerCOO, Gradleware Inc.EMail: [email protected] : http://www.linkedin.com/in/peterbwalkerTwitter: @petebryanwalkerSummit: June 13th-14th, Santa Clara, CA www.gradlesummit.com

Friday, April 12, 13