Upgrade to Gradle Enterprise Gradle Plugin 3.12.1

Closes gh-33672
This commit is contained in:
Andy Wilkinson
2023-01-03 15:55:07 +00:00
parent 68531bfba9
commit 84c021bc97
4 changed files with 16 additions and 22 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2022 the original author or authors.
* Copyright 2012-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -24,6 +24,7 @@ import java.util.Set;
import java.util.TreeMap;
import java.util.stream.Collectors;
import com.gradle.enterprise.gradleplugin.testretry.TestRetryExtension;
import io.spring.javaformat.gradle.SpringJavaFormatPlugin;
import io.spring.javaformat.gradle.tasks.CheckFormat;
import io.spring.javaformat.gradle.tasks.Format;
@@ -45,8 +46,6 @@ import org.gradle.api.tasks.bundling.Jar;
import org.gradle.api.tasks.compile.JavaCompile;
import org.gradle.api.tasks.javadoc.Javadoc;
import org.gradle.api.tasks.testing.Test;
import org.gradle.testretry.TestRetryPlugin;
import org.gradle.testretry.TestRetryTaskExtension;
import org.springframework.boot.build.architecture.ArchitecturePlugin;
import org.springframework.boot.build.classpath.CheckClasspathForProhibitedDependencies;
@@ -163,16 +162,12 @@ class JavaConventions {
test.setMaxHeapSize("1024M");
project.getTasks().withType(Checkstyle.class, test::mustRunAfter);
project.getTasks().withType(CheckFormat.class, test::mustRunAfter);
TestRetryExtension testRetry = test.getExtensions().getByType(TestRetryExtension.class);
testRetry.getFailOnPassedAfterRetry().set(true);
testRetry.getMaxRetries().set(isCi() ? 3 : 0);
});
project.getPlugins().withType(JavaPlugin.class, (javaPlugin) -> project.getDependencies()
.add(JavaPlugin.TEST_RUNTIME_ONLY_CONFIGURATION_NAME, "org.junit.platform:junit-platform-launcher"));
project.getPlugins().apply(TestRetryPlugin.class);
project.getTasks().withType(Test.class,
(test) -> project.getPlugins().withType(TestRetryPlugin.class, (testRetryPlugin) -> {
TestRetryTaskExtension testRetry = test.getExtensions().getByType(TestRetryTaskExtension.class);
testRetry.getFailOnPassedAfterRetry().set(true);
testRetry.getMaxRetries().set(isCi() ? 3 : 0);
}));
}
private boolean isCi() {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2022 the original author or authors.
* Copyright 2012-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -54,6 +54,9 @@ class ConventionsPluginTests {
this.buildFile = new File(this.projectDir, "build.gradle");
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("}");
out.println("include ':spring-boot-project:spring-boot-parent'");
}
File springBootParent = new File(this.projectDir, "spring-boot-project/spring-boot-parent/build.gradle");
@@ -175,8 +178,7 @@ class ConventionsPluginTests {
out.println("description 'Test'");
out.println("task retryConfig {");
out.println(" doLast {");
out.println(" println \"Retry plugin applied: ${plugins.hasPlugin('org.gradle.test-retry')}\"");
out.println(" test.retry {");
out.println(" test.retry {");
out.println(" println \"maxRetries: ${maxRetries.get()}\"");
out.println(" println \"failOnPassedAfterRetry: ${failOnPassedAfterRetry.get()}\"");
out.println(" }");
@@ -184,8 +186,7 @@ class ConventionsPluginTests {
out.println("}");
}
assertThat(runGradle(Collections.singletonMap("CI", "true"), "retryConfig", "--stacktrace").getOutput())
.contains("Retry plugin applied: true").contains("maxRetries: 3")
.contains("failOnPassedAfterRetry: true");
.contains("maxRetries: 3").contains("failOnPassedAfterRetry: true");
}
@Test
@@ -198,8 +199,7 @@ class ConventionsPluginTests {
out.println("description 'Test'");
out.println("task retryConfig {");
out.println(" doLast {");
out.println(" println \"Retry plugin applied: ${plugins.hasPlugin('org.gradle.test-retry')}\"");
out.println(" test.retry {");
out.println(" test.retry {");
out.println(" println \"maxRetries: ${maxRetries.get()}\"");
out.println(" println \"failOnPassedAfterRetry: ${failOnPassedAfterRetry.get()}\"");
out.println(" }");
@@ -207,8 +207,7 @@ class ConventionsPluginTests {
out.println("}");
}
assertThat(runGradle(Collections.singletonMap("CI", "local"), "retryConfig", "--stacktrace").getOutput())
.contains("Retry plugin applied: true").contains("maxRetries: 0")
.contains("failOnPassedAfterRetry: true");
.contains("maxRetries: 0").contains("failOnPassedAfterRetry: true");
}
private BuildResult runGradle(String... args) {