SlideShare a Scribd company logo
Why Gradle?
Peter Ledbrook
e: peter@cacoethes.co.uk
w: http://www.cacoethes.co.uk
t: @pledbrook
When did it all begin?
• Programmable
machines have a long
history
• Mechanised
instruments
• Looms
Late 18th/early 19th centuries
Punched
cards
First used for looms in 18th Century France - Jacquard Loom 1801
IBM introduced punched card format 1928 - 80 columns!
Text mode column width for DOS, Unix etc.
Imagine creating by hand
Keypunch machines (a little like typewriters) for creating them
Errors mean throwing away the card and doing it again
Fortran and Cobol started with punched cards
Fixing card decks
What if your cards are dropped on the floor?
This is an IBM 082 Sorter
Automation of a very error-prone manual process
Magnetism saves the day!
Finally, R/W data and code. The dawn of text editors.
C/C++
Multi-platform
builds!
Compiler
Linker
Source
.so/.dll & .exe
Make
*.c: *.o
cc …
myapp: app.o mylib.o …
ld …
+ manual custom dependencies
Focus mainly on compilation and linking
Make has powerful model based on file dependencies
Maintenance was a lot of work
Make
*.c: *.o
cc …
myapp: app.o mylib.o …
ld …
What’s this?
+ manual custom dependencies
Tabs were the bane of Make file writers
Java
• Compiler handles .java to .class
dependencies
• JAR as ‘module’ unit
• Several standard deployment types
- Applet
- WAR
- Standalone app
Publish == prod server, installer, JAR, zip package, etc.
A standard build
Compile Test Package Publish?
A simplification from the days of C
Interesting point: does the packaging actually require the tests to run?
What will builds look like in 5
years time?
Our builds last a long time
You want a tool that can grow and adapt
One that handles all sorts of build processes
Even Java builds are evolving
Model as a graph
Step
Step Step
Step
Step
All build processes can be modeled as a Directed Acyclic Graph (DAG) of steps
This is the Gradle model (a task == a step)
But we don’t want to set up all
those steps!
Gradle Conventions
apply	 plugin:	 "java"

group	 =	 "org.example"

version	 =	 "0.7.1"

sourceCompatibility	 =	 "1.7"

targetCompatibility	 =	 "1.7"

Java build conventions
provided by plugin
Gradle Conventions
• compileJava (src/main/java)
• compileTestJava (src/test/java)
• test (added as dependency of check)
- test reports in build/reports/test
• jar (added as dependency of assemble)
- created in build/libs
• javadoc
Not all builds are the same
Java build evolved
Compile Test Package Publish?
Dev setup Run
QA
SCM Tags
Deployment
Docs
Generators
JS + CSS
Builds are incorporating more and more steps
Android is an example of a quite different Java build
Custom build
publishPdf
publishGuide
apiDocs
fetchGrailsSource
grails-doc
project
expensive,
so optional
build
A build to generate the Grails user guide
Automation of all steps
No standard tasks
Task graph is a suitable model
Mixed build
C/C++
DLL/SO
Java
Debian packages
Executable
Build barrier
Build barrier
I’ve worked with or know of several projects that have native + Java parts
Each transfer between different build systems is like a baton handover - with the potential for the baton to be dropped.
The build tool should not
dictate the build process
Goals of a build
What do we want out of our build processes?
Automation
People are fallible
Muscle memory can help
e.g. tying shoe laces
Not usually applicable in software development
Automation
• Humans are fallible
• Every manual step adds to the fragility of
the build
• Muscle memory can help, but rarely
applicable
People are fallible
Muscle memory can help
e.g. tying shoe laces
Not usually applicable in software development
Mistakes == Lost time
(and possibly money)
Errors made deploying to beta.grails.org and grails.org
Long path between updating source code and starting the server with changes
Stress and downtime
Does your build have manual
steps? If so, why?
For example, copying files around, entering parameter values, running external scripts, etc.
Custom tasks in Gradle
task	 publishGuide	 <<	 {

	 	 	 	 //	 Generate	 HTML	 from	 .gdoc

}

build.dependsOn	 publishGuide
buildSrc/src/groovy/pkg/PublishGuideTask.groovy
pkg.PublishGuideTask in a JAR
Don’t reinvent the wheel
http://plugins.gradle.org/
Gradle Plugin Portal
This is searchable
Contains many (but not all) publicly available plugins
You can publish your own too
Repeatability
Same inputs should result in
same outputs
In other words, repeatable builds
Environment should not be a factor
Does the build behave differently on different platforms?
Consider “works for me” with local Maven cache
Depends on tasks
• Are tasks environment-dependent?
• Do system properties or environment
variables have an effect?
• What about number of cores?
• Order of tests?
Gradle can’t help much with this - except for task ordering
Task ordering
• mustRunAfter/shouldRunAfter
• No task dependencies
task	 integTest	 {

	 	 	 	 ...

}

task	 packageReports	 {

	 	 	 	 mustRunAfter	 integTest

	 	 	 	 ...

}

`packageReports` does not depend on `integTest`
But if both are executed, `packageReports` must come after `integTest`
shouldRunAfter is less strict - mostly to optimise feedback
Task ordering
• finalizedBy
• Ensures execution of the finalizer task
task	 integTest	 {

	 	 	 	 finalizedBy	 packageReports

	 	 	 	 ...

}

task	 packageReports	 {

	 	 	 	 ...

}

`packageReports` does not depend on `integTest`
If `integTest` runs, then `packageReports` will run too, always after `integTest`
Gradle cache
• Origin checks
• Artifact checksums
• Concurrency safe
• Avoid mavenLocal()!
Dependency cache can be a big impediment to repeatability
Resolution strategy
configurations.all	 {

	 	 resolutionStrategy	 {

	 	 	 	 failOnVersionConflict()

	 	 	 	 force	 'asm:asm-all:3.3.1',

	 	 	 	 	 	 	 	 	 	 'commons-io:commons-io:1.4'

}
Override version to use
for specific dependencies
Fail the build if any
version conflicts
Defaults to ‘newest’ strategy
Fine-grained control over dependency versions
Automatic conflict resolution error-prone
Resolution strategy
configurations.all	 {

	 	 eachDependency	 {	 details	 ->

	 	 	 	 if	 (details.requested.name	 ==	 'groovy-all')	 {

	 	 	 	 	 	 details.useTarget(

	 	 	 	 	 	 	 	 	 	 group:	 details.requested.group,

	 	 	 	 	 	 	 	 	 	 name:	 'groovy',

	 	 	 	 	 	 	 	 	 	 version:	 details.requested.version)

	 	 	 	 }

	 	 }

}
Control modules with
different names, same classes
A painful problem to debug
Efficiency
Some tasks take significant amounts of time to execute
Why run them each time?
Think Ant/Maven incremental compilation
Incremental build
:lazybones-app:compileJava

:lazybones-app:compileGroovy	 UP-TO-DATE

:lazybones-app:processResources	 UP-TO-DATE

:lazybones-app:classes	 UP-TO-DATE

:lazybones-app:jar	 UP-TO-DATE

:lazybones-app:startScripts	 UP-TO-DATE

:lazybones-app:installApp	 UP-TO-DATE

BUILD	 SUCCESSFUL

Total	 time:	 2.178	 secs
UP-TO-DATE
Don’t execute tasks you don’t have to
Task inputs & outputs
class	 BintrayGenericUpload	 extends	 DefaultTask	 {

	 	 	 	 @InputFile	 File	 artifactFile

	 	 	 	 @Input	 	 	 	 	 String	 artifactUrlPath

	 	 	 	 @Optional

	 	 	 	 @Input	 	 	 	 	 String	 repositoryUrl

	 	 	 	 …⋯

}
Use of annotations makes task support incremental build
Inputs and outputs can be values, files, directories
A build should be…
Automated
Repeatable
Efficient
On top of this, Gradle gives you
• a rich API for modelling your build process
• full dependency management
• Java ecosystem integration
- IDEs, CI, static analysis tools, etc.
• Flexible publishing (Maven, Ivy,AWS S3)
• Many useful plugins to save you work
Summary
• End-to-end process is the build
• 80-20 rule (80% standard 20% custom)
• Automate everything == save time
• Invest in build as if it’s part of your code
base
• Building software requires a rich model
Thank you!
e: peter@cacoethes.co.uk
w: http://www.cacoethes.co.uk
t: @pledbrook

More Related Content

What's hot

Building with Gradle
Building with GradleBuilding with Gradle
Building with Gradle
Kaunas Java User Group
 
Gradle in 45min
Gradle in 45minGradle in 45min
Gradle in 45min
Schalk Cronjé
 
Learn react-js
Learn react-jsLearn react-js
An Introduction to Gradle for Java Developers
An Introduction to Gradle for Java DevelopersAn Introduction to Gradle for Java Developers
An Introduction to Gradle for Java Developers
Kostas Saidis
 
Exploring the power of Gradle in android studio - Basics & Beyond
Exploring the power of Gradle in android studio - Basics & BeyondExploring the power of Gradle in android studio - Basics & Beyond
Exploring the power of Gradle in android studio - Basics & Beyond
Kaushal Dhruw
 
Efficient JavaScript Unit Testing, May 2012
Efficient JavaScript Unit Testing, May 2012Efficient JavaScript Unit Testing, May 2012
Efficient JavaScript Unit Testing, May 2012
Hazem Saleh
 
Introduction of React.js
Introduction of React.jsIntroduction of React.js
Introduction of React.js
Jyaasa Technologies
 
Managing big test environment and running tests with Jenkins, Jenkins Job bui...
Managing big test environment and running tests with Jenkins, Jenkins Job bui...Managing big test environment and running tests with Jenkins, Jenkins Job bui...
Managing big test environment and running tests with Jenkins, Jenkins Job bui...
Timofey Turenko
 
Cool JVM Tools to Help You Test
Cool JVM Tools to Help You TestCool JVM Tools to Help You Test
Cool JVM Tools to Help You Test
Schalk Cronjé
 
Modularizing your Grails Application with Private Plugins - SpringOne 2GX 2012
Modularizing your Grails Application with Private Plugins - SpringOne 2GX 2012Modularizing your Grails Application with Private Plugins - SpringOne 2GX 2012
Modularizing your Grails Application with Private Plugins - SpringOne 2GX 2012kennethaliu
 
Gradle - time for a new build
Gradle - time for a new buildGradle - time for a new build
Gradle - time for a new buildIgor Khotin
 
Gradle
GradleGradle
Continuous Integration using Cruise Control
Continuous Integration using Cruise ControlContinuous Integration using Cruise Control
Continuous Integration using Cruise Controlelliando dias
 
Idiomatic gradle plugin writing
Idiomatic gradle plugin writingIdiomatic gradle plugin writing
Idiomatic gradle plugin writing
Schalk Cronjé
 
Gradle in 45min - JBCN2-16 version
Gradle in 45min - JBCN2-16 versionGradle in 45min - JBCN2-16 version
Gradle in 45min - JBCN2-16 version
Schalk Cronjé
 
Workshop React.js
Workshop React.jsWorkshop React.js
Workshop React.js
Commit University
 
Gradle build tool that rocks with DSL JavaOne India 4th May 2012
Gradle build tool that rocks with DSL JavaOne India 4th May 2012Gradle build tool that rocks with DSL JavaOne India 4th May 2012
Gradle build tool that rocks with DSL JavaOne India 4th May 2012
Rajmahendra Hegde
 
Dsc Charusat Learning React Part 1
Dsc Charusat Learning React Part 1 Dsc Charusat Learning React Part 1
Dsc Charusat Learning React Part 1
JainamMehta19
 
Introducing Playwright's New Test Runner
Introducing Playwright's New Test RunnerIntroducing Playwright's New Test Runner
Introducing Playwright's New Test Runner
Applitools
 

What's hot (19)

Building with Gradle
Building with GradleBuilding with Gradle
Building with Gradle
 
Gradle in 45min
Gradle in 45minGradle in 45min
Gradle in 45min
 
Learn react-js
Learn react-jsLearn react-js
Learn react-js
 
An Introduction to Gradle for Java Developers
An Introduction to Gradle for Java DevelopersAn Introduction to Gradle for Java Developers
An Introduction to Gradle for Java Developers
 
Exploring the power of Gradle in android studio - Basics & Beyond
Exploring the power of Gradle in android studio - Basics & BeyondExploring the power of Gradle in android studio - Basics & Beyond
Exploring the power of Gradle in android studio - Basics & Beyond
 
Efficient JavaScript Unit Testing, May 2012
Efficient JavaScript Unit Testing, May 2012Efficient JavaScript Unit Testing, May 2012
Efficient JavaScript Unit Testing, May 2012
 
Introduction of React.js
Introduction of React.jsIntroduction of React.js
Introduction of React.js
 
Managing big test environment and running tests with Jenkins, Jenkins Job bui...
Managing big test environment and running tests with Jenkins, Jenkins Job bui...Managing big test environment and running tests with Jenkins, Jenkins Job bui...
Managing big test environment and running tests with Jenkins, Jenkins Job bui...
 
Cool JVM Tools to Help You Test
Cool JVM Tools to Help You TestCool JVM Tools to Help You Test
Cool JVM Tools to Help You Test
 
Modularizing your Grails Application with Private Plugins - SpringOne 2GX 2012
Modularizing your Grails Application with Private Plugins - SpringOne 2GX 2012Modularizing your Grails Application with Private Plugins - SpringOne 2GX 2012
Modularizing your Grails Application with Private Plugins - SpringOne 2GX 2012
 
Gradle - time for a new build
Gradle - time for a new buildGradle - time for a new build
Gradle - time for a new build
 
Gradle
GradleGradle
Gradle
 
Continuous Integration using Cruise Control
Continuous Integration using Cruise ControlContinuous Integration using Cruise Control
Continuous Integration using Cruise Control
 
Idiomatic gradle plugin writing
Idiomatic gradle plugin writingIdiomatic gradle plugin writing
Idiomatic gradle plugin writing
 
Gradle in 45min - JBCN2-16 version
Gradle in 45min - JBCN2-16 versionGradle in 45min - JBCN2-16 version
Gradle in 45min - JBCN2-16 version
 
Workshop React.js
Workshop React.jsWorkshop React.js
Workshop React.js
 
Gradle build tool that rocks with DSL JavaOne India 4th May 2012
Gradle build tool that rocks with DSL JavaOne India 4th May 2012Gradle build tool that rocks with DSL JavaOne India 4th May 2012
Gradle build tool that rocks with DSL JavaOne India 4th May 2012
 
Dsc Charusat Learning React Part 1
Dsc Charusat Learning React Part 1 Dsc Charusat Learning React Part 1
Dsc Charusat Learning React Part 1
 
Introducing Playwright's New Test Runner
Introducing Playwright's New Test RunnerIntroducing Playwright's New Test Runner
Introducing Playwright's New Test Runner
 

Similar to Why Gradle?

Why your build matters
Why your build mattersWhy your build matters
Why your build matters
Peter Ledbrook
 
SF JUG - GWT Can Help You Create Amazing Apps - 2009-10-13
SF JUG - GWT Can Help You Create Amazing Apps - 2009-10-13SF JUG - GWT Can Help You Create Amazing Apps - 2009-10-13
SF JUG - GWT Can Help You Create Amazing Apps - 2009-10-13Fred Sauer
 
Gr8conf EU 2013 Speed up your development: GroovyServ and Grails Improx Plugin
Gr8conf EU 2013 Speed up your development: GroovyServ and Grails Improx PluginGr8conf EU 2013 Speed up your development: GroovyServ and Grails Improx Plugin
Gr8conf EU 2013 Speed up your development: GroovyServ and Grails Improx PluginYasuharu Nakano
 
Keeping your build tool updated in a multi repository world
Keeping your build tool updated in a multi repository worldKeeping your build tool updated in a multi repository world
Keeping your build tool updated in a multi repository world
Roberto Pérez Alcolea
 
Enter the gradle
Enter the gradleEnter the gradle
Enter the gradle
Parameswari Ettiappan
 
Faster Java EE Builds with Gradle
Faster Java EE Builds with GradleFaster Java EE Builds with Gradle
Faster Java EE Builds with Gradle
Ryan Cuprak
 
Faster Java EE Builds with Gradle
Faster Java EE Builds with GradleFaster Java EE Builds with Gradle
Faster Java EE Builds with Gradle
Ryan Cuprak
 
OpenDaylight Developer Experience 2.0
 OpenDaylight Developer Experience 2.0 OpenDaylight Developer Experience 2.0
OpenDaylight Developer Experience 2.0
Michael Vorburger
 
Moving from Jenkins 1 to 2 declarative pipeline adventures
Moving from Jenkins 1 to 2 declarative pipeline adventuresMoving from Jenkins 1 to 2 declarative pipeline adventures
Moving from Jenkins 1 to 2 declarative pipeline adventures
Frits Van Der Holst
 
7 maven vsgradle
7 maven vsgradle7 maven vsgradle
7 maven vsgradle
Avitesh Kesharwani
 
Life of a Chromium Developer
Life of a Chromium DeveloperLife of a Chromium Developer
Life of a Chromium Developermpaproductions
 
Eclipse Buildship JUG Hamburg
Eclipse Buildship JUG HamburgEclipse Buildship JUG Hamburg
Eclipse Buildship JUG Hamburg
simonscholz
 
Gitlab and Lingvokot
Gitlab and LingvokotGitlab and Lingvokot
Gitlab and Lingvokot
Lingvokot
 
Adventures in docker compose
Adventures in docker composeAdventures in docker compose
Adventures in docker compose
LinkMe Srl
 
Stopping the Rot - Putting Legacy C++ Under Test
Stopping the Rot - Putting Legacy C++ Under TestStopping the Rot - Putting Legacy C++ Under Test
Stopping the Rot - Putting Legacy C++ Under Test
Seb Rose
 
Grails beginners workshop
Grails beginners workshopGrails beginners workshop
Grails beginners workshop
JacobAae
 
Faster java ee builds with gradle [con4921]
Faster java ee builds with gradle [con4921]Faster java ee builds with gradle [con4921]
Faster java ee builds with gradle [con4921]
Ryan Cuprak
 
Hands on the Gradle
Hands on the GradleHands on the Gradle
Hands on the Gradle
Matthias Käppler
 
Flutter vs Java Graphical User Interface Frameworks - text
Flutter vs Java Graphical User Interface Frameworks - textFlutter vs Java Graphical User Interface Frameworks - text
Flutter vs Java Graphical User Interface Frameworks - text
Toma Velev
 
AOT and Native with Spring Boot 3.0
AOT and Native with Spring Boot 3.0AOT and Native with Spring Boot 3.0
AOT and Native with Spring Boot 3.0
MoritzHalbritter
 

Similar to Why Gradle? (20)

Why your build matters
Why your build mattersWhy your build matters
Why your build matters
 
SF JUG - GWT Can Help You Create Amazing Apps - 2009-10-13
SF JUG - GWT Can Help You Create Amazing Apps - 2009-10-13SF JUG - GWT Can Help You Create Amazing Apps - 2009-10-13
SF JUG - GWT Can Help You Create Amazing Apps - 2009-10-13
 
Gr8conf EU 2013 Speed up your development: GroovyServ and Grails Improx Plugin
Gr8conf EU 2013 Speed up your development: GroovyServ and Grails Improx PluginGr8conf EU 2013 Speed up your development: GroovyServ and Grails Improx Plugin
Gr8conf EU 2013 Speed up your development: GroovyServ and Grails Improx Plugin
 
Keeping your build tool updated in a multi repository world
Keeping your build tool updated in a multi repository worldKeeping your build tool updated in a multi repository world
Keeping your build tool updated in a multi repository world
 
Enter the gradle
Enter the gradleEnter the gradle
Enter the gradle
 
Faster Java EE Builds with Gradle
Faster Java EE Builds with GradleFaster Java EE Builds with Gradle
Faster Java EE Builds with Gradle
 
Faster Java EE Builds with Gradle
Faster Java EE Builds with GradleFaster Java EE Builds with Gradle
Faster Java EE Builds with Gradle
 
OpenDaylight Developer Experience 2.0
 OpenDaylight Developer Experience 2.0 OpenDaylight Developer Experience 2.0
OpenDaylight Developer Experience 2.0
 
Moving from Jenkins 1 to 2 declarative pipeline adventures
Moving from Jenkins 1 to 2 declarative pipeline adventuresMoving from Jenkins 1 to 2 declarative pipeline adventures
Moving from Jenkins 1 to 2 declarative pipeline adventures
 
7 maven vsgradle
7 maven vsgradle7 maven vsgradle
7 maven vsgradle
 
Life of a Chromium Developer
Life of a Chromium DeveloperLife of a Chromium Developer
Life of a Chromium Developer
 
Eclipse Buildship JUG Hamburg
Eclipse Buildship JUG HamburgEclipse Buildship JUG Hamburg
Eclipse Buildship JUG Hamburg
 
Gitlab and Lingvokot
Gitlab and LingvokotGitlab and Lingvokot
Gitlab and Lingvokot
 
Adventures in docker compose
Adventures in docker composeAdventures in docker compose
Adventures in docker compose
 
Stopping the Rot - Putting Legacy C++ Under Test
Stopping the Rot - Putting Legacy C++ Under TestStopping the Rot - Putting Legacy C++ Under Test
Stopping the Rot - Putting Legacy C++ Under Test
 
Grails beginners workshop
Grails beginners workshopGrails beginners workshop
Grails beginners workshop
 
Faster java ee builds with gradle [con4921]
Faster java ee builds with gradle [con4921]Faster java ee builds with gradle [con4921]
Faster java ee builds with gradle [con4921]
 
Hands on the Gradle
Hands on the GradleHands on the Gradle
Hands on the Gradle
 
Flutter vs Java Graphical User Interface Frameworks - text
Flutter vs Java Graphical User Interface Frameworks - textFlutter vs Java Graphical User Interface Frameworks - text
Flutter vs Java Graphical User Interface Frameworks - text
 
AOT and Native with Spring Boot 3.0
AOT and Native with Spring Boot 3.0AOT and Native with Spring Boot 3.0
AOT and Native with Spring Boot 3.0
 

More from Peter Ledbrook

Groovy for Java Developers
Groovy for Java DevelopersGroovy for Java Developers
Groovy for Java Developers
Peter Ledbrook
 
Application Architectures in Grails
Application Architectures in GrailsApplication Architectures in Grails
Application Architectures in Grails
Peter Ledbrook
 
Open source-and-you-gr8conf-us-2013
Open source-and-you-gr8conf-us-2013Open source-and-you-gr8conf-us-2013
Open source-and-you-gr8conf-us-2013Peter Ledbrook
 
Groovy & Grails for Spring/Java developers
Groovy & Grails for Spring/Java developersGroovy & Grails for Spring/Java developers
Groovy & Grails for Spring/Java developers
Peter Ledbrook
 
Grails & the World of Tomorrow
Grails & the World of TomorrowGrails & the World of Tomorrow
Grails & the World of Tomorrow
Peter Ledbrook
 
Migrating to Cloud Foundry
Migrating to Cloud FoundryMigrating to Cloud Foundry
Migrating to Cloud Foundry
Peter Ledbrook
 
Grails 2.0 Update
Grails 2.0 UpdateGrails 2.0 Update
Grails 2.0 Update
Peter Ledbrook
 
Grails and the World of Tomorrow
Grails and the World of TomorrowGrails and the World of Tomorrow
Grails and the World of Tomorrow
Peter Ledbrook
 
Cloud Foundry for Java devs
Cloud Foundry for Java devsCloud Foundry for Java devs
Cloud Foundry for Java devs
Peter Ledbrook
 

More from Peter Ledbrook (9)

Groovy for Java Developers
Groovy for Java DevelopersGroovy for Java Developers
Groovy for Java Developers
 
Application Architectures in Grails
Application Architectures in GrailsApplication Architectures in Grails
Application Architectures in Grails
 
Open source-and-you-gr8conf-us-2013
Open source-and-you-gr8conf-us-2013Open source-and-you-gr8conf-us-2013
Open source-and-you-gr8conf-us-2013
 
Groovy & Grails for Spring/Java developers
Groovy & Grails for Spring/Java developersGroovy & Grails for Spring/Java developers
Groovy & Grails for Spring/Java developers
 
Grails & the World of Tomorrow
Grails & the World of TomorrowGrails & the World of Tomorrow
Grails & the World of Tomorrow
 
Migrating to Cloud Foundry
Migrating to Cloud FoundryMigrating to Cloud Foundry
Migrating to Cloud Foundry
 
Grails 2.0 Update
Grails 2.0 UpdateGrails 2.0 Update
Grails 2.0 Update
 
Grails and the World of Tomorrow
Grails and the World of TomorrowGrails and the World of Tomorrow
Grails and the World of Tomorrow
 
Cloud Foundry for Java devs
Cloud Foundry for Java devsCloud Foundry for Java devs
Cloud Foundry for Java devs
 

Recently uploaded

Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Product School
 
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
Product School
 
Elevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object CalisthenicsElevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object Calisthenics
Dorra BARTAGUIZ
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
DianaGray10
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
DanBrown980551
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
Cheryl Hung
 
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Jeffrey Haguewood
 
Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
ThousandEyes
 
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
Product School
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
James Anderson
 
Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*
Frank van Harmelen
 
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualitySoftware Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Inflectra
 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
Prayukth K V
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
Ana-Maria Mihalceanu
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
Thijs Feryn
 
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
Product School
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
91mobiles
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
KatiaHIMEUR1
 

Recently uploaded (20)

Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
 
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
 
Elevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object CalisthenicsElevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object Calisthenics
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
 
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
 
Assuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyesAssuring Contact Center Experiences for Your Customers With ThousandEyes
Assuring Contact Center Experiences for Your Customers With ThousandEyes
 
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
 
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...
 
Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*
 
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualitySoftware Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
 
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 previewState of ICS and IoT Cyber Threat Landscape Report 2024 preview
State of ICS and IoT Cyber Threat Landscape Report 2024 preview
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
 
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
 

Why Gradle?

  • 1. Why Gradle? Peter Ledbrook e: peter@cacoethes.co.uk w: http://www.cacoethes.co.uk t: @pledbrook
  • 2. When did it all begin? • Programmable machines have a long history • Mechanised instruments • Looms Late 18th/early 19th centuries
  • 3. Punched cards First used for looms in 18th Century France - Jacquard Loom 1801 IBM introduced punched card format 1928 - 80 columns! Text mode column width for DOS, Unix etc. Imagine creating by hand Keypunch machines (a little like typewriters) for creating them Errors mean throwing away the card and doing it again Fortran and Cobol started with punched cards
  • 4. Fixing card decks What if your cards are dropped on the floor? This is an IBM 082 Sorter Automation of a very error-prone manual process
  • 5. Magnetism saves the day! Finally, R/W data and code. The dawn of text editors.
  • 7. Make *.c: *.o cc … myapp: app.o mylib.o … ld … + manual custom dependencies Focus mainly on compilation and linking Make has powerful model based on file dependencies Maintenance was a lot of work
  • 8. Make *.c: *.o cc … myapp: app.o mylib.o … ld … What’s this? + manual custom dependencies Tabs were the bane of Make file writers
  • 9. Java • Compiler handles .java to .class dependencies • JAR as ‘module’ unit • Several standard deployment types - Applet - WAR - Standalone app Publish == prod server, installer, JAR, zip package, etc.
  • 10. A standard build Compile Test Package Publish? A simplification from the days of C Interesting point: does the packaging actually require the tests to run?
  • 11. What will builds look like in 5 years time?
  • 12. Our builds last a long time You want a tool that can grow and adapt One that handles all sorts of build processes Even Java builds are evolving
  • 13. Model as a graph Step Step Step Step Step All build processes can be modeled as a Directed Acyclic Graph (DAG) of steps This is the Gradle model (a task == a step)
  • 14. But we don’t want to set up all those steps!
  • 15. Gradle Conventions apply plugin: "java" group = "org.example" version = "0.7.1" sourceCompatibility = "1.7" targetCompatibility = "1.7" Java build conventions provided by plugin
  • 16. Gradle Conventions • compileJava (src/main/java) • compileTestJava (src/test/java) • test (added as dependency of check) - test reports in build/reports/test • jar (added as dependency of assemble) - created in build/libs • javadoc
  • 17. Not all builds are the same
  • 18. Java build evolved Compile Test Package Publish? Dev setup Run QA SCM Tags Deployment Docs Generators JS + CSS Builds are incorporating more and more steps Android is an example of a quite different Java build
  • 19. Custom build publishPdf publishGuide apiDocs fetchGrailsSource grails-doc project expensive, so optional build A build to generate the Grails user guide Automation of all steps No standard tasks Task graph is a suitable model
  • 20. Mixed build C/C++ DLL/SO Java Debian packages Executable Build barrier Build barrier I’ve worked with or know of several projects that have native + Java parts
  • 21. Each transfer between different build systems is like a baton handover - with the potential for the baton to be dropped.
  • 22. The build tool should not dictate the build process
  • 23. Goals of a build What do we want out of our build processes?
  • 24. Automation People are fallible Muscle memory can help e.g. tying shoe laces Not usually applicable in software development
  • 25. Automation • Humans are fallible • Every manual step adds to the fragility of the build • Muscle memory can help, but rarely applicable People are fallible Muscle memory can help e.g. tying shoe laces Not usually applicable in software development
  • 26. Mistakes == Lost time (and possibly money) Errors made deploying to beta.grails.org and grails.org Long path between updating source code and starting the server with changes Stress and downtime
  • 27. Does your build have manual steps? If so, why? For example, copying files around, entering parameter values, running external scripts, etc.
  • 28. Custom tasks in Gradle task publishGuide << { // Generate HTML from .gdoc } build.dependsOn publishGuide buildSrc/src/groovy/pkg/PublishGuideTask.groovy pkg.PublishGuideTask in a JAR
  • 29. Don’t reinvent the wheel http://plugins.gradle.org/ Gradle Plugin Portal This is searchable Contains many (but not all) publicly available plugins You can publish your own too
  • 31. Same inputs should result in same outputs In other words, repeatable builds Environment should not be a factor Does the build behave differently on different platforms? Consider “works for me” with local Maven cache
  • 32. Depends on tasks • Are tasks environment-dependent? • Do system properties or environment variables have an effect? • What about number of cores? • Order of tests? Gradle can’t help much with this - except for task ordering
  • 33. Task ordering • mustRunAfter/shouldRunAfter • No task dependencies task integTest { ... } task packageReports { mustRunAfter integTest ... } `packageReports` does not depend on `integTest` But if both are executed, `packageReports` must come after `integTest` shouldRunAfter is less strict - mostly to optimise feedback
  • 34. Task ordering • finalizedBy • Ensures execution of the finalizer task task integTest { finalizedBy packageReports ... } task packageReports { ... } `packageReports` does not depend on `integTest` If `integTest` runs, then `packageReports` will run too, always after `integTest`
  • 35. Gradle cache • Origin checks • Artifact checksums • Concurrency safe • Avoid mavenLocal()! Dependency cache can be a big impediment to repeatability
  • 36. Resolution strategy configurations.all { resolutionStrategy { failOnVersionConflict() force 'asm:asm-all:3.3.1', 'commons-io:commons-io:1.4' } Override version to use for specific dependencies Fail the build if any version conflicts Defaults to ‘newest’ strategy Fine-grained control over dependency versions Automatic conflict resolution error-prone
  • 37. Resolution strategy configurations.all { eachDependency { details -> if (details.requested.name == 'groovy-all') { details.useTarget( group: details.requested.group, name: 'groovy', version: details.requested.version) } } } Control modules with different names, same classes A painful problem to debug
  • 38. Efficiency Some tasks take significant amounts of time to execute Why run them each time? Think Ant/Maven incremental compilation
  • 39. Incremental build :lazybones-app:compileJava :lazybones-app:compileGroovy UP-TO-DATE :lazybones-app:processResources UP-TO-DATE :lazybones-app:classes UP-TO-DATE :lazybones-app:jar UP-TO-DATE :lazybones-app:startScripts UP-TO-DATE :lazybones-app:installApp UP-TO-DATE BUILD SUCCESSFUL Total time: 2.178 secs UP-TO-DATE Don’t execute tasks you don’t have to
  • 40. Task inputs & outputs class BintrayGenericUpload extends DefaultTask { @InputFile File artifactFile @Input String artifactUrlPath @Optional @Input String repositoryUrl …⋯ } Use of annotations makes task support incremental build Inputs and outputs can be values, files, directories
  • 41. A build should be… Automated Repeatable Efficient
  • 42. On top of this, Gradle gives you • a rich API for modelling your build process • full dependency management • Java ecosystem integration - IDEs, CI, static analysis tools, etc. • Flexible publishing (Maven, Ivy,AWS S3) • Many useful plugins to save you work
  • 43. Summary • End-to-end process is the build • 80-20 rule (80% standard 20% custom) • Automate everything == save time • Invest in build as if it’s part of your code base • Building software requires a rich model
  • 44. Thank you! e: peter@cacoethes.co.uk w: http://www.cacoethes.co.uk t: @pledbrook