Slide 1

Slide 1 text

Rock the Gradle Rule the world

Slide 2

Slide 2 text

About… Lead Android Engineer at WorkWell Fluent in Android since Cupcake 2

Slide 3

Slide 3 text

A brief introduction 1

Slide 4

Slide 4 text

Dependency Management System What is Gradle General Purpose Build management 4

Slide 5

Slide 5 text

5 General purpose Language agnostic Feature agnostic

Slide 6

Slide 6 text

6 Dependency management system Knows how to graph and resolve dependencies ◇ code ◇ tasks ◇ …

Slide 7

Slide 7 text

7 Build management Based on tasks created by plugins

Slide 8

Slide 8 text

Configuration Gradle flow Initialisation Execution 8

Slide 9

Slide 9 text

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

Slide 10

Slide 10 text

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

Slide 11

Slide 11 text

11 Execution List the Task to run based on the invocation (and their dependencies) Execute each of the tasks

Slide 12

Slide 12 text

Meet the buildSrc folder 2

Slide 13

Slide 13 text

Project structure ┬ MyProject ├┬ app/ │├── src/ │└── build.gradle ├┬ buildSrc/ │├── src/ │├── build.gradle │└── settings.gradle ├─ build.gradle └─ settings.gradle 13

Slide 14

Slide 14 text

Purposes… ◇ Better dependency management ◇ Helper classes / methods ◇ Custom tasks in dedicated classes ◇ Custom plugin ■ Locally versionned with the project 14

Slide 15

Slide 15 text

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

Slide 16

Slide 16 text

“ A change in buildSrc causes the whole project to become out-of-date. 16

Slide 17

Slide 17 text

apply plugin: 'groovy' dependencies { compile gradleApi() compile localGroovy() } 17 Default build.gradle

Slide 18

Slide 18 text

Writin a Plugin 3

Slide 19

Slide 19 text

Hands On 19

Slide 20

Slide 20 text

Thanks! Any questions? ◇ https://github.com/xgouchet/RockTheGradle ◇ @xgouchet 20