Gradle - build automation tool

Realize Build Happiness

Agenda

Short intro - why Gradle?

Because gradle is awesome :).

Note Quick show-of of how I use gradle.

Let’s go

Here you have to do stuff.

Install Gradle

Simplest way to use Gradle is by using the gradle-wrapper.

Gradle wrapper is a shell script that downloads Gradle for you.

  git clone https://github.com/ieugen/gradle-intro.git
  ./gradlew
  ./gradlew tasks
Note For faster Gradle build you might wish to enable gradle build daemon.

Running tasks

Most of the time you will run tasks. .Simple tasks

  ./gradlew tasks
  ./gradlew projects
  ./gradlew tasks --info
  ./gradlew :tasks
  ./gradlew -q :tasks
  ./gradlew -b exercises/001-hello-world.gradle -q hello
Note Examine output with and without -q, --info --debug .

Gradle build phases

There are 3 build phases
Initialization

determines which projects are going to take part in the build

Configuration

Project objects are configured (task configuration block are executed)

Execution

Gradle determines the subset of the tasks, created and configured during the configuration phase, to be executed.

Note Because the Tasks to run are determined dynamic, Gradle is very flexible.

Create your first project

  mkdir sandbox && cd sandbox
  ../gradlew init --type basic
  ./gradlew tasks
Note You don’t need gradle to do that, but it is good to use is since you get the gradle wrapper.

Write tasks

See exercises.

Questions ?

Thank you for you time.

References