Gradle Build Cache Deep Dive

Register now


Get hands-on training on how to tackle build performance issues with the Gradle build cache.

Description

The Gradle build cache significantly reduces build time by reusing outputs produced by other builds in your organization. In this training, you will learn the basics and best practices to make the most of caching in your build. We’ll discuss the different possible architectures, how they affect build performance, and how Develocity can help you manage, analyze, and troubleshoot the build cache.

Duration

2.5 hours training session followed by 30-minutes Q&A.

Audience

Gradle build tool users as well as Develocity users interested in speeding up builds are encouraged to attend the training.

Prerequisites

This course assumes a good understanding of the Java language and working knowledge of Gradle. It is recommended to attend the Introduction to Gradle training class. Preferrably, you also attended the Advanced Gradle Fundamentals for Java/JVM training. Consider watching the Maximizing Developer Productivity with Develocity video to get more familiar with Develocity.

Objectives

After this training the participants will be able to:

  • Understand the benefits of using the Gradle build cache
  • Use and configure the build cache
  • Optimize build logic for maximum cacheability
  • Maximize the benefits of the build cache with Develocity

Course Outline

Overview

  • Performance is key
  • Approaches for work avoidance
  • Common use cases

Recap: Incremental builds

  • How does it work?
  • Execution marker in console
  • Declaring inputs and outputs with annotations
  • Declaring inputs and outputs with runtime API
  • What are the limitations?

What is the build cache?

  • Different types of build caches
  • Local build cache
  • Remote build cache
  • Recommended sharing strategy
  • Faster Gradle builds on CI
  • Influencing factors

Using the build cache

  • Enabling the cache
  • Lab: Using the local build cache
  • Configuring the local build cache
  • Configuring the remote build cache
  • Conditional cache configuration
  • Standardizing build cache configuration
  • Computing the build cache key
  • Build cache operations
  • Lab: Using the remote build cache

What makes a build “cacheable”?

  • Cacheability influencing factors
  • Built-in cacheable tasks
  • Enabling cacheability by annotation
  • Enabling cacheability by runtime API
  • Disabling cacheability by runtime API
  • Lab: Equipping tasks with caching capabilities

Troubleshooting the build cache

  • Possible approaches
  • Info log level console information
  • Debug log level console information
  • Using build scans

Requirements for cacheable tasks

  • Repeatable task outputs
  • Stable task outputs
  • Path sensitivity
  • Input normalization
  • Other aspects
  • Lab: Handling cache misses

Getting started with the build cache

  • Recommended approach
  • Installing the remote build cache
  • Connecting to Develocity

Wrap up

  • Documentation and resources
  • Free Develocity Trial