gradle build automation tool

18
Gradle build automation tool BJUG #27, november 2014 Ioan Eugen Stan

Upload: ioan-stan

Post on 13-Jul-2015

179 views

Category:

Software


3 download

TRANSCRIPT

Page 1: Gradle   build automation tool

Gradlebuild automation tool

BJUG #27, november 2014Ioan Eugen Stan

Page 2: Gradle   build automation tool

About me

● independent IT Consultant (Java, Architecture)● Open Source Hacker● Web: http://ieugen.ro/● http://github.com/ieugen● @ieugen222Code: https://github.com/ieugen/bjug27-gradle-intro

Page 3: Gradle   build automation tool

Software development = creativity + lots of

repetive tasks

Page 4: Gradle   build automation tool

We hate repetitive tasks !!

Page 5: Gradle   build automation tool

We invented build tools ;)

Page 6: Gradle   build automation tool

A bit of build tool history

● shell scripts● simple tools: make, ant, etc ● tools with lifecycle: maven, gradle, etc.

Page 7: Gradle   build automation tool

Apache Ant

● like make, java oriented, multi-platform● has limited assumptions of build

environment● very flexible● imperative (no conventions)● lots of repetition● complex builds are hard to maintain● xml based configuration file

Page 8: Gradle   build automation tool

Apache Maven

● opinionated about the build lifecycle● introduced Convention over Configuration● strict lifecycle● java centric● limited flexibility in configuration● xml based configuration

Page 9: Gradle   build automation tool

Gradle● gradle uses build scripts: build.gradle● every build is a Groovy script● embraces Convention over Configuration and Don’t

Repeat Yourself● (almost) everything is convention and can be changed● creates a dynamic model of the workflow as a Directed

Acyclic Graph ~ DAG

Page 10: Gradle   build automation tool

Gradle features● declarative builds and build-by-convention● DSL for dependency based programming● structures your build● multi-project builds● gradle wrapper● build daemon - speeds build● many ways to manage dependencies● free and open-source

Page 11: Gradle   build automation tool

Maven build lifecycle - very strict

http://opensourceforgeeks.blogspot.ro/2014/01/building-java-projects-with-maven.html

Page 12: Gradle   build automation tool

Gradle build lifecycle

● Initialization○ identifies project to build○ creates Project instance

● Configuration○ executes buildscript{} for all its scope○ configures the project objects

● Execution○ creates the Task DAG○ runs the build

Page 13: Gradle   build automation tool

Task graphs (DAGs) java-plugin

Page 14: Gradle   build automation tool

Gradle Task

● single atomic piece of work for a build● belongs to a project● has properties● has a list of Actions

Invocation: gradle taskName

Page 15: Gradle   build automation tool

Dependencies code + demo

Page 16: Gradle   build automation tool

Build Daemoncode + demo

Page 18: Gradle   build automation tool

References● Code: https://github.com/ieugen/bjug27-gradle-intro● UserGuide http://www.gradle.org/docs/current/userguide/userguide.html● DSL Reference http://www.gradle.org/docs/current/dsl/● Rocking the Gradle https://www.youtube.com/watch?v=5a91dBLX8Qc● Gradle intro https://www.youtube.com/watch?v=hvMKpQqo2ts