Writing Gradle build scripts

Table of Contents

Build Script Basics
Projects and tasks
Hello world
A shortcut task definition
Build scripts are code
Task dependencies
Dynamic tasks
Manipulating existing tasks
Shortcut notations
Extra task properties
Using Ant Tasks
Using methods
Default tasks
Configure by DAG
External dependencies for the build script
Where to next?
Build Init Plugin
Tasks
What to set up
Build init types
Writing Build Scripts
The Gradle build language
The Project API
The Script API
Declaring variables
Configuring arbitrary objects
Configuring arbitrary objects using an external script
Some Groovy basics
Default imports
Authoring Tasks
Task outcomes
Defining tasks
Locating tasks
Configuring tasks
Passing arguments to a task constructor
Adding dependencies to a task
Ordering tasks
Adding a description to a task
Replacing tasks
Skipping tasks
Up-to-date checks (AKA Incremental Build)
Task rules
Finalizer tasks
Lifecycle tasks
Summary
Working With Files
Copying a single file
Copying multiple files
Copying directory hierarchies
Creating archives (zip, tar, etc.)
Unpacking archives
Creating "uber" or "fat" JARs
Creating directories
Moving files and directories
Renaming files on copy
Deleting files and directories
File paths in depth
File copying in depth
Archive creation in depth
Using Ant from Gradle
Using Ant tasks and types in your build
Importing an Ant build
Ant properties and references
Ant logging
API
Build Lifecycle
Build phases
Settings file
Multi-project builds
Initialization
Configuration and execution of a single project build
Responding to the lifecycle in the build script
Logging
Choosing a log level
Writing your own log messages
Logging from external tools and libraries
Changing what Gradle logs
Authoring Multi-Project Builds
Cross project configuration
Subproject configuration
Execution rules for multi-project builds
Running tasks by their absolute path
Project and task paths
Dependencies - Which dependencies?
Project lib dependencies
Depending on the task output produced by another project
Parallel project execution
Decoupled Projects
Multi-Project Building and Testing
Multi Project and buildSrc
Using Gradle Plugins
What plugins do
Types of plugins
Using plugins
Script plugins
Binary plugins
Finding community plugins
More on plugins
Standard Gradle plugins
Language plugins
Incubating language plugins
Integration plugins
Incubating integration plugins
Software development plugins
Incubating software development plugins
Base plugins
Third party plugins
The Project Report Plugin
Usage
Tasks
Project layout
Dependency management
Convention properties
The Build Dashboard Plugin
Usage
Tasks
Project layout
Dependency management
Configuration
Comparing Builds
Definition of terms
Current Capabilities
Comparing Gradle Builds
Publishing artifacts
Introduction
Artifacts and configurations
Declaring artifacts
Publishing artifacts
More about project libraries
Maven Plugin
Usage
Tasks
Dependency management
Convention properties
Convention methods
Interacting with Maven repositories
The Signing Plugin
Usage
Signatory credentials
Using gpg-agent
Specifying what to sign
Publishing the signatures
Signing POM files
Ivy Publish Plugin
Usage
Publications
Repositories
Performing a publish
Generating the Ivy module descriptor file without publishing
Complete example
Maven Publish Plugin
Usage
Publications
Repositories
Performing a publish
Publishing to Maven Local
Conditional publishing
Signing artifacts
Generating the POM file without publishing
Complete example
Removal of deferred configuration behavior
The Distribution Plugin
Usage
Tasks
Distribution contents
Publishing
The Announce Plugin
Usage
Configuration
The Build Announcements Plugin
Usage