Skip to content

Library of adapter classes for smooth interaction with the API of "Gradle Enterprise" and "Develocity" plugin/extension.

License

Notifications You must be signed in to change notification settings

gradle/develocity-agent-adapters

Folders and files

NameName
Last commit message
Last commit date
Nov 15, 2024
Jan 28, 2025
Oct 28, 2024
Jan 15, 2025
Oct 28, 2024
Feb 24, 2025
Mar 18, 2024
Mar 18, 2024
Mar 14, 2024
Aug 14, 2024
Mar 14, 2024
Aug 2, 2024
Dec 22, 2024
Oct 11, 2024
Feb 19, 2025

Develocity Plugin/Extension Adapters

Starting with versions 3.17 and 1.21 respectively, the Gradle Enterprise Gradle plugin and Maven extension are available under the “Develocity” brand. Several core functionalities have been deprecated with the rebranding. This repository provides adapter classes for both versions of the API to enable a smooth upgrade to the new API and support developers in providing compatibility with both “Gradle Enterprise” and “Develocity” plugins/extensions.

Adapters

All adapters are located in the com.gradle.develocity.agent.(gradle|maven).adapters. See the in-code documentation for the corresponding Gradle plugin or Maven extension classes.

Usage

Gradle
implementation("com.gradle:develocity-gradle-plugin-adapters:1.0.2")
Maven
<dependency>
    <groupId>com.gradle</groupId>
    <artifactId>develocity-maven-extension-adapters</artifactId>
    <version>1.0</version>
</dependency>

Example

In the following, we illustrate how a plugin developer can configure conditional Build Scan publication with and without adapter layer.

Without adapters
// configure conditional publication for the Develocity plugin
DevelocityConfiguration develocity = settings.getExtensions().getByType(DevelocityConfiguration.class);
develocity.getBuildScan().publishing(p -> p.onlyIf(ctx -> Boolean.getBoolean("publish")));

// configure conditional publication for Gradle Enterprise plugin
GradleEnterpriseExtension gradleEnterprise = settings.getExtensions().getByType(GradleEnterpriseExtension.class);
gradleEnterprise.getBuildScan().publishAlwaysIf(Boolean.getBoolean("publish"));
With adapters
// configure conditional publication using the unified API
private static void publishConditionally(DevelocityAdapter develocity) {
    develocity.getBuildScan().publishAlwaysIf(Boolean.getBoolean("publish"));
}

Object develocity = settings.getExtensions().getByName("develocity");
publishConditionally(new DevelocityConfigurationAdapter(develocity));

Object gradleEnterprise = settings.getExtensions().getByName("gradleEnterprise");
publishConditionally(new GradleEnterpriseExtensionAdapter(gradleEnterprise));

About

Library of adapter classes for smooth interaction with the API of "Gradle Enterprise" and "Develocity" plugin/extension.

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Packages

No packages published