Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Speaker Deck
PRO
Sign in
Sign up
for free
Rock the Gradle, Rule the World
Xavier Gouchet
April 01, 2019
Programming
1
13
Rock the Gradle, Rule the World
Xavier Gouchet
April 01, 2019
Tweet
Share
More Decks by Xavier Gouchet
See All by Xavier Gouchet
xgouchet
1
57
xgouchet
0
80
xgouchet
1
150
xgouchet
1
17
xgouchet
6
240
xgouchet
1
36
xgouchet
2
53
xgouchet
1
92
xgouchet
1
42
Other Decks in Programming
See All in Programming
keiichihirobe
1
110
emmaglorypraise
0
120
hyodol2513
0
570
yoshinoriiiii
0
110
deepflow
3
650
minamijoyo
3
470
panini
1
160
dqneo
3
290
rarous
0
170
danilop
1
730
christianweyer
PRO
0
270
mackee
0
510
Featured
See All Featured
michaelherold
224
8.5k
shpigford
165
19k
skipperchong
8
710
jrom
116
7.2k
pauljervisheath
196
15k
bryan
31
3.4k
stephaniewalter
260
11k
rocio
155
11k
jeffersonlam
329
15k
deanohume
295
28k
danielanewman
1
520
brianwarren
83
4.7k
Transcript
Rock the Gradle Rule the world
About… Lead Android Engineer at WorkWell Fluent in Android since
Cupcake 2
A brief introduction 1
Dependency Management System What is Gradle General Purpose Build management
4
5 General purpose Language agnostic Feature agnostic
6 Dependency management system Knows how to graph and resolve
dependencies ◇ code ◇ tasks ◇ …
7 Build management Based on tasks created by plugins
Configuration Gradle flow Initialisation Execution 8
9 Initialisation Launches the JVM (with proper params) Analyse the
working directory Reads the settings.gradle file Creates the Project object(s) that will be used Compiles, test and add buildSrc to the classpath
10 Configuration Execute all the build.gradle scripts in the project
Create all the Task objects and configure the Project object(s) Resolves the tasks dependencies
11 Execution List the Task to run based on the
invocation (and their dependencies) Execute each of the tasks
Meet the buildSrc folder 2
Project structure ┬ MyProject ├┬ app/ │├── src/ │└── build.gradle
├┬ buildSrc/ │├── src/ │├── build.gradle │└── settings.gradle ├─ build.gradle └─ settings.gradle 13
Purposes… ◇ Better dependency management ◇ Helper classes / methods
◇ Custom tasks in dedicated classes ◇ Custom plugin ■ Locally versionned with the project 14
How does it work? ◇ Works like any module in
your project ◇ Compiled and tested before any gradle task ◇ Groovy, Java, Kotlin, … ◇ Any public class / method becomes availble in gradle scripts 15
“ A change in buildSrc causes the whole project to
become out-of-date. 16
apply plugin: 'groovy' dependencies { compile gradleApi() compile localGroovy() }
17 Default build.gradle
Writin a Plugin 3
Hands On 19
Thanks! Any questions? ◇ https://github.com/xgouchet/RockTheGradle ◇ @xgouchet 20