Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Rock the Gradle, Rule the World

Rock the Gradle, Rule the World

Xavier Gouchet

April 01, 2019
Tweet

More Decks by Xavier Gouchet

Other Decks in Programming

Transcript

  1. 6 Dependency management system Knows how to graph and resolve

    dependencies ◇ code ◇ tasks ◇ …
  2. 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
  3. 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
  4. 11 Execution List the Task to run based on the

    invocation (and their dependencies) Execute each of the tasks
  5. Project structure ┬ MyProject ├┬ app/ │├── src/ │└── build.gradle

    ├┬ buildSrc/ │├── src/ │├── build.gradle │└── settings.gradle ├─ build.gradle └─ settings.gradle 13
  6. Purposes… ◇ Better dependency management ◇ Helper classes / methods

    ◇ Custom tasks in dedicated classes ◇ Custom plugin ■ Locally versionned with the project 14
  7. 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