mirror of
https://github.com/spring-projects/spring-boot.git
synced 2026-10-07 09:49:39 +00:00
Include checking of AutoConfigure….imports in check lifecycle
See gh-47322
This commit is contained in:
+16
-10
@@ -22,6 +22,8 @@ import org.gradle.api.file.ConfigurableFileCollection;
|
||||
import org.gradle.api.plugins.JavaPlugin;
|
||||
import org.gradle.api.plugins.JavaPluginExtension;
|
||||
import org.gradle.api.tasks.SourceSet;
|
||||
import org.gradle.api.tasks.TaskProvider;
|
||||
import org.gradle.language.base.plugins.LifecycleBasePlugin;
|
||||
|
||||
/**
|
||||
* {@link Plugin} for projects that define test auto-configuration. When the
|
||||
@@ -39,16 +41,20 @@ public class TestAutoConfigurationPlugin implements Plugin<Project> {
|
||||
@Override
|
||||
public void apply(Project target) {
|
||||
target.getPlugins().withType(JavaPlugin.class, (plugin) -> {
|
||||
target.getTasks().register("checkAutoConfigureImports", CheckAutoConfigureImports.class, (task) -> {
|
||||
SourceSet mainSourceSet = target.getExtensions()
|
||||
.getByType(JavaPluginExtension.class)
|
||||
.getSourceSets()
|
||||
.getByName(SourceSet.MAIN_SOURCE_SET_NAME);
|
||||
task.setSource(mainSourceSet.getResources());
|
||||
ConfigurableFileCollection classpath = target.files(mainSourceSet.getRuntimeClasspath(),
|
||||
target.getConfigurations().getByName(mainSourceSet.getRuntimeClasspathConfigurationName()));
|
||||
task.setClasspath(classpath);
|
||||
});
|
||||
TaskProvider<CheckAutoConfigureImports> checkAutoConfigureImports = target.getTasks()
|
||||
.register("checkAutoConfigureImports", CheckAutoConfigureImports.class, (task) -> {
|
||||
SourceSet mainSourceSet = target.getExtensions()
|
||||
.getByType(JavaPluginExtension.class)
|
||||
.getSourceSets()
|
||||
.getByName(SourceSet.MAIN_SOURCE_SET_NAME);
|
||||
task.setSource(mainSourceSet.getResources());
|
||||
ConfigurableFileCollection classpath = target.files(mainSourceSet.getRuntimeClasspath(),
|
||||
target.getConfigurations().getByName(mainSourceSet.getRuntimeClasspathConfigurationName()));
|
||||
task.setClasspath(classpath);
|
||||
});
|
||||
target.getTasks()
|
||||
.named(LifecycleBasePlugin.CHECK_TASK_NAME)
|
||||
.configure((check) -> check.dependsOn(checkAutoConfigureImports));
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -16,9 +16,9 @@
|
||||
|
||||
package org.springframework.boot.security.test.autoconfigure.webflux;
|
||||
|
||||
import org.springframework.boot.autoconfigure.AutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.security.test.web.reactive.server.SecurityMockServerConfigurers;
|
||||
import org.springframework.test.web.reactive.server.MockServerConfigurer;
|
||||
import org.springframework.test.web.reactive.server.WebTestClient;
|
||||
@@ -29,7 +29,7 @@ import org.springframework.test.web.reactive.server.WebTestClient;
|
||||
* @author Madhura Bhave
|
||||
* @since 4.0.0
|
||||
*/
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
@AutoConfiguration
|
||||
@ConditionalOnClass(SecurityMockServerConfigurers.class)
|
||||
public final class SecurityWebTestClientAutoConfiguration {
|
||||
|
||||
|
||||
-1
@@ -1 +0,0 @@
|
||||
org.springframework.boot.testrestclient.autoconfigure.RestTestClientAutoConfiguration
|
||||
Reference in New Issue
Block a user