Browse Source

Migrate to com.gradle.develocity plugin

Closes gh-40153
3.1.x
Andy Wilkinson 2 years ago
parent
commit
83f692237d
  1. 20
      .github/actions/build/action.yml
  2. 4
      .github/workflows/build-and-deploy-snapshot.yml
  3. 4
      .github/workflows/ci.yml
  4. 4
      .github/workflows/release.yml
  5. 2
      buildSrc/build.gradle
  6. 14
      buildSrc/src/main/java/org/springframework/boot/build/JavaConventions.java
  7. 2
      buildSrc/src/test/java/org/springframework/boot/build/ConventionsPluginTests.java
  8. 6
      settings.gradle
  9. 6
      spring-boot-project/spring-boot-actuator-autoconfigure/build.gradle
  10. 8
      spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-junit-vintage/build.gradle

20
.github/actions/build/action.yml

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

4
.github/workflows/build-and-deploy-snapshot.yml

@ -17,9 +17,7 @@ jobs: @@ -17,9 +17,7 @@ jobs:
id: build-and-publish
uses: ./.github/actions/build
with:
gradle-enterprise-secret-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 }}
develocity-access-key: ${{ secrets.GRADLE_ENTERPRISE_SECRET_ACCESS_KEY }}
publish: true
- name: Deploy
uses: spring-io/artifactory-deploy-action@26bbe925a75f4f863e1e529e85be2d0093cac116 # v0.0.1

4
.github/workflows/ci.yml

@ -42,9 +42,7 @@ jobs: @@ -42,9 +42,7 @@ jobs:
with:
java-version: ${{ matrix.java.version }}
java-toolchain: ${{ matrix.java.toolchain }}
gradle-enterprise-secret-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 }}
develocity-access-key: ${{ secrets.GRADLE_ENTERPRISE_SECRET_ACCESS_KEY }}
- name: Send Notification
uses: ./.github/actions/send-notification
if: always()

4
.github/workflows/release.yml

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

2
buildSrc/build.gradle

@ -41,7 +41,7 @@ dependencies { @@ -41,7 +41,7 @@ dependencies {
implementation(platform("org.springframework:spring-framework-bom:${versions.springFramework}"))
implementation("com.diffplug.gradle:goomph:3.37.2")
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("commons-codec:commons-codec:${versions.commonsCodec}")
implementation("de.undercouch.download:de.undercouch.download.gradle.plugin:5.5.0")

14
buildSrc/src/main/java/org/springframework/boot/build/JavaConventions.java

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

2
buildSrc/src/test/java/org/springframework/boot/build/ConventionsPluginTests.java

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

6
settings.gradle

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

6
spring-boot-project/spring-boot-actuator-autoconfigure/build.gradle

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

8
spring-boot-tests/spring-boot-smoke-tests/spring-boot-smoke-test-junit-vintage/build.gradle

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

Loading…
Cancel
Save