BuildlessExtensionAPI

This interface, along with nested types, defines the public API surface for the Buildless plugin for Gradle. Developers may customize their remote cache use via methods and fields defined herein.

While Buildless may be used directly as a drop-in Gradle remote cache, the plugin surfaces additional configuration and optimizations which are out-of-reach without custom code.

Using the plugin

To use Buildless from a Gradle build, the plugin must be applied at settings time, from settings.gradle.kts (or the Groovy equivalent):

plugins {
id("build.less")
}

buildless {
// settings go here
}

The above is all that is needed in many cases to install and use Buildless as a remote cache. This loads the user's API key from any of the following sources:

  • Environment variables (BUILDLESS_API_KEY, GRADLE_CACHE_PASSWORD)

  • System properties (buildless.apiKey, cachePassword)

  • Local file (.buildless.toml, .github/buildless.toml, .buildless/config.toml, package.json:buildcache)

  • User-level configuration file (~/.config/buildless.toml, ~/.buildless/config.toml)

So long as an API key is present, the above settings.gradle.kts code sample is sufficient to configure remote build caching within a Gradle build.

Applying Gradle cache settings

If the settings.gradle.kts file where this plug-in is applied also performs its own configuration of Gradle's build cache, it will prevail over this plug-in and no action is taken.

If the developer wishes to configure Gradle's build caching features all in one go, they may do so via the local and remote cache settings provided by this plugin (i.e, no further configuration is required).

Parameters

Target

Target type context within which this extension is used.

Settings

Settings context, within which plug-in configuration runs.

Inheritors

Types

Link copied to clipboard
interface CacheSettings

Describes generic cache settings which apply to all types of caches; see LocalCacheSettings and RemoteCacheSettings for further information.

Properties

Link copied to clipboard

Specifies agent cache settings for this Gradle project. Agent caching keeps built outputs within a local cache service, like Buildless Agent. Agent caching is enabled by default if an API key is present in the local environment, using the main Gradle cache endpoint.

Link copied to clipboard
abstract val apiKey: Property<ApiKey?>

API key that should be used to identify this project to the Buildless cache service.

Link copied to clipboard

Specifies remote cache settings for this Gradle project. Remote caching keeps built outputs within a remote cache service, like Buildless. Remote caching is enabled by default if an API key is present in the local environment, using the main Gradle cache endpoint.

Link copied to clipboard
abstract override val debug: Property<Boolean>

Specifies whether "debug mode" is active within the Buildless plugin. When debug mode is active, verbose logging is emitted to the terminal, and various trace values are sent to the Buildless API, which can be used to diagnose issues with the cache from the web dashboard.

Link copied to clipboard

Specifies local cache settings for this Gradle project. Local caching keeps various cached objects in a directory on-disk, and objects never leave the developer's machine. Local caching is enabled by default, and generally it is recommended to keep it active.

Link copied to clipboard

Alias for local cache settings.

Link copied to clipboard

Alias for cloud remote cache settings.

Link copied to clipboard
abstract val reportErrors: Property<Boolean>

Specifies whether errors should be reported to the Buildless API. When error reporting is active, errors which are encountered when interacting with the cache are reported to a central service. These logs include only the authorization material provided by the developer, along with light context from the Gradle build.

Link copied to clipboard
abstract val telemetry: Property<Boolean>

Whether to enable telemetry for this build.

Link copied to clipboard
abstract val transport: Property<CacheTransport>

Transport mechanism to use when interacting with the Buildless cache.

Functions

Link copied to clipboard
abstract fun agent(config: MutableAgentCacheSettings.() -> Unit)

Configure agent caching settings with the provided config function.

Link copied to clipboard
open fun apiKey(key: ApiKey)

Set the API key to use when interacting with the Buildless service.

open fun apiKey(value: String)

Set the API key from the provided string value.

Link copied to clipboard
abstract fun config(context: Target, configure: Settings.() -> Unit)

Main configuration entrypoint for the extension implementing this interface; not meant to be used by end-user code.

Link copied to clipboard
abstract fun localCache(config: MutableLocalCacheSettings.() -> Unit)

Configure local caching settings with the provided config function.

Link copied to clipboard
abstract fun remoteCache(config: MutableRemoteCacheSettings.() -> Unit)

Configure remote caching settings with the provided config function.