Who is this guy?
We will consult these 3 experts
Linus Torvalds
creator of Linux & Git
We will consult these 3 experts
Linus Torvalds Mark Reinhold
creator of Linux & Git Java's chief architect
We will consult these 3 experts
Linus Torvalds Mark Reinhold Louis van Gaal
creator of Linux & Git Java's chief architect manager of
Manchester United
We will consult these 3 experts
Linus Torvalds Mark Reinhold Louis van Gaal
creator of Linux & Git Java's chief architect former manager of
Manchester United
Changes in
requirements
Changes in requirements
Past
compiling
packaging
Changes in requirements
Present
one project, multiple programming languages
compiling
running automated tests
packaging
integrating code as early as possible
deploying software to TAP
Defining builds in
XML
XML
Let's start by being nice:
excels at expressing hierarchical data
XML
Let's start by being nice:
excels at expressing hierarchical data
but...
build scripting logic doesn't easily fit a hierarchy
often it consists of conditional and repeating logic
which can be expressed more concisely in a programming
language
What does Linus think of XML?
What does Linus think of XML?
( )
XML is crap. Really. There are no excuses.
XML is nasty to parse for humans, and it's a
disaster to parse even for computers. There's
just no reason for that horrible crap to exist.
https://plus.google.com/+LinusTorvalds/posts/X2XVf9Q7MfV
Build tools:
head to head
Ant vs. Maven according to Mark
Ant vs. Maven according to Mark
( )
What's the difference between Ant and
Maven?
https://www.parleys.com/tutorial/devoxx-fireside-chat
Ant vs. Maven according to Mark
( )
What's the difference between Ant and
Maven? The creator of Ant has apologized.
https://www.parleys.com/tutorial/devoxx-fireside-chat
Build tools head-to-head
Ant Maven Gradle
Build tools head-to-head
Ant Maven Gradle
build script format XML XML Groovy / DSL
Build tools head-to-head
Ant Maven Gradle
build script format XML XML Groovy / DSL
dependencies with Ivy built-in built-in
Build tools head-to-head
Ant Maven Gradle
build script format XML XML Groovy / DSL
dependencies with Ivy built-in built-in
multi-module builds complex simple simple
Build tools head-to-head
Ant Maven Gradle
build script format XML XML Groovy / DSL
dependencies with Ivy built-in built-in
multi-module builds complex simple simple
pre-defined structure absent present present
Build tools head-to-head
Ant Maven Gradle
build script format XML XML Groovy / DSL
dependencies with Ivy built-in built-in
multi-module builds complex simple simple
pre-defined structure absent present present
custom structure n/a complex simple
Build tools head-to-head
Ant Maven Gradle
build script format XML XML Groovy / DSL
dependencies with Ivy built-in built-in
multi-module builds complex simple simple
pre-defined structure absent present present
custom structure n/a complex simple
verbosity high average low
Build tools head-to-head
Ant Maven Gradle
build script format XML XML Groovy / DSL
dependencies with Ivy built-in built-in
multi-module builds complex simple simple
pre-defined structure absent present present
custom structure n/a complex simple
verbosity high average low
learning curve shallow steep average
Build tools head-to-head
Ant Maven Gradle
build script format XML XML Groovy / DSL
dependencies with Ivy built-in built-in
multi-module builds complex simple simple
pre-defined structure absent present present
custom structure n/a complex simple
verbosity high average low
learning curve shallow steep average
build order depends-on lifecycles directed acyclic graph
Gradle at NS
(Dutch Railways)
Gradle at NS (Dutch Railways)
not at all a 'greenfield project'!
1 million lines of code
over 25,000 lines of Ant scripting
30 software developers
system behaves like a monolith
Migration strategy
Migration strategy
divide the project into components according to
functionality
start Gradling at a small, isolated part
focus on code that is used regularly (i.e. on a daily basis)
Migration strategy
divide the project into components according to
functionality
start Gradling at a small, isolated part
focus on code that is used regularly (i.e. on a daily basis)
verify after each step that:
results are exactly the same as before
no problems occur in existing Ant code
Migration strategy
divide the project into components according to
functionality
start Gradling at a small, isolated part
focus on code that is used regularly (i.e. on a daily basis)
verify after each step that:
results are exactly the same as before
no problems occur in existing Ant code
don't fool yourself: not every single line of Ant code should
be replaced
Ant projects are 'first class citizens'
Challenges
dependency spaghetti
collaboration with existing Ant code
continuous integration & delivery
Migration result
a component's responsibility has become clearer
a build will only run if the particular component has
changed
run unit test in parallel (Gradle decides when)
dependencies behave transitively
Migration result (lines of code)
Language Lines of code (before) Lines of code (after)
Ant over 25,000 about 15,000
Gradle 0 1,232
What does Louis think of migrating all Ant
code?
What does Louis think of migrating all Ant
code?
( )
In the Netherlands they say: "That is another
cook."
https://youtu.be/x-QRqOndbzw
Wrap-up
Wrap-up
Wrap-up
Ant & Maven:
require hard-to-maintain code
the purpose of a code fragment is not clearly evident
Wrap-up
Ant & Maven:
require hard-to-maintain code
the purpose of a code fragment is not clearly evident
often fail to address changing requirements
rely heavily on XML
Wrap-up
Ant & Maven:
require hard-to-maintain code
the purpose of a code fragment is not clearly evident
often fail to address changing requirements
rely heavily on XML
Gradle is a better alternative
Wrap-up (2)
Gradle offers structure and flexibility
tries to combine the power of Ant and Maven
integrates with (almost) anything
Wrap-up (3)
So no drawbacks whatsoever?
Wrap-up (3)
So no drawbacks whatsoever?
Gradle spends a lot of time on configuration parsing (but
this has steadily improved in the past year)
developers need to get used to it
migrating existing scripting is a lot of work
Should my project use Gradle?
A brand-new project?
Should my project use Gradle?
A brand-new project?
just do it
Should my project use Gradle?
A brand-new project?
just do it
do it RIGHT NOW
Should my project use Gradle?
An existing project?
Should my project use Gradle?
An existing project?
Will you benefit from Gradles key features? (better
performance, maintainability, less verbose, ...)
Should my project use Gradle?
An existing project?
Will you benefit from Gradles key features? (better
performance, maintainability, less verbose, ...)
Any technical debt to solve?
Should my project use Gradle?
An existing project?
Will you benefit from Gradles key features? (better
performance, maintainability, less verbose, ...)
Any technical debt to solve?
use an artifact repository and remove duplicates
divide your project into multiple components
define a clear structure in your build logic
Any questions?
Further reading
"Why Build Your Java Projects with Gradle Rather than Ant
or Maven?"
by Benjamin Muschko
( )
Gradle User Guide
( )
Gradle Build Language Reference
( )
http://www.drdobbs.com/jvm/why-build-your-java-projects-with-gradle/240168608
http://gradle.org/docs/current/userguide/userguide.html
http://gradle.org/docs/current/dsl/index.html
Thank you :)
You can contact me at:
@hannotify
hanno.embregts@infosupport.com

Migrating 25K lines of Ant scripting to Gradle

  • 2.
  • 7.
    We will consultthese 3 experts Linus Torvalds creator of Linux & Git
  • 8.
    We will consultthese 3 experts Linus Torvalds Mark Reinhold creator of Linux & Git Java's chief architect
  • 9.
    We will consultthese 3 experts Linus Torvalds Mark Reinhold Louis van Gaal creator of Linux & Git Java's chief architect manager of Manchester United
  • 10.
    We will consultthese 3 experts Linus Torvalds Mark Reinhold Louis van Gaal creator of Linux & Git Java's chief architect former manager of Manchester United
  • 11.
  • 12.
  • 13.
    Changes in requirements Present oneproject, multiple programming languages compiling running automated tests packaging integrating code as early as possible deploying software to TAP
  • 14.
  • 15.
    XML Let's start bybeing nice: excels at expressing hierarchical data
  • 16.
    XML Let's start bybeing nice: excels at expressing hierarchical data but... build scripting logic doesn't easily fit a hierarchy often it consists of conditional and repeating logic which can be expressed more concisely in a programming language
  • 17.
    What does Linusthink of XML?
  • 18.
    What does Linusthink of XML? ( ) XML is crap. Really. There are no excuses. XML is nasty to parse for humans, and it's a disaster to parse even for computers. There's just no reason for that horrible crap to exist. https://plus.google.com/+LinusTorvalds/posts/X2XVf9Q7MfV
  • 19.
  • 20.
    Ant vs. Mavenaccording to Mark
  • 21.
    Ant vs. Mavenaccording to Mark ( ) What's the difference between Ant and Maven? https://www.parleys.com/tutorial/devoxx-fireside-chat
  • 22.
    Ant vs. Mavenaccording to Mark ( ) What's the difference between Ant and Maven? The creator of Ant has apologized. https://www.parleys.com/tutorial/devoxx-fireside-chat
  • 23.
  • 24.
    Build tools head-to-head AntMaven Gradle build script format XML XML Groovy / DSL
  • 25.
    Build tools head-to-head AntMaven Gradle build script format XML XML Groovy / DSL dependencies with Ivy built-in built-in
  • 26.
    Build tools head-to-head AntMaven Gradle build script format XML XML Groovy / DSL dependencies with Ivy built-in built-in multi-module builds complex simple simple
  • 27.
    Build tools head-to-head AntMaven Gradle build script format XML XML Groovy / DSL dependencies with Ivy built-in built-in multi-module builds complex simple simple pre-defined structure absent present present
  • 28.
    Build tools head-to-head AntMaven Gradle build script format XML XML Groovy / DSL dependencies with Ivy built-in built-in multi-module builds complex simple simple pre-defined structure absent present present custom structure n/a complex simple
  • 29.
    Build tools head-to-head AntMaven Gradle build script format XML XML Groovy / DSL dependencies with Ivy built-in built-in multi-module builds complex simple simple pre-defined structure absent present present custom structure n/a complex simple verbosity high average low
  • 30.
    Build tools head-to-head AntMaven Gradle build script format XML XML Groovy / DSL dependencies with Ivy built-in built-in multi-module builds complex simple simple pre-defined structure absent present present custom structure n/a complex simple verbosity high average low learning curve shallow steep average
  • 31.
    Build tools head-to-head AntMaven Gradle build script format XML XML Groovy / DSL dependencies with Ivy built-in built-in multi-module builds complex simple simple pre-defined structure absent present present custom structure n/a complex simple verbosity high average low learning curve shallow steep average build order depends-on lifecycles directed acyclic graph
  • 32.
  • 33.
    Gradle at NS(Dutch Railways) not at all a 'greenfield project'! 1 million lines of code over 25,000 lines of Ant scripting 30 software developers system behaves like a monolith
  • 34.
  • 35.
    Migration strategy divide theproject into components according to functionality start Gradling at a small, isolated part focus on code that is used regularly (i.e. on a daily basis)
  • 36.
    Migration strategy divide theproject into components according to functionality start Gradling at a small, isolated part focus on code that is used regularly (i.e. on a daily basis) verify after each step that: results are exactly the same as before no problems occur in existing Ant code
  • 37.
    Migration strategy divide theproject into components according to functionality start Gradling at a small, isolated part focus on code that is used regularly (i.e. on a daily basis) verify after each step that: results are exactly the same as before no problems occur in existing Ant code don't fool yourself: not every single line of Ant code should be replaced Ant projects are 'first class citizens'
  • 38.
    Challenges dependency spaghetti collaboration withexisting Ant code continuous integration & delivery
  • 39.
    Migration result a component'sresponsibility has become clearer a build will only run if the particular component has changed run unit test in parallel (Gradle decides when) dependencies behave transitively
  • 40.
    Migration result (linesof code) Language Lines of code (before) Lines of code (after) Ant over 25,000 about 15,000 Gradle 0 1,232
  • 41.
    What does Louisthink of migrating all Ant code?
  • 42.
    What does Louisthink of migrating all Ant code? ( ) In the Netherlands they say: "That is another cook." https://youtu.be/x-QRqOndbzw
  • 43.
  • 44.
  • 45.
    Wrap-up Ant & Maven: requirehard-to-maintain code the purpose of a code fragment is not clearly evident
  • 46.
    Wrap-up Ant & Maven: requirehard-to-maintain code the purpose of a code fragment is not clearly evident often fail to address changing requirements rely heavily on XML
  • 47.
    Wrap-up Ant & Maven: requirehard-to-maintain code the purpose of a code fragment is not clearly evident often fail to address changing requirements rely heavily on XML Gradle is a better alternative
  • 48.
    Wrap-up (2) Gradle offersstructure and flexibility tries to combine the power of Ant and Maven integrates with (almost) anything
  • 49.
    Wrap-up (3) So nodrawbacks whatsoever?
  • 50.
    Wrap-up (3) So nodrawbacks whatsoever? Gradle spends a lot of time on configuration parsing (but this has steadily improved in the past year) developers need to get used to it migrating existing scripting is a lot of work
  • 51.
    Should my projectuse Gradle? A brand-new project?
  • 52.
    Should my projectuse Gradle? A brand-new project? just do it
  • 53.
    Should my projectuse Gradle? A brand-new project? just do it do it RIGHT NOW
  • 54.
    Should my projectuse Gradle? An existing project?
  • 55.
    Should my projectuse Gradle? An existing project? Will you benefit from Gradles key features? (better performance, maintainability, less verbose, ...)
  • 56.
    Should my projectuse Gradle? An existing project? Will you benefit from Gradles key features? (better performance, maintainability, less verbose, ...) Any technical debt to solve?
  • 57.
    Should my projectuse Gradle? An existing project? Will you benefit from Gradles key features? (better performance, maintainability, less verbose, ...) Any technical debt to solve? use an artifact repository and remove duplicates divide your project into multiple components define a clear structure in your build logic
  • 58.
  • 59.
    Further reading "Why BuildYour Java Projects with Gradle Rather than Ant or Maven?" by Benjamin Muschko ( ) Gradle User Guide ( ) Gradle Build Language Reference ( ) http://www.drdobbs.com/jvm/why-build-your-java-projects-with-gradle/240168608 http://gradle.org/docs/current/userguide/userguide.html http://gradle.org/docs/current/dsl/index.html
  • 60.
    Thank you :) Youcan contact me at: @hannotify hanno.embregts@infosupport.com