Migrating 25K lines of Ant scripting to Gradle
-
Upload
hanno-embregts -
Category
Software
-
view
155 -
download
1
Transcript of Migrating 25K lines of Ant scripting to Gradle
![Page 1: Migrating 25K lines of Ant scripting to Gradle](https://reader034.fdocuments.net/reader034/viewer/2022052606/58ecd4f51a28ab45438b45e3/html5/thumbnails/1.jpg)
![Page 2: Migrating 25K lines of Ant scripting to Gradle](https://reader034.fdocuments.net/reader034/viewer/2022052606/58ecd4f51a28ab45438b45e3/html5/thumbnails/2.jpg)
Who is this guy?
![Page 3: Migrating 25K lines of Ant scripting to Gradle](https://reader034.fdocuments.net/reader034/viewer/2022052606/58ecd4f51a28ab45438b45e3/html5/thumbnails/3.jpg)
![Page 4: Migrating 25K lines of Ant scripting to Gradle](https://reader034.fdocuments.net/reader034/viewer/2022052606/58ecd4f51a28ab45438b45e3/html5/thumbnails/4.jpg)
![Page 5: Migrating 25K lines of Ant scripting to Gradle](https://reader034.fdocuments.net/reader034/viewer/2022052606/58ecd4f51a28ab45438b45e3/html5/thumbnails/5.jpg)
![Page 6: Migrating 25K lines of Ant scripting to Gradle](https://reader034.fdocuments.net/reader034/viewer/2022052606/58ecd4f51a28ab45438b45e3/html5/thumbnails/6.jpg)
![Page 7: Migrating 25K lines of Ant scripting to Gradle](https://reader034.fdocuments.net/reader034/viewer/2022052606/58ecd4f51a28ab45438b45e3/html5/thumbnails/7.jpg)
We will consult these 3 experts
Linus Torvalds
creator of Linux & Git
![Page 8: Migrating 25K lines of Ant scripting to Gradle](https://reader034.fdocuments.net/reader034/viewer/2022052606/58ecd4f51a28ab45438b45e3/html5/thumbnails/8.jpg)
We will consult these 3 experts
Linus Torvalds Mark Reinhold
creator of Linux & Git Java's chief architect
![Page 9: Migrating 25K lines of Ant scripting to Gradle](https://reader034.fdocuments.net/reader034/viewer/2022052606/58ecd4f51a28ab45438b45e3/html5/thumbnails/9.jpg)
We will consult these 3 experts
Linus Torvalds Mark Reinhold Louis van Gaal
creator of Linux & Git Java's chief architect manager ofManchester United
![Page 10: Migrating 25K lines of Ant scripting to Gradle](https://reader034.fdocuments.net/reader034/viewer/2022052606/58ecd4f51a28ab45438b45e3/html5/thumbnails/10.jpg)
We will consult these 3 experts
Linus Torvalds Mark Reinhold Louis van Gaal
creator of Linux & Git Java's chief architect former manager ofManchester United
![Page 11: Migrating 25K lines of Ant scripting to Gradle](https://reader034.fdocuments.net/reader034/viewer/2022052606/58ecd4f51a28ab45438b45e3/html5/thumbnails/11.jpg)
Changes inrequirements
![Page 12: Migrating 25K lines of Ant scripting to Gradle](https://reader034.fdocuments.net/reader034/viewer/2022052606/58ecd4f51a28ab45438b45e3/html5/thumbnails/12.jpg)
Changes in requirementsPast
compiling
packaging
![Page 13: Migrating 25K lines of Ant scripting to Gradle](https://reader034.fdocuments.net/reader034/viewer/2022052606/58ecd4f51a28ab45438b45e3/html5/thumbnails/13.jpg)
Changes in requirementsPresent
one project, multiple programming languages
compiling
running automated tests
packaging
integrating code as early as possible
deploying software to TAP
![Page 14: Migrating 25K lines of Ant scripting to Gradle](https://reader034.fdocuments.net/reader034/viewer/2022052606/58ecd4f51a28ab45438b45e3/html5/thumbnails/14.jpg)
Defining builds inXML
![Page 15: Migrating 25K lines of Ant scripting to Gradle](https://reader034.fdocuments.net/reader034/viewer/2022052606/58ecd4f51a28ab45438b45e3/html5/thumbnails/15.jpg)
XMLLet's start by being nice:
excels at expressing hierarchical data
![Page 16: Migrating 25K lines of Ant scripting to Gradle](https://reader034.fdocuments.net/reader034/viewer/2022052606/58ecd4f51a28ab45438b45e3/html5/thumbnails/16.jpg)
XMLLet'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
![Page 17: Migrating 25K lines of Ant scripting to Gradle](https://reader034.fdocuments.net/reader034/viewer/2022052606/58ecd4f51a28ab45438b45e3/html5/thumbnails/17.jpg)
What does Linus think of XML?
![Page 18: Migrating 25K lines of Ant scripting to Gradle](https://reader034.fdocuments.net/reader034/viewer/2022052606/58ecd4f51a28ab45438b45e3/html5/thumbnails/18.jpg)
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
![Page 19: Migrating 25K lines of Ant scripting to Gradle](https://reader034.fdocuments.net/reader034/viewer/2022052606/58ecd4f51a28ab45438b45e3/html5/thumbnails/19.jpg)
Build tools:head to head
![Page 20: Migrating 25K lines of Ant scripting to Gradle](https://reader034.fdocuments.net/reader034/viewer/2022052606/58ecd4f51a28ab45438b45e3/html5/thumbnails/20.jpg)
Ant vs. Maven according to Mark
![Page 21: Migrating 25K lines of Ant scripting to Gradle](https://reader034.fdocuments.net/reader034/viewer/2022052606/58ecd4f51a28ab45438b45e3/html5/thumbnails/21.jpg)
Ant vs. Maven according to Mark
( )
What's the difference between Ant and
Maven?
https://www.parleys.com/tutorial/devoxx-fireside-chat
![Page 22: Migrating 25K lines of Ant scripting to Gradle](https://reader034.fdocuments.net/reader034/viewer/2022052606/58ecd4f51a28ab45438b45e3/html5/thumbnails/22.jpg)
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
![Page 23: Migrating 25K lines of Ant scripting to Gradle](https://reader034.fdocuments.net/reader034/viewer/2022052606/58ecd4f51a28ab45438b45e3/html5/thumbnails/23.jpg)
Build tools head-to-headAnt Maven Gradle
![Page 24: Migrating 25K lines of Ant scripting to Gradle](https://reader034.fdocuments.net/reader034/viewer/2022052606/58ecd4f51a28ab45438b45e3/html5/thumbnails/24.jpg)
Build tools head-to-headAnt Maven Gradle
build script format XML XML Groovy / DSL
![Page 25: Migrating 25K lines of Ant scripting to Gradle](https://reader034.fdocuments.net/reader034/viewer/2022052606/58ecd4f51a28ab45438b45e3/html5/thumbnails/25.jpg)
Build tools head-to-headAnt Maven Gradle
build script format XML XML Groovy / DSL
dependencies with Ivy built-in built-in
![Page 26: Migrating 25K lines of Ant scripting to Gradle](https://reader034.fdocuments.net/reader034/viewer/2022052606/58ecd4f51a28ab45438b45e3/html5/thumbnails/26.jpg)
Build tools head-to-headAnt Maven Gradle
build script format XML XML Groovy / DSL
dependencies with Ivy built-in built-in
multi-module builds complex simple simple
![Page 27: Migrating 25K lines of Ant scripting to Gradle](https://reader034.fdocuments.net/reader034/viewer/2022052606/58ecd4f51a28ab45438b45e3/html5/thumbnails/27.jpg)
Build tools head-to-headAnt 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
![Page 28: Migrating 25K lines of Ant scripting to Gradle](https://reader034.fdocuments.net/reader034/viewer/2022052606/58ecd4f51a28ab45438b45e3/html5/thumbnails/28.jpg)
Build tools head-to-headAnt 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
![Page 29: Migrating 25K lines of Ant scripting to Gradle](https://reader034.fdocuments.net/reader034/viewer/2022052606/58ecd4f51a28ab45438b45e3/html5/thumbnails/29.jpg)
Build tools head-to-headAnt 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
![Page 30: Migrating 25K lines of Ant scripting to Gradle](https://reader034.fdocuments.net/reader034/viewer/2022052606/58ecd4f51a28ab45438b45e3/html5/thumbnails/30.jpg)
Build tools head-to-headAnt 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
![Page 31: Migrating 25K lines of Ant scripting to Gradle](https://reader034.fdocuments.net/reader034/viewer/2022052606/58ecd4f51a28ab45438b45e3/html5/thumbnails/31.jpg)
Build tools head-to-headAnt 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
![Page 32: Migrating 25K lines of Ant scripting to Gradle](https://reader034.fdocuments.net/reader034/viewer/2022052606/58ecd4f51a28ab45438b45e3/html5/thumbnails/32.jpg)
Gradle at NS(Dutch Railways)
![Page 33: Migrating 25K lines of Ant scripting to Gradle](https://reader034.fdocuments.net/reader034/viewer/2022052606/58ecd4f51a28ab45438b45e3/html5/thumbnails/33.jpg)
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
![Page 34: Migrating 25K lines of Ant scripting to Gradle](https://reader034.fdocuments.net/reader034/viewer/2022052606/58ecd4f51a28ab45438b45e3/html5/thumbnails/34.jpg)
Migration strategy
![Page 35: Migrating 25K lines of Ant scripting to Gradle](https://reader034.fdocuments.net/reader034/viewer/2022052606/58ecd4f51a28ab45438b45e3/html5/thumbnails/35.jpg)
Migration strategydivide 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)
![Page 36: Migrating 25K lines of Ant scripting to Gradle](https://reader034.fdocuments.net/reader034/viewer/2022052606/58ecd4f51a28ab45438b45e3/html5/thumbnails/36.jpg)
Migration strategydivide 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
![Page 37: Migrating 25K lines of Ant scripting to Gradle](https://reader034.fdocuments.net/reader034/viewer/2022052606/58ecd4f51a28ab45438b45e3/html5/thumbnails/37.jpg)
Migration strategydivide 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'
![Page 38: Migrating 25K lines of Ant scripting to Gradle](https://reader034.fdocuments.net/reader034/viewer/2022052606/58ecd4f51a28ab45438b45e3/html5/thumbnails/38.jpg)
Challengesdependency spaghetti
collaboration with existing Ant code
continuous integration & delivery
![Page 39: Migrating 25K lines of Ant scripting to Gradle](https://reader034.fdocuments.net/reader034/viewer/2022052606/58ecd4f51a28ab45438b45e3/html5/thumbnails/39.jpg)
Migration resulta 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
![Page 40: Migrating 25K lines of Ant scripting to Gradle](https://reader034.fdocuments.net/reader034/viewer/2022052606/58ecd4f51a28ab45438b45e3/html5/thumbnails/40.jpg)
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
![Page 41: Migrating 25K lines of Ant scripting to Gradle](https://reader034.fdocuments.net/reader034/viewer/2022052606/58ecd4f51a28ab45438b45e3/html5/thumbnails/41.jpg)
What does Louis think of migrating all Antcode?
![Page 42: Migrating 25K lines of Ant scripting to Gradle](https://reader034.fdocuments.net/reader034/viewer/2022052606/58ecd4f51a28ab45438b45e3/html5/thumbnails/42.jpg)
What does Louis think of migrating all Antcode?
( )
In the Netherlands they say: "That is another
cook."
https://youtu.be/x-QRqOndbzw
![Page 43: Migrating 25K lines of Ant scripting to Gradle](https://reader034.fdocuments.net/reader034/viewer/2022052606/58ecd4f51a28ab45438b45e3/html5/thumbnails/43.jpg)
Wrap-up
![Page 44: Migrating 25K lines of Ant scripting to Gradle](https://reader034.fdocuments.net/reader034/viewer/2022052606/58ecd4f51a28ab45438b45e3/html5/thumbnails/44.jpg)
Wrap-up
![Page 45: Migrating 25K lines of Ant scripting to Gradle](https://reader034.fdocuments.net/reader034/viewer/2022052606/58ecd4f51a28ab45438b45e3/html5/thumbnails/45.jpg)
Wrap-upAnt & Maven:
require hard-to-maintain code
the purpose of a code fragment is not clearly evident
![Page 46: Migrating 25K lines of Ant scripting to Gradle](https://reader034.fdocuments.net/reader034/viewer/2022052606/58ecd4f51a28ab45438b45e3/html5/thumbnails/46.jpg)
Wrap-upAnt & 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
![Page 47: Migrating 25K lines of Ant scripting to Gradle](https://reader034.fdocuments.net/reader034/viewer/2022052606/58ecd4f51a28ab45438b45e3/html5/thumbnails/47.jpg)
Wrap-upAnt & 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
![Page 48: Migrating 25K lines of Ant scripting to Gradle](https://reader034.fdocuments.net/reader034/viewer/2022052606/58ecd4f51a28ab45438b45e3/html5/thumbnails/48.jpg)
Wrap-up (2)Gradle offers structure and flexibility
tries to combine the power of Ant and Maven
integrates with (almost) anything
![Page 49: Migrating 25K lines of Ant scripting to Gradle](https://reader034.fdocuments.net/reader034/viewer/2022052606/58ecd4f51a28ab45438b45e3/html5/thumbnails/49.jpg)
Wrap-up (3)So no drawbacks whatsoever?
![Page 50: Migrating 25K lines of Ant scripting to Gradle](https://reader034.fdocuments.net/reader034/viewer/2022052606/58ecd4f51a28ab45438b45e3/html5/thumbnails/50.jpg)
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
![Page 51: Migrating 25K lines of Ant scripting to Gradle](https://reader034.fdocuments.net/reader034/viewer/2022052606/58ecd4f51a28ab45438b45e3/html5/thumbnails/51.jpg)
Should my project use Gradle?A brand-new project?
![Page 52: Migrating 25K lines of Ant scripting to Gradle](https://reader034.fdocuments.net/reader034/viewer/2022052606/58ecd4f51a28ab45438b45e3/html5/thumbnails/52.jpg)
Should my project use Gradle?A brand-new project?
just do it
![Page 53: Migrating 25K lines of Ant scripting to Gradle](https://reader034.fdocuments.net/reader034/viewer/2022052606/58ecd4f51a28ab45438b45e3/html5/thumbnails/53.jpg)
Should my project use Gradle?A brand-new project?
just do it
do it RIGHT NOW
![Page 54: Migrating 25K lines of Ant scripting to Gradle](https://reader034.fdocuments.net/reader034/viewer/2022052606/58ecd4f51a28ab45438b45e3/html5/thumbnails/54.jpg)
Should my project use Gradle?An existing project?
![Page 55: Migrating 25K lines of Ant scripting to Gradle](https://reader034.fdocuments.net/reader034/viewer/2022052606/58ecd4f51a28ab45438b45e3/html5/thumbnails/55.jpg)
Should my project use Gradle?An existing project?
Will you benefit from Gradles key features? (better
performance, maintainability, less verbose, ...)
![Page 56: Migrating 25K lines of Ant scripting to Gradle](https://reader034.fdocuments.net/reader034/viewer/2022052606/58ecd4f51a28ab45438b45e3/html5/thumbnails/56.jpg)
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?
![Page 57: Migrating 25K lines of Ant scripting to Gradle](https://reader034.fdocuments.net/reader034/viewer/2022052606/58ecd4f51a28ab45438b45e3/html5/thumbnails/57.jpg)
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
![Page 58: Migrating 25K lines of Ant scripting to Gradle](https://reader034.fdocuments.net/reader034/viewer/2022052606/58ecd4f51a28ab45438b45e3/html5/thumbnails/58.jpg)
Any questions?
![Page 59: Migrating 25K lines of Ant scripting to Gradle](https://reader034.fdocuments.net/reader034/viewer/2022052606/58ecd4f51a28ab45438b45e3/html5/thumbnails/59.jpg)
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
![Page 60: Migrating 25K lines of Ant scripting to Gradle](https://reader034.fdocuments.net/reader034/viewer/2022052606/58ecd4f51a28ab45438b45e3/html5/thumbnails/60.jpg)
Thank you :)
You can contact me at:
@hannotify