rocking the gradle! - meetup gradle.pdf · packagename = 'org.gradle.sample.free' } paid...

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

Upload: others

Post on 23-Mar-2020

0 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Rocking the Gradle! - Meetup Gradle.pdf · packageName = 'org.gradle.sample.free' } paid } buildTypes { custom } } sourceSets { // Add an additional main source directory and resource

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

Page 2: Rocking the Gradle! - Meetup Gradle.pdf · packageName = 'org.gradle.sample.free' } paid } buildTypes { custom } } sourceSets { // Add an additional main source directory and resource

2

Why Gradle?Friday, April 12, 13

Page 3: Rocking the Gradle! - Meetup Gradle.pdf · packageName = 'org.gradle.sample.free' } paid } buildTypes { custom } } sourceSets { // Add an additional main source directory and resource

Declarative vs.Imperative

Friday, April 12, 13

Page 4: Rocking the Gradle! - Meetup Gradle.pdf · packageName = 'org.gradle.sample.free' } paid } buildTypes { custom } } sourceSets { // Add an additional main source directory and resource

DemoSource Sets

Friday, April 12, 13

Page 5: Rocking the Gradle! - Meetup Gradle.pdf · packageName = 'org.gradle.sample.free' } paid } buildTypes { custom } } sourceSets { // Add an additional main source directory and resource

Friday, April 12, 13

Page 6: Rocking the Gradle! - Meetup Gradle.pdf · packageName = 'org.gradle.sample.free' } paid } buildTypes { custom } } sourceSets { // Add an additional main source directory and resource

Declarative YES

Rigid NO

Friday, April 12, 13

Page 7: Rocking the Gradle! - Meetup Gradle.pdf · packageName = 'org.gradle.sample.free' } paid } buildTypes { custom } } sourceSets { // Add an additional main source directory and resource

Extensible Build Language

vs.

Build Framework

Friday, April 12, 13

Page 8: Rocking the Gradle! - Meetup Gradle.pdf · packageName = 'org.gradle.sample.free' } paid } buildTypes { custom } } sourceSets { // Add an additional main source directory and resource

Extensible Build Language

vs.

Build Framework

sourceSets

Friday, April 12, 13

Page 9: Rocking the Gradle! - Meetup Gradle.pdf · packageName = 'org.gradle.sample.free' } paid } buildTypes { custom } } sourceSets { // Add an additional main source directory and resource

Extensible Build Language

vs.

Build Framework

sourceSets

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

Friday, April 12, 13

Page 10: Rocking the Gradle! - Meetup Gradle.pdf · packageName = 'org.gradle.sample.free' } paid } buildTypes { custom } } sourceSets { // Add an additional main source directory and resource

Extensible Build Language

vs.

Build Framework

sourceSetsintegrationTest

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

Friday, April 12, 13

Page 11: Rocking the Gradle! - Meetup Gradle.pdf · packageName = 'org.gradle.sample.free' } paid } buildTypes { custom } } sourceSets { // Add an additional main source directory and resource

Friday, April 12, 13

Page 12: Rocking the Gradle! - Meetup Gradle.pdf · packageName = 'org.gradle.sample.free' } paid } buildTypes { custom } } sourceSets { // Add an additional main source directory and resource

Friday, April 12, 13

Page 13: Rocking the Gradle! - Meetup Gradle.pdf · packageName = 'org.gradle.sample.free' } paid } buildTypes { custom } } sourceSets { // Add an additional main source directory and resource

Friday, April 12, 13

Page 14: Rocking the Gradle! - Meetup Gradle.pdf · packageName = 'org.gradle.sample.free' } paid } buildTypes { custom } } sourceSets { // Add an additional main source directory and resource

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

Page 15: Rocking the Gradle! - Meetup Gradle.pdf · packageName = 'org.gradle.sample.free' } paid } buildTypes { custom } } sourceSets { // Add an additional main source directory and resource

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

Page 16: Rocking the Gradle! - Meetup Gradle.pdf · packageName = 'org.gradle.sample.free' } paid } buildTypes { custom } } sourceSets { // Add an additional main source directory and resource

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

Page 17: Rocking the Gradle! - Meetup Gradle.pdf · packageName = 'org.gradle.sample.free' } paid } buildTypes { custom } } sourceSets { // Add an additional main source directory and resource

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

Page 18: Rocking the Gradle! - Meetup Gradle.pdf · packageName = 'org.gradle.sample.free' } paid } buildTypes { custom } } sourceSets { // Add an additional main source directory and resource

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

Page 19: Rocking the Gradle! - Meetup Gradle.pdf · packageName = 'org.gradle.sample.free' } paid } buildTypes { custom } } sourceSets { // Add an additional main source directory and resource

Rich imperative Layer

Friday, April 12, 13

Page 20: Rocking the Gradle! - Meetup Gradle.pdf · packageName = 'org.gradle.sample.free' } paid } buildTypes { custom } } sourceSets { // Add an additional main source directory and resource

DemoIncremental Build

Friday, April 12, 13

Page 21: Rocking the Gradle! - Meetup Gradle.pdf · packageName = 'org.gradle.sample.free' } paid } buildTypes { custom } } sourceSets { // Add an additional main source directory and resource

Friday, April 12, 13

Page 22: Rocking the Gradle! - Meetup Gradle.pdf · packageName = 'org.gradle.sample.free' } paid } buildTypes { custom } } sourceSets { // Add an additional main source directory and resource

Multi Module Builds

Friday, April 12, 13

Page 23: Rocking the Gradle! - Meetup Gradle.pdf · packageName = 'org.gradle.sample.free' } paid } buildTypes { custom } } sourceSets { // Add an additional main source directory and resource

DemoMulti-Project Build

Friday, April 12, 13

Page 24: Rocking the Gradle! - Meetup Gradle.pdf · packageName = 'org.gradle.sample.free' } paid } buildTypes { custom } } sourceSets { // Add an additional main source directory and resource

Friday, April 12, 13

Page 25: Rocking the Gradle! - Meetup Gradle.pdf · packageName = 'org.gradle.sample.free' } paid } buildTypes { custom } } sourceSets { // Add an additional main source directory and resource

Build Masters Delight

Friday, April 12, 13

Page 26: Rocking the Gradle! - Meetup Gradle.pdf · packageName = 'org.gradle.sample.free' } paid } buildTypes { custom } } sourceSets { // Add an additional main source directory and resource

DemoGradle Wrapper

Friday, April 12, 13

Page 27: Rocking the Gradle! - Meetup Gradle.pdf · packageName = 'org.gradle.sample.free' } paid } buildTypes { custom } } sourceSets { // Add an additional main source directory and resource

Friday, April 12, 13

Page 28: Rocking the Gradle! - Meetup Gradle.pdf · packageName = 'org.gradle.sample.free' } paid } buildTypes { custom } } sourceSets { // Add an additional main source directory and resource

DemoInit Scripts

Friday, April 12, 13

Page 29: Rocking the Gradle! - Meetup Gradle.pdf · packageName = 'org.gradle.sample.free' } paid } buildTypes { custom } } sourceSets { // Add an additional main source directory and resource

Friday, April 12, 13

Page 30: Rocking the Gradle! - Meetup Gradle.pdf · packageName = 'org.gradle.sample.free' } paid } buildTypes { custom } } sourceSets { // Add an additional main source directory and resource

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

Page 31: Rocking the Gradle! - Meetup Gradle.pdf · packageName = 'org.gradle.sample.free' } paid } buildTypes { custom } } sourceSets { // Add an additional main source directory and resource

Integration

Friday, April 12, 13

Page 32: Rocking the Gradle! - Meetup Gradle.pdf · packageName = 'org.gradle.sample.free' } paid } buildTypes { custom } } sourceSets { // Add an additional main source directory and resource

Friday, April 12, 13

Page 33: Rocking the Gradle! - Meetup Gradle.pdf · packageName = 'org.gradle.sample.free' } paid } buildTypes { custom } } sourceSets { // Add an additional main source directory and resource

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

Page 34: Rocking the Gradle! - Meetup Gradle.pdf · packageName = 'org.gradle.sample.free' } paid } buildTypes { custom } } sourceSets { // Add an additional main source directory and resource

<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

Page 35: Rocking the Gradle! - Meetup Gradle.pdf · packageName = 'org.gradle.sample.free' } paid } buildTypes { custom } } sourceSets { // Add an additional main source directory and resource

Friday, April 12, 13

Page 36: Rocking the Gradle! - Meetup Gradle.pdf · packageName = 'org.gradle.sample.free' } paid } buildTypes { custom } } sourceSets { // Add an additional main source directory and resource

Migration

Friday, April 12, 13

Page 37: Rocking the Gradle! - Meetup Gradle.pdf · packageName = 'org.gradle.sample.free' } paid } buildTypes { custom } } sourceSets { // Add an additional main source directory and resource

Q & A

Background

Friday, April 12, 13

Page 38: Rocking the Gradle! - Meetup Gradle.pdf · packageName = 'org.gradle.sample.free' } paid } buildTypes { custom } } sourceSets { // Add an additional main source directory and resource

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