mirror of
https://github.com/spring-projects/spring-boot.git
synced 2024-08-29 03:06:45 +08:00
Order test tasks to run after Checkstyle and formatting checks
Closes gh-26284
This commit is contained in:
parent
ef5fbb0669
commit
3cc1ed28ca
@ -31,6 +31,7 @@ import java.util.TreeMap;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import io.spring.javaformat.gradle.CheckTask;
|
||||
import io.spring.javaformat.gradle.FormatTask;
|
||||
import io.spring.javaformat.gradle.SpringJavaFormatPlugin;
|
||||
import org.gradle.api.Action;
|
||||
@ -43,6 +44,7 @@ import org.gradle.api.artifacts.Dependency;
|
||||
import org.gradle.api.artifacts.DependencySet;
|
||||
import org.gradle.api.plugins.JavaBasePlugin;
|
||||
import org.gradle.api.plugins.JavaPlugin;
|
||||
import org.gradle.api.plugins.quality.Checkstyle;
|
||||
import org.gradle.api.plugins.quality.CheckstyleExtension;
|
||||
import org.gradle.api.plugins.quality.CheckstylePlugin;
|
||||
import org.gradle.api.tasks.SourceSet;
|
||||
@ -66,7 +68,12 @@ import org.springframework.boot.build.testing.TestFailuresPlugin;
|
||||
* <li>{@link SpringJavaFormatPlugin Spring Java Format}, {@link CheckstylePlugin
|
||||
* Checkstyle}, {@link TestFailuresPlugin Test Failures}, and {@link TestRetryPlugin Test
|
||||
* Retry} plugins are applied
|
||||
* <li>{@link Test} tasks are configured to use JUnit Platform and use a max heap of 1024M
|
||||
* <li>{@link Test} tasks are configured:
|
||||
* <ul>
|
||||
* <li>to use JUnit Platform
|
||||
* <li>with a max heap of 1024M
|
||||
* <li>to run after any Checkstyle and format checking tasks
|
||||
* </ul>
|
||||
* <li>A {@code testRuntimeOnly} dependency upon
|
||||
* {@code org.junit.platform:junit-platform-launcher} is added to projects with the
|
||||
* {@link JavaPlugin} applied
|
||||
@ -156,6 +163,8 @@ class JavaConventions {
|
||||
"file:" + test.getWorkingDir().toPath().relativize(copyJdk8156584SecurityProperties.output));
|
||||
test.doFirst(copyJdk8156584SecurityProperties);
|
||||
}
|
||||
project.getTasks().withType(Checkstyle.class, (checkstyle) -> test.mustRunAfter(checkstyle));
|
||||
project.getTasks().withType(CheckTask.class, (checkFormat) -> test.mustRunAfter(checkFormat));
|
||||
});
|
||||
project.getPlugins().withType(JavaPlugin.class, (javaPlugin) -> project.getDependencies()
|
||||
.add(JavaPlugin.TEST_RUNTIME_ONLY_CONFIGURATION_NAME, "org.junit.platform:junit-platform-launcher"));
|
||||
|
Loading…
Reference in New Issue
Block a user