Migrate to com.gradle.develocity plugin

Closes gh-40153
This commit is contained in:
Andy Wilkinson 2024-04-26 09:04:20 +01:00
parent 27418edeb0
commit 83f692237d
10 changed files with 30 additions and 40 deletions

View File

@ -13,15 +13,9 @@ inputs:
required: false required: false
default: false default: false
description: 'Whether to publish artifacts ready for deployment to Artifactory' description: 'Whether to publish artifacts ready for deployment to Artifactory'
gradle-enterprise-secret-access-key: develocity-access-key:
required: false required: false
description: 'The secret access key for authentication with ge.spring.io' description: 'The access key for authentication with ge.spring.io'
gradle-enterprise-cache-user:
required: false
description: 'The username for authentication with the remote build cache'
gradle-enterprise-cache-password:
required: false
description: 'The password for authentication with the remote build cache'
outputs: outputs:
build-scan-url: build-scan-url:
description: 'The URL, if any, of the build scan produced by the build' description: 'The URL, if any, of the build scan produced by the build'
@ -42,20 +36,14 @@ runs:
if: ${{ !inputs.publish }} if: ${{ !inputs.publish }}
shell: bash shell: bash
env: env:
GRADLE_ENTERPRISE_URL: 'https://ge.spring.io' DEVELOCITY_ACCESS_KEY: ${{ inputs.develocity-access-key }}
GRADLE_ENTERPRISE_ACCESS_KEY: ${{ inputs.gradle-enterprise-secret-access-key }}
GRADLE_ENTERPRISE_CACHE_USERNAME: ${{ inputs.gradle-enterprise-cache-user }}
GRADLE_ENTERPRISE_CACHE_PASSWORD: ${{ inputs.gradle-enterprise-cache-password }}
run: ./gradlew build run: ./gradlew build
- name: Build and Publish - name: Build and Publish
id: build-and-publish id: build-and-publish
if: ${{ inputs.publish }} if: ${{ inputs.publish }}
shell: bash shell: bash
env: env:
GRADLE_ENTERPRISE_URL: 'https://ge.spring.io' DEVELOCITY_ACCESS_KEY: ${{ inputs.develocity-access-key }}
GRADLE_ENTERPRISE_ACCESS_KEY: ${{ inputs.gradle-enterprise-secret-access-key }}
GRADLE_ENTERPRISE_CACHE_USERNAME: ${{ inputs.gradle-enterprise-cache-user }}
GRADLE_ENTERPRISE_CACHE_PASSWORD: ${{ inputs.gradle-enterprise-cache-password }}
run: ./gradlew -PdeploymentRepository=$(pwd)/deployment-repository build publishAllPublicationsToDeploymentRepository run: ./gradlew -PdeploymentRepository=$(pwd)/deployment-repository build publishAllPublicationsToDeploymentRepository
- name: Read Version From gradle.properties - name: Read Version From gradle.properties
id: read-version id: read-version

View File

@ -17,9 +17,7 @@ jobs:
id: build-and-publish id: build-and-publish
uses: ./.github/actions/build uses: ./.github/actions/build
with: with:
gradle-enterprise-secret-access-key: ${{ secrets.GRADLE_ENTERPRISE_SECRET_ACCESS_KEY }} develocity-access-key: ${{ secrets.GRADLE_ENTERPRISE_SECRET_ACCESS_KEY }}
gradle-enterprise-cache-user: ${{ secrets.GRADLE_ENTERPRISE_CACHE_USER }}
gradle-enterprise-cache-password: ${{ secrets.GRADLE_ENTERPRISE_CACHE_PASSWORD }}
publish: true publish: true
- name: Deploy - name: Deploy
uses: spring-io/artifactory-deploy-action@26bbe925a75f4f863e1e529e85be2d0093cac116 # v0.0.1 uses: spring-io/artifactory-deploy-action@26bbe925a75f4f863e1e529e85be2d0093cac116 # v0.0.1

View File

@ -42,9 +42,7 @@ jobs:
with: with:
java-version: ${{ matrix.java.version }} java-version: ${{ matrix.java.version }}
java-toolchain: ${{ matrix.java.toolchain }} java-toolchain: ${{ matrix.java.toolchain }}
gradle-enterprise-secret-access-key: ${{ secrets.GRADLE_ENTERPRISE_SECRET_ACCESS_KEY }} develocity-access-key: ${{ secrets.GRADLE_ENTERPRISE_SECRET_ACCESS_KEY }}
gradle-enterprise-cache-user: ${{ secrets.GRADLE_ENTERPRISE_CACHE_USER }}
gradle-enterprise-cache-password: ${{ secrets.GRADLE_ENTERPRISE_CACHE_PASSWORD }}
- name: Send Notification - name: Send Notification
uses: ./.github/actions/send-notification uses: ./.github/actions/send-notification
if: always() if: always()

View File

@ -17,9 +17,7 @@ jobs:
id: build-and-publish id: build-and-publish
uses: ./.github/actions/build uses: ./.github/actions/build
with: with:
gradle-enterprise-cache-password: ${{ secrets.GRADLE_ENTERPRISE_CACHE_PASSWORD }} develocity-access-key: ${{ secrets.GRADLE_ENTERPRISE_SECRET_ACCESS_KEY }}
gradle-enterprise-cache-user: ${{ secrets.GRADLE_ENTERPRISE_CACHE_USER }}
gradle-enterprise-secret-access-key: ${{ secrets.GRADLE_ENTERPRISE_SECRET_ACCESS_KEY }}
publish: true publish: true
- name: Stage Release - name: Stage Release
uses: spring-io/artifactory-deploy-action@26bbe925a75f4f863e1e529e85be2d0093cac116 # v0.0.1 uses: spring-io/artifactory-deploy-action@26bbe925a75f4f863e1e529e85be2d0093cac116 # v0.0.1

View File

@ -41,7 +41,7 @@ dependencies {
implementation(platform("org.springframework:spring-framework-bom:${versions.springFramework}")) implementation(platform("org.springframework:spring-framework-bom:${versions.springFramework}"))
implementation("com.diffplug.gradle:goomph:3.37.2") implementation("com.diffplug.gradle:goomph:3.37.2")
implementation("com.fasterxml.jackson.core:jackson-databind:${versions.jackson}") implementation("com.fasterxml.jackson.core:jackson-databind:${versions.jackson}")
implementation("com.gradle:gradle-enterprise-gradle-plugin:3.12.1") implementation("com.gradle:develocity-gradle-plugin:3.17.2")
implementation("com.tngtech.archunit:archunit:1.0.0") implementation("com.tngtech.archunit:archunit:1.0.0")
implementation("commons-codec:commons-codec:${versions.commonsCodec}") implementation("commons-codec:commons-codec:${versions.commonsCodec}")
implementation("de.undercouch.download:de.undercouch.download.gradle.plugin:5.5.0") implementation("de.undercouch.download:de.undercouch.download.gradle.plugin:5.5.0")

View File

@ -24,8 +24,9 @@ import java.util.Set;
import java.util.TreeMap; import java.util.TreeMap;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import com.gradle.enterprise.gradleplugin.testretry.TestRetryExtension; import com.gradle.develocity.agent.gradle.test.DevelocityTestConfiguration;
import com.gradle.enterprise.gradleplugin.testselection.PredictiveTestSelectionExtension; import com.gradle.develocity.agent.gradle.test.PredictiveTestSelectionConfiguration;
import com.gradle.develocity.agent.gradle.test.TestRetryConfiguration;
import io.spring.javaformat.gradle.SpringJavaFormatPlugin; import io.spring.javaformat.gradle.SpringJavaFormatPlugin;
import io.spring.javaformat.gradle.tasks.CheckFormat; import io.spring.javaformat.gradle.tasks.CheckFormat;
import io.spring.javaformat.gradle.tasks.Format; import io.spring.javaformat.gradle.tasks.Format;
@ -178,7 +179,9 @@ class JavaConventions {
} }
private void configureTestRetries(Test test) { private void configureTestRetries(Test test) {
TestRetryExtension testRetry = test.getExtensions().getByType(TestRetryExtension.class); TestRetryConfiguration testRetry = test.getExtensions()
.getByType(DevelocityTestConfiguration.class)
.getTestRetry();
testRetry.getFailOnPassedAfterRetry().set(false); testRetry.getFailOnPassedAfterRetry().set(false);
testRetry.getMaxRetries().set(isCi() ? 3 : 0); testRetry.getMaxRetries().set(isCi() ? 3 : 0);
} }
@ -189,8 +192,9 @@ class JavaConventions {
private void configurePredictiveTestSelection(Test test) { private void configurePredictiveTestSelection(Test test) {
if (isPredictiveTestSelectionEnabled()) { if (isPredictiveTestSelectionEnabled()) {
PredictiveTestSelectionExtension predictiveTestSelection = test.getExtensions() PredictiveTestSelectionConfiguration predictiveTestSelection = test.getExtensions()
.getByType(PredictiveTestSelectionExtension.class); .getByType(DevelocityTestConfiguration.class)
.getPredictiveTestSelection();
predictiveTestSelection.getEnabled().convention(true); predictiveTestSelection.getEnabled().convention(true);
} }
} }

View File

@ -55,7 +55,7 @@ class ConventionsPluginTests {
File settingsFile = new File(this.projectDir, "settings.gradle"); File settingsFile = new File(this.projectDir, "settings.gradle");
try (PrintWriter out = new PrintWriter(new FileWriter(settingsFile))) { try (PrintWriter out = new PrintWriter(new FileWriter(settingsFile))) {
out.println("plugins {"); out.println("plugins {");
out.println(" id 'com.gradle.enterprise'"); out.println(" id 'com.gradle.develocity'");
out.println("}"); out.println("}");
out.println("include ':spring-boot-project:spring-boot-parent'"); out.println("include ':spring-boot-project:spring-boot-parent'");
} }

View File

@ -19,8 +19,8 @@ pluginManagement {
} }
plugins { plugins {
id "com.gradle.enterprise" version "3.15.1" id "com.gradle.develocity" version "3.17.2"
id "io.spring.ge.conventions" version "0.0.16" id "io.spring.ge.conventions" version "0.0.17"
} }
rootProject.name="spring-boot-build" rootProject.name="spring-boot-build"
@ -28,7 +28,7 @@ rootProject.name="spring-boot-build"
enableFeaturePreview("STABLE_CONFIGURATION_CACHE") enableFeaturePreview("STABLE_CONFIGURATION_CACHE")
settings.gradle.projectsLoaded { settings.gradle.projectsLoaded {
gradleEnterprise { develocity {
buildScan { buildScan {
def toolchainVersion = settings.gradle.rootProject.findProperty('toolchainVersion') def toolchainVersion = settings.gradle.rootProject.findProperty('toolchainVersion')
if (toolchainVersion != null) { if (toolchainVersion != null) {

View File

@ -241,8 +241,10 @@ def documentationTest = tasks.register("documentationTest", Test) {
} }
jvmArgs += "--add-opens=java.base/java.net=ALL-UNNAMED" jvmArgs += "--add-opens=java.base/java.net=ALL-UNNAMED"
outputs.dir("${buildDir}/generated-snippets") outputs.dir("${buildDir}/generated-snippets")
predictiveSelection { develocity {
enabled = false predictiveTestSelection {
enabled = false
}
} }
} }

View File

@ -21,9 +21,11 @@ test {
throw new GradleException("No tests were executed") throw new GradleException("No tests were executed")
} }
} }
} }
} }
predictiveSelection { develocity {
enabled = false predictiveTestSelection {
enabled = false
}
} }
} }