Polish lambda formatting
This commit is contained in:
parent
7b2b8dc4a3
commit
3a01f4a6da
|
@ -51,7 +51,7 @@ public class AutoConfigurations extends Configurations implements Ordered {
|
||||||
.collect(Collectors.toCollection(ArrayList::new));
|
.collect(Collectors.toCollection(ArrayList::new));
|
||||||
List<String> sorted = SORTER.getInPriorityOrder(names);
|
List<String> sorted = SORTER.getInPriorityOrder(names);
|
||||||
return sorted.stream()
|
return sorted.stream()
|
||||||
.map(className -> ClassUtils.resolveClassName(className, null))
|
.map((className) -> ClassUtils.resolveClassName(className, null))
|
||||||
.collect(Collectors.toCollection(ArrayList::new));
|
.collect(Collectors.toCollection(ArrayList::new));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -136,7 +136,7 @@ public class QuartzAutoConfiguration {
|
||||||
public SchedulerFactoryBeanCustomizer dataSourceCustomizer(
|
public SchedulerFactoryBeanCustomizer dataSourceCustomizer(
|
||||||
QuartzProperties properties, DataSource dataSource,
|
QuartzProperties properties, DataSource dataSource,
|
||||||
ObjectProvider<PlatformTransactionManager> transactionManager) {
|
ObjectProvider<PlatformTransactionManager> transactionManager) {
|
||||||
return schedulerFactoryBean -> {
|
return (schedulerFactoryBean) -> {
|
||||||
if (properties.getJobStoreType() == JobStoreType.JDBC) {
|
if (properties.getJobStoreType() == JobStoreType.JDBC) {
|
||||||
schedulerFactoryBean.setDataSource(dataSource);
|
schedulerFactoryBean.setDataSource(dataSource);
|
||||||
PlatformTransactionManager txManager = transactionManager
|
PlatformTransactionManager txManager = transactionManager
|
||||||
|
|
|
@ -62,7 +62,7 @@ public class WebClientAutoConfiguration {
|
||||||
customizers = new ArrayList<>(customizers);
|
customizers = new ArrayList<>(customizers);
|
||||||
AnnotationAwareOrderComparator.sort(customizers);
|
AnnotationAwareOrderComparator.sort(customizers);
|
||||||
customizers
|
customizers
|
||||||
.forEach(customizer -> customizer.customize(this.webClientBuilder));
|
.forEach((customizer) -> customizer.customize(this.webClientBuilder));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -40,7 +40,7 @@ public class WebClientCodecCustomizer implements WebClientCustomizer {
|
||||||
@Override
|
@Override
|
||||||
public void customize(WebClient.Builder webClientBuilder) {
|
public void customize(WebClient.Builder webClientBuilder) {
|
||||||
webClientBuilder
|
webClientBuilder
|
||||||
.exchangeStrategies(ExchangeStrategies.builder().codecs(codecs -> {
|
.exchangeStrategies(ExchangeStrategies.builder().codecs((codecs) -> {
|
||||||
this.codecCustomizers
|
this.codecCustomizers
|
||||||
.forEach((customizer) -> customizer.customize(codecs));
|
.forEach((customizer) -> customizer.customize(codecs));
|
||||||
}).build());
|
}).build());
|
||||||
|
|
|
@ -646,7 +646,7 @@ public class DefaultServletWebServerFactoryCustomizer
|
||||||
|
|
||||||
private static void customizeAccessLog(JettyServletWebServerFactory factory,
|
private static void customizeAccessLog(JettyServletWebServerFactory factory,
|
||||||
final ServerProperties.Jetty.Accesslog properties) {
|
final ServerProperties.Jetty.Accesslog properties) {
|
||||||
factory.addServerCustomizers(server -> {
|
factory.addServerCustomizers((server) -> {
|
||||||
NCSARequestLog log = new NCSARequestLog();
|
NCSARequestLog log = new NCSARequestLog();
|
||||||
if (properties.getFilename() != null) {
|
if (properties.getFilename() != null) {
|
||||||
log.setFilename(properties.getFilename());
|
log.setFilename(properties.getFilename());
|
||||||
|
|
|
@ -84,7 +84,7 @@ public class WebMvcProperties {
|
||||||
private boolean logResolvedException = false;
|
private boolean logResolvedException = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Maps file extensions to media types for content negotiation, e.g. yml->text/yaml.
|
* Maps file extensions to media types for content negotiation, e.g. yml to text/yaml.
|
||||||
*/
|
*/
|
||||||
private Map<String, MediaType> mediaTypes = new LinkedHashMap<>();
|
private Map<String, MediaType> mediaTypes = new LinkedHashMap<>();
|
||||||
|
|
||||||
|
|
|
@ -66,8 +66,7 @@ public class DataSourceAutoConfigurationTests {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testDefaultDataSourceExists() throws Exception {
|
public void testDefaultDataSourceExists() throws Exception {
|
||||||
this.context
|
this.context.run((loaded) -> assertThat(loaded).hasSingleBean(DataSource.class));
|
||||||
.run((loaded) -> assertThat(loaded).hasSingleBean(DataSource.class));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -110,7 +109,7 @@ public class DataSourceAutoConfigurationTests {
|
||||||
@Test
|
@Test
|
||||||
public void hikariValidatesConnectionByDefault() throws Exception {
|
public void hikariValidatesConnectionByDefault() throws Exception {
|
||||||
assertDataSource(HikariDataSource.class,
|
assertDataSource(HikariDataSource.class,
|
||||||
Collections.singletonList("org.apache.tomcat"), dataSource ->
|
Collections.singletonList("org.apache.tomcat"), (dataSource) ->
|
||||||
// Use Connection#isValid()
|
// Use Connection#isValid()
|
||||||
assertThat(dataSource.getConnectionTestQuery()).isNull());
|
assertThat(dataSource.getConnectionTestQuery()).isNull());
|
||||||
}
|
}
|
||||||
|
|
|
@ -225,7 +225,7 @@ public class ActiveMQAutoConfigurationTests {
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
public ActiveMQConnectionFactoryCustomizer activeMQConnectionFactoryCustomizer() {
|
public ActiveMQConnectionFactoryCustomizer activeMQConnectionFactoryCustomizer() {
|
||||||
return factory -> {
|
return (factory) -> {
|
||||||
factory.setBrokerURL(
|
factory.setBrokerURL(
|
||||||
"vm://localhost?useJmx=false&broker.persistent=false");
|
"vm://localhost?useJmx=false&broker.persistent=false");
|
||||||
factory.setUserName("foobar");
|
factory.setUserName("foobar");
|
||||||
|
|
|
@ -277,7 +277,7 @@ public class ArtemisAutoConfigurationTests {
|
||||||
"spring.artemis.embedded.serverId=93",
|
"spring.artemis.embedded.serverId=93",
|
||||||
// Do not start a specific one
|
// Do not start a specific one
|
||||||
"spring.artemis.embedded.enabled=false")
|
"spring.artemis.embedded.enabled=false")
|
||||||
.run(secondContext -> {
|
.run((secondContext) -> {
|
||||||
DestinationChecker firstChecker = new DestinationChecker(first);
|
DestinationChecker firstChecker = new DestinationChecker(first);
|
||||||
firstChecker.checkQueue("Queue1", true);
|
firstChecker.checkQueue("Queue1", true);
|
||||||
DestinationChecker secondChecker = new DestinationChecker(
|
DestinationChecker secondChecker = new DestinationChecker(
|
||||||
|
|
|
@ -157,7 +157,7 @@ public class MongoReactiveAutoConfigurationTests {
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
public MongoClientSettingsBuilderCustomizer customizer() {
|
public MongoClientSettingsBuilderCustomizer customizer() {
|
||||||
return clientSettingsBuilder -> clientSettingsBuilder
|
return (clientSettingsBuilder) -> clientSettingsBuilder
|
||||||
.applicationName("overridden-name");
|
.applicationName("overridden-name");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -331,7 +331,7 @@ public class QuartzAutoConfigurationTests {
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
public SchedulerFactoryBeanCustomizer customizer() {
|
public SchedulerFactoryBeanCustomizer customizer() {
|
||||||
return schedulerFactoryBean -> schedulerFactoryBean
|
return (schedulerFactoryBean) -> schedulerFactoryBean
|
||||||
.setTaskExecutor(yetAnotherExecutor());
|
.setTaskExecutor(yetAnotherExecutor());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -342,7 +342,7 @@ public class QuartzAutoConfigurationTests {
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
public SchedulerFactoryBeanCustomizer customizer() {
|
public SchedulerFactoryBeanCustomizer customizer() {
|
||||||
return schedulerFactoryBean -> schedulerFactoryBean
|
return (schedulerFactoryBean) -> schedulerFactoryBean
|
||||||
.setSchedulerName("fooScheduler");
|
.setSchedulerName("fooScheduler");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -139,9 +139,9 @@ class WebTestClientContextCustomizer implements ContextCustomizer {
|
||||||
.getBeansOfType(CodecCustomizer.class).values();
|
.getBeansOfType(CodecCustomizer.class).values();
|
||||||
if (!CollectionUtils.isEmpty(codecCustomizers)) {
|
if (!CollectionUtils.isEmpty(codecCustomizers)) {
|
||||||
clientBuilder.exchangeStrategies(
|
clientBuilder.exchangeStrategies(
|
||||||
ExchangeStrategies.builder().codecs(codecs -> {
|
ExchangeStrategies.builder().codecs((codecs) -> {
|
||||||
codecCustomizers.forEach(
|
codecCustomizers.forEach((codecCustomizer) -> codecCustomizer
|
||||||
codecCustomizer -> codecCustomizer.customize(codecs));
|
.customize(codecs));
|
||||||
}).build());
|
}).build());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,7 +51,7 @@ public abstract class AbstractApplicationContextTesterTests<T extends AbstractAp
|
||||||
public void runWithSystemPropertiesShouldSetAndRemoveProperties() {
|
public void runWithSystemPropertiesShouldSetAndRemoveProperties() {
|
||||||
String key = "test." + UUID.randomUUID().toString();
|
String key = "test." + UUID.randomUUID().toString();
|
||||||
assertThat(System.getProperties().containsKey(key)).isFalse();
|
assertThat(System.getProperties().containsKey(key)).isFalse();
|
||||||
get().withSystemProperties(key + "=value").run(loaded -> {
|
get().withSystemProperties(key + "=value").run((loaded) -> {
|
||||||
assertThat(System.getProperties()).containsEntry(key, "value");
|
assertThat(System.getProperties()).containsEntry(key, "value");
|
||||||
});
|
});
|
||||||
assertThat(System.getProperties().containsKey(key)).isFalse();
|
assertThat(System.getProperties().containsKey(key)).isFalse();
|
||||||
|
@ -63,7 +63,7 @@ public abstract class AbstractApplicationContextTesterTests<T extends AbstractAp
|
||||||
String key = "test." + UUID.randomUUID().toString();
|
String key = "test." + UUID.randomUUID().toString();
|
||||||
assertThat(System.getProperties().containsKey(key)).isFalse();
|
assertThat(System.getProperties().containsKey(key)).isFalse();
|
||||||
get().withSystemProperties(key + "=value")
|
get().withSystemProperties(key + "=value")
|
||||||
.withUserConfiguration(FailingConfig.class).run(loaded -> {
|
.withUserConfiguration(FailingConfig.class).run((loaded) -> {
|
||||||
assertThat(loaded).hasFailed();
|
assertThat(loaded).hasFailed();
|
||||||
});
|
});
|
||||||
assertThat(System.getProperties().containsKey(key)).isFalse();
|
assertThat(System.getProperties().containsKey(key)).isFalse();
|
||||||
|
@ -76,7 +76,7 @@ public abstract class AbstractApplicationContextTesterTests<T extends AbstractAp
|
||||||
System.setProperty(key, "value");
|
System.setProperty(key, "value");
|
||||||
try {
|
try {
|
||||||
assertThat(System.getProperties().getProperty(key)).isEqualTo("value");
|
assertThat(System.getProperties().getProperty(key)).isEqualTo("value");
|
||||||
get().withSystemProperties(key + "=newValue").run(loaded -> {
|
get().withSystemProperties(key + "=newValue").run((loaded) -> {
|
||||||
assertThat(System.getProperties()).containsEntry(key, "newValue");
|
assertThat(System.getProperties()).containsEntry(key, "newValue");
|
||||||
});
|
});
|
||||||
assertThat(System.getProperties().getProperty(key)).isEqualTo("value");
|
assertThat(System.getProperties().getProperty(key)).isEqualTo("value");
|
||||||
|
@ -93,7 +93,7 @@ public abstract class AbstractApplicationContextTesterTests<T extends AbstractAp
|
||||||
System.setProperty(key, "value");
|
System.setProperty(key, "value");
|
||||||
try {
|
try {
|
||||||
assertThat(System.getProperties().getProperty(key)).isEqualTo("value");
|
assertThat(System.getProperties().getProperty(key)).isEqualTo("value");
|
||||||
get().withSystemProperty(key, null).run(loaded -> {
|
get().withSystemProperty(key, null).run((loaded) -> {
|
||||||
assertThat(System.getProperties()).doesNotContainKey(key);
|
assertThat(System.getProperties()).doesNotContainKey(key);
|
||||||
});
|
});
|
||||||
assertThat(System.getProperties().getProperty(key)).isEqualTo("value");
|
assertThat(System.getProperties().getProperty(key)).isEqualTo("value");
|
||||||
|
@ -106,7 +106,7 @@ public abstract class AbstractApplicationContextTesterTests<T extends AbstractAp
|
||||||
@Test
|
@Test
|
||||||
public void runWithMultiplePropertyValuesShouldAllAllValues() throws Exception {
|
public void runWithMultiplePropertyValuesShouldAllAllValues() throws Exception {
|
||||||
get().withPropertyValues("test.foo=1").withPropertyValues("test.bar=2")
|
get().withPropertyValues("test.foo=1").withPropertyValues("test.bar=2")
|
||||||
.run(loaded -> {
|
.run((loaded) -> {
|
||||||
Environment environment = loaded.getEnvironment();
|
Environment environment = loaded.getEnvironment();
|
||||||
assertThat(environment.getProperty("test.foo")).isEqualTo("1");
|
assertThat(environment.getProperty("test.foo")).isEqualTo("1");
|
||||||
assertThat(environment.getProperty("test.bar")).isEqualTo("2");
|
assertThat(environment.getProperty("test.bar")).isEqualTo("2");
|
||||||
|
@ -117,7 +117,7 @@ public abstract class AbstractApplicationContextTesterTests<T extends AbstractAp
|
||||||
public void runWithPropertyValuesWhenHasExistingShouldReplaceValue()
|
public void runWithPropertyValuesWhenHasExistingShouldReplaceValue()
|
||||||
throws Exception {
|
throws Exception {
|
||||||
get().withPropertyValues("test.foo=1").withPropertyValues("test.foo=2")
|
get().withPropertyValues("test.foo=1").withPropertyValues("test.foo=2")
|
||||||
.run(loaded -> {
|
.run((loaded) -> {
|
||||||
Environment environment = loaded.getEnvironment();
|
Environment environment = loaded.getEnvironment();
|
||||||
assertThat(environment.getProperty("test.foo")).isEqualTo("2");
|
assertThat(environment.getProperty("test.foo")).isEqualTo("2");
|
||||||
});
|
});
|
||||||
|
|
|
@ -19,16 +19,17 @@ package org.springframework.boot.gradle.dsl;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.concurrent.Callable;
|
import java.util.concurrent.Callable;
|
||||||
|
|
||||||
import org.gradle.api.Action;
|
import javax.swing.Action;
|
||||||
|
|
||||||
import org.gradle.api.Project;
|
import org.gradle.api.Project;
|
||||||
import org.gradle.api.plugins.BasePlugin;
|
import org.gradle.api.plugins.BasePlugin;
|
||||||
import org.gradle.api.plugins.JavaPlugin;
|
import org.gradle.api.plugins.JavaPlugin;
|
||||||
import org.gradle.api.plugins.JavaPluginConvention;
|
import org.gradle.api.plugins.JavaPluginConvention;
|
||||||
import org.gradle.api.tasks.SourceSet;
|
import org.gradle.api.tasks.SourceSet;
|
||||||
import org.gradle.api.tasks.bundling.Jar;
|
|
||||||
|
|
||||||
import org.springframework.boot.gradle.tasks.buildinfo.BuildInfo;
|
import org.springframework.boot.gradle.tasks.buildinfo.BuildInfo;
|
||||||
import org.springframework.boot.gradle.tasks.buildinfo.BuildInfoProperties;
|
import org.springframework.boot.gradle.tasks.buildinfo.BuildInfoProperties;
|
||||||
|
import org.springframework.boot.loader.tools.Layouts.Jar;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Entry point to Spring Boot's Gradle DSL.
|
* Entry point to Spring Boot's Gradle DSL.
|
||||||
|
@ -78,10 +79,10 @@ public class SpringBootExtension {
|
||||||
BuildInfo.class);
|
BuildInfo.class);
|
||||||
bootBuildInfo.setGroup(BasePlugin.BUILD_GROUP);
|
bootBuildInfo.setGroup(BasePlugin.BUILD_GROUP);
|
||||||
bootBuildInfo.setDescription("Generates a META-INF/build-info.properties file.");
|
bootBuildInfo.setDescription("Generates a META-INF/build-info.properties file.");
|
||||||
this.project.getPlugins().withType(JavaPlugin.class, plugin -> {
|
this.project.getPlugins().withType(JavaPlugin.class, (plugin) -> {
|
||||||
this.project.getTasks().getByName(JavaPlugin.CLASSES_TASK_NAME)
|
this.project.getTasks().getByName(JavaPlugin.CLASSES_TASK_NAME)
|
||||||
.dependsOn(bootBuildInfo);
|
.dependsOn(bootBuildInfo);
|
||||||
this.project.afterEvaluate(evaluated -> {
|
this.project.afterEvaluate((evaluated) -> {
|
||||||
BuildInfoProperties properties = bootBuildInfo.getProperties();
|
BuildInfoProperties properties = bootBuildInfo.getProperties();
|
||||||
if (properties.getArtifact() == null) {
|
if (properties.getArtifact() == null) {
|
||||||
properties.setArtifact(determineArtifactBaseName());
|
properties.setArtifact(determineArtifactBaseName());
|
||||||
|
|
|
@ -23,7 +23,6 @@ import java.io.StringWriter;
|
||||||
import java.util.concurrent.Callable;
|
import java.util.concurrent.Callable;
|
||||||
|
|
||||||
import org.gradle.api.GradleException;
|
import org.gradle.api.GradleException;
|
||||||
import org.gradle.api.Plugin;
|
|
||||||
import org.gradle.api.Project;
|
import org.gradle.api.Project;
|
||||||
import org.gradle.api.distribution.Distribution;
|
import org.gradle.api.distribution.Distribution;
|
||||||
import org.gradle.api.distribution.DistributionContainer;
|
import org.gradle.api.distribution.DistributionContainer;
|
||||||
|
@ -59,7 +58,7 @@ final class ApplicationPluginAction implements PluginApplicationAction {
|
||||||
((TemplateBasedScriptGenerator) bootStartScripts.getWindowsStartScriptGenerator())
|
((TemplateBasedScriptGenerator) bootStartScripts.getWindowsStartScriptGenerator())
|
||||||
.setTemplate(project.getResources().getText()
|
.setTemplate(project.getResources().getText()
|
||||||
.fromString(loadResource("/windowsStartScript.txt")));
|
.fromString(loadResource("/windowsStartScript.txt")));
|
||||||
project.getConfigurations().all(configuration -> {
|
project.getConfigurations().all((configuration) -> {
|
||||||
if ("bootArchives".equals(configuration.getName())) {
|
if ("bootArchives".equals(configuration.getName())) {
|
||||||
distribution.getContents()
|
distribution.getContents()
|
||||||
.with(project.copySpec().into("lib")
|
.with(project.copySpec().into("lib")
|
||||||
|
|
|
@ -18,8 +18,6 @@ package org.springframework.boot.gradle.plugin;
|
||||||
|
|
||||||
import io.spring.gradle.dependencymanagement.DependencyManagementPlugin;
|
import io.spring.gradle.dependencymanagement.DependencyManagementPlugin;
|
||||||
import io.spring.gradle.dependencymanagement.dsl.DependencyManagementExtension;
|
import io.spring.gradle.dependencymanagement.dsl.DependencyManagementExtension;
|
||||||
import org.gradle.api.Action;
|
|
||||||
import org.gradle.api.Plugin;
|
|
||||||
import org.gradle.api.Project;
|
import org.gradle.api.Project;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -39,7 +37,7 @@ final class DependencyManagementPluginAction implements PluginApplicationAction
|
||||||
@Override
|
@Override
|
||||||
public void execute(Project project) {
|
public void execute(Project project) {
|
||||||
project.getExtensions().findByType(DependencyManagementExtension.class)
|
project.getExtensions().findByType(DependencyManagementExtension.class)
|
||||||
.imports(importsHandler -> importsHandler.mavenBom(SPRING_BOOT_BOM));
|
.imports((importsHandler) -> importsHandler.mavenBom(SPRING_BOOT_BOM));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -19,8 +19,6 @@ package org.springframework.boot.gradle.plugin;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.concurrent.Callable;
|
import java.util.concurrent.Callable;
|
||||||
|
|
||||||
import org.gradle.api.Action;
|
|
||||||
import org.gradle.api.Plugin;
|
|
||||||
import org.gradle.api.Project;
|
import org.gradle.api.Project;
|
||||||
import org.gradle.api.file.FileCollection;
|
import org.gradle.api.file.FileCollection;
|
||||||
import org.gradle.api.internal.artifacts.publish.ArchivePublishArtifact;
|
import org.gradle.api.internal.artifacts.publish.ArchivePublishArtifact;
|
||||||
|
@ -113,8 +111,8 @@ final class JavaPluginAction implements PluginApplicationAction {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void configureUtf8Encoding(Project project) {
|
private void configureUtf8Encoding(Project project) {
|
||||||
project.afterEvaluate(
|
project.afterEvaluate(evaluated -> evaluated.getTasks()
|
||||||
evaluated -> evaluated.getTasks().withType(JavaCompile.class, compile -> {
|
.withType(JavaCompile.class, (compile) -> {
|
||||||
if (compile.getOptions().getEncoding() == null) {
|
if (compile.getOptions().getEncoding() == null) {
|
||||||
compile.getOptions().setEncoding("UTF-8");
|
compile.getOptions().setEncoding("UTF-8");
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,8 +16,6 @@
|
||||||
|
|
||||||
package org.springframework.boot.gradle.plugin;
|
package org.springframework.boot.gradle.plugin;
|
||||||
|
|
||||||
import org.gradle.api.Action;
|
|
||||||
import org.gradle.api.Plugin;
|
|
||||||
import org.gradle.api.Project;
|
import org.gradle.api.Project;
|
||||||
import org.gradle.api.artifacts.maven.MavenResolver;
|
import org.gradle.api.artifacts.maven.MavenResolver;
|
||||||
import org.gradle.api.plugins.MavenPlugin;
|
import org.gradle.api.plugins.MavenPlugin;
|
||||||
|
@ -43,16 +41,16 @@ final class MavenPluginAction implements PluginApplicationAction {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(Project project) {
|
public void execute(Project project) {
|
||||||
project.getTasks().withType(Upload.class, upload -> {
|
project.getTasks().withType(Upload.class, (upload) -> {
|
||||||
if (this.uploadTaskName.equals(upload.getName())) {
|
if (this.uploadTaskName.equals(upload.getName())) {
|
||||||
project.afterEvaluate(evaluated -> clearConfigurationMappings(upload));
|
project.afterEvaluate((evaluated) -> clearConfigurationMappings(upload));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void clearConfigurationMappings(Upload upload) {
|
private void clearConfigurationMappings(Upload upload) {
|
||||||
upload.getRepositories().withType(MavenResolver.class,
|
upload.getRepositories().withType(MavenResolver.class,
|
||||||
resolver -> resolver.getPom().getScopeMappings().getMappings().clear());
|
(resolver) -> resolver.getPom().getScopeMappings().getMappings().clear());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,10 +19,9 @@ package org.springframework.boot.gradle.plugin;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import net.bytebuddy.build.Plugin;
|
||||||
import org.gradle.api.GradleException;
|
import org.gradle.api.GradleException;
|
||||||
import org.gradle.api.Plugin;
|
|
||||||
import org.gradle.api.Project;
|
import org.gradle.api.Project;
|
||||||
import org.gradle.api.artifacts.Configuration;
|
|
||||||
import org.gradle.util.GradleVersion;
|
import org.gradle.util.GradleVersion;
|
||||||
|
|
||||||
import org.springframework.boot.gradle.dsl.SpringBootExtension;
|
import org.springframework.boot.gradle.dsl.SpringBootExtension;
|
||||||
|
@ -96,19 +95,19 @@ public class SpringBootPlugin implements Plugin<Project> {
|
||||||
new DependencyManagementPluginAction(), new ApplicationPluginAction());
|
new DependencyManagementPluginAction(), new ApplicationPluginAction());
|
||||||
for (PluginApplicationAction action : actions) {
|
for (PluginApplicationAction action : actions) {
|
||||||
project.getPlugins().withType(action.getPluginClass(),
|
project.getPlugins().withType(action.getPluginClass(),
|
||||||
plugin -> action.execute(project));
|
(plugin) -> action.execute(project));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void unregisterUnresolvedDependenciesAnalyzer(Project project) {
|
private void unregisterUnresolvedDependenciesAnalyzer(Project project) {
|
||||||
UnresolvedDependenciesAnalyzer unresolvedDependenciesAnalyzer = new UnresolvedDependenciesAnalyzer();
|
UnresolvedDependenciesAnalyzer unresolvedDependenciesAnalyzer = new UnresolvedDependenciesAnalyzer();
|
||||||
project.getConfigurations().all(configuration -> configuration.getIncoming()
|
project.getConfigurations().all((configuration) -> configuration.getIncoming()
|
||||||
.afterResolve(resolvableDependencies -> unresolvedDependenciesAnalyzer
|
.afterResolve((resolvableDependencies) -> unresolvedDependenciesAnalyzer
|
||||||
.analyze(configuration.getResolvedConfiguration()
|
.analyze(configuration.getResolvedConfiguration()
|
||||||
.getLenientConfiguration()
|
.getLenientConfiguration()
|
||||||
.getUnresolvedModuleDependencies())));
|
.getUnresolvedModuleDependencies())));
|
||||||
project.getGradle().buildFinished(
|
project.getGradle().buildFinished(
|
||||||
buildResult -> unresolvedDependenciesAnalyzer.buildFinished(project));
|
(buildResult) -> unresolvedDependenciesAnalyzer.buildFinished(project));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,7 +42,7 @@ class UnresolvedDependenciesAnalyzer {
|
||||||
|
|
||||||
void analyze(Set<UnresolvedDependency> unresolvedDependencies) {
|
void analyze(Set<UnresolvedDependency> unresolvedDependencies) {
|
||||||
this.dependenciesWithNoVersion = unresolvedDependencies.stream()
|
this.dependenciesWithNoVersion = unresolvedDependencies.stream()
|
||||||
.map(unresolvedDependency -> unresolvedDependency.getSelector())
|
.map((unresolvedDependency) -> unresolvedDependency.getSelector())
|
||||||
.filter(this::hasNoVersion).collect(Collectors.toSet());
|
.filter(this::hasNoVersion).collect(Collectors.toSet());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -53,7 +53,7 @@ class UnresolvedDependenciesAnalyzer {
|
||||||
message.append("\nDuring the build, one or more dependencies that were "
|
message.append("\nDuring the build, one or more dependencies that were "
|
||||||
+ "declared without a version failed to resolve:\n");
|
+ "declared without a version failed to resolve:\n");
|
||||||
this.dependenciesWithNoVersion.stream()
|
this.dependenciesWithNoVersion.stream()
|
||||||
.forEach(dependency -> message.append(" " + dependency + "\n"));
|
.forEach((dependency) -> message.append(" " + dependency + "\n"));
|
||||||
message.append("\nDid you forget to apply the "
|
message.append("\nDid you forget to apply the "
|
||||||
+ "io.spring.dependency-management plugin to the " + project.getName()
|
+ "io.spring.dependency-management plugin to the " + project.getName()
|
||||||
+ " project?\n");
|
+ " project?\n");
|
||||||
|
|
|
@ -23,18 +23,19 @@ import java.util.Set;
|
||||||
import java.util.TreeMap;
|
import java.util.TreeMap;
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
|
|
||||||
|
import javax.swing.text.DefaultEditorKit.CopyAction;
|
||||||
|
|
||||||
|
import io.spring.gradle.dependencymanagement.org.apache.maven.model.PatternSet;
|
||||||
import org.gradle.api.file.FileCopyDetails;
|
import org.gradle.api.file.FileCopyDetails;
|
||||||
import org.gradle.api.file.FileTreeElement;
|
import org.gradle.api.file.FileTreeElement;
|
||||||
import org.gradle.api.file.RelativePath;
|
import org.gradle.api.file.RelativePath;
|
||||||
import org.gradle.api.internal.file.copy.CopyAction;
|
|
||||||
import org.gradle.api.internal.file.copy.CopyActionProcessingStream;
|
import org.gradle.api.internal.file.copy.CopyActionProcessingStream;
|
||||||
import org.gradle.api.internal.file.copy.FileCopyDetailsInternal;
|
import org.gradle.api.internal.file.copy.FileCopyDetailsInternal;
|
||||||
import org.gradle.api.java.archives.Attributes;
|
|
||||||
import org.gradle.api.specs.Spec;
|
import org.gradle.api.specs.Spec;
|
||||||
import org.gradle.api.specs.Specs;
|
import org.gradle.api.specs.Specs;
|
||||||
import org.gradle.api.tasks.WorkResult;
|
import org.gradle.api.tasks.WorkResult;
|
||||||
import org.gradle.api.tasks.bundling.Jar;
|
|
||||||
import org.gradle.api.tasks.util.PatternSet;
|
import org.springframework.boot.loader.tools.Layouts.Jar;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Support class for implementations of {@link BootArchive}.
|
* Support class for implementations of {@link BootArchive}.
|
||||||
|
@ -138,10 +139,10 @@ class BootArchiveSupport {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public WorkResult execute(CopyActionProcessingStream stream) {
|
public WorkResult execute(CopyActionProcessingStream stream) {
|
||||||
return this.delegate.execute(action -> {
|
return this.delegate.execute((action) -> {
|
||||||
Map<RelativePath, FileCopyDetailsInternal> detailsByPath = new TreeMap<>();
|
Map<RelativePath, FileCopyDetailsInternal> detailsByPath = new TreeMap<>();
|
||||||
stream.process(
|
stream.process((details) -> detailsByPath.put(details.getRelativePath(),
|
||||||
details -> detailsByPath.put(details.getRelativePath(), details));
|
details));
|
||||||
detailsByPath.values().stream().forEach(action::processFile);
|
detailsByPath.values().stream().forEach(action::processFile);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,14 +20,16 @@ import java.io.File;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.concurrent.Callable;
|
import java.util.concurrent.Callable;
|
||||||
|
|
||||||
import org.gradle.api.Action;
|
import javax.swing.Action;
|
||||||
|
import javax.swing.text.DefaultEditorKit.CopyAction;
|
||||||
|
|
||||||
import org.gradle.api.file.CopySpec;
|
import org.gradle.api.file.CopySpec;
|
||||||
import org.gradle.api.file.FileCollection;
|
import org.gradle.api.file.FileCollection;
|
||||||
import org.gradle.api.file.FileCopyDetails;
|
import org.gradle.api.file.FileCopyDetails;
|
||||||
import org.gradle.api.file.FileTreeElement;
|
import org.gradle.api.file.FileTreeElement;
|
||||||
import org.gradle.api.internal.file.copy.CopyAction;
|
|
||||||
import org.gradle.api.specs.Spec;
|
import org.gradle.api.specs.Spec;
|
||||||
import org.gradle.api.tasks.bundling.Jar;
|
|
||||||
|
import org.springframework.boot.loader.tools.Layouts.Jar;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A custom {@link Jar} task that produces a Spring Boot executable jar.
|
* A custom {@link Jar} task that produces a Spring Boot executable jar.
|
||||||
|
@ -55,7 +57,7 @@ public class BootJar extends Jar implements BootArchive {
|
||||||
}
|
}
|
||||||
|
|
||||||
private Action<CopySpec> classpathFiles(Spec<File> filter) {
|
private Action<CopySpec> classpathFiles(Spec<File> filter) {
|
||||||
return copySpec -> copySpec
|
return (copySpec) -> copySpec
|
||||||
.from((Callable<Iterable<File>>) () -> this.classpath == null
|
.from((Callable<Iterable<File>>) () -> this.classpath == null
|
||||||
? Collections.emptyList() : this.classpath.filter(filter));
|
? Collections.emptyList() : this.classpath.filter(filter));
|
||||||
|
|
||||||
|
|
|
@ -20,15 +20,17 @@ import java.io.File;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.concurrent.Callable;
|
import java.util.concurrent.Callable;
|
||||||
|
|
||||||
import org.gradle.api.Action;
|
import javax.swing.Action;
|
||||||
|
import javax.swing.text.DefaultEditorKit.CopyAction;
|
||||||
|
|
||||||
import org.gradle.api.Project;
|
import org.gradle.api.Project;
|
||||||
import org.gradle.api.file.FileCollection;
|
import org.gradle.api.file.FileCollection;
|
||||||
import org.gradle.api.file.FileCopyDetails;
|
import org.gradle.api.file.FileCopyDetails;
|
||||||
import org.gradle.api.file.FileTreeElement;
|
import org.gradle.api.file.FileTreeElement;
|
||||||
import org.gradle.api.internal.file.copy.CopyAction;
|
|
||||||
import org.gradle.api.specs.Spec;
|
import org.gradle.api.specs.Spec;
|
||||||
import org.gradle.api.tasks.Optional;
|
import org.gradle.api.tasks.Optional;
|
||||||
import org.gradle.api.tasks.bundling.War;
|
|
||||||
|
import org.springframework.boot.loader.tools.Layouts.War;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A custom {@link War} task that produces a Spring Boot executable war.
|
* A custom {@link War} task that produces a Spring Boot executable war.
|
||||||
|
@ -50,7 +52,7 @@ public class BootWar extends War implements BootArchive {
|
||||||
*/
|
*/
|
||||||
public BootWar() {
|
public BootWar() {
|
||||||
getWebInf().into("lib-provided",
|
getWebInf().into("lib-provided",
|
||||||
copySpec -> copySpec
|
(copySpec) -> copySpec
|
||||||
.from((Callable<Iterable<File>>) () -> this.providedClasspath == null
|
.from((Callable<Iterable<File>>) () -> this.providedClasspath == null
|
||||||
? Collections.emptyList() : this.providedClasspath));
|
? Collections.emptyList() : this.providedClasspath));
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,7 +40,7 @@ public class BootRun extends JavaExec {
|
||||||
public void sourceResources(SourceSet sourceSet) {
|
public void sourceResources(SourceSet sourceSet) {
|
||||||
setClasspath(getProject()
|
setClasspath(getProject()
|
||||||
.files(sourceSet.getResources().getSrcDirs(), getClasspath())
|
.files(sourceSet.getResources().getSrcDirs(), getClasspath())
|
||||||
.filter(file -> !file.equals(sourceSet.getOutput().getResourcesDir())));
|
.filter((file) -> !file.equals(sourceSet.getOutput().getResourcesDir())));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -55,7 +55,7 @@ import org.springframework.util.Assert;
|
||||||
public abstract class Configurations {
|
public abstract class Configurations {
|
||||||
|
|
||||||
private static final Comparator<Object> COMPARATOR = OrderComparator.INSTANCE
|
private static final Comparator<Object> COMPARATOR = OrderComparator.INSTANCE
|
||||||
.thenComparing(o -> o.getClass().getName());
|
.thenComparing((other) -> other.getClass().getName());
|
||||||
|
|
||||||
private Set<Class<?>> classes;
|
private Set<Class<?>> classes;
|
||||||
|
|
||||||
|
@ -117,7 +117,7 @@ public abstract class Configurations {
|
||||||
List<Configurations> orderedConfigurations = new ArrayList<>(configurations);
|
List<Configurations> orderedConfigurations = new ArrayList<>(configurations);
|
||||||
orderedConfigurations.sort(COMPARATOR);
|
orderedConfigurations.sort(COMPARATOR);
|
||||||
List<Configurations> collated = collate(orderedConfigurations);
|
List<Configurations> collated = collate(orderedConfigurations);
|
||||||
return collated.stream().flatMap(c -> c.getClasses().stream())
|
return collated.stream().flatMap((c) -> c.getClasses().stream())
|
||||||
.collect(Collectors.toCollection(LinkedHashSet::new))
|
.collect(Collectors.toCollection(LinkedHashSet::new))
|
||||||
.toArray(new Class<?>[0]);
|
.toArray(new Class<?>[0]);
|
||||||
}
|
}
|
||||||
|
|
|
@ -109,7 +109,7 @@ public class NettyWebServer implements WebServer {
|
||||||
this.nettyContext.shutdown();
|
this.nettyContext.shutdown();
|
||||||
// temporary fix for gh-9146
|
// temporary fix for gh-9146
|
||||||
this.nettyContext.getContext().onClose()
|
this.nettyContext.getContext().onClose()
|
||||||
.doOnSuccess(aVoid -> HttpResources.reset()).block();
|
.doOnSuccess((o) -> HttpResources.reset()).block();
|
||||||
this.nettyContext = null;
|
this.nettyContext = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -112,9 +112,10 @@ public class NoUnboundElementsBindHandlerTests {
|
||||||
source.put("example.other", "baz");
|
source.put("example.other", "baz");
|
||||||
this.sources.add(source);
|
this.sources.add(source);
|
||||||
this.binder = new Binder(this.sources);
|
this.binder = new Binder(this.sources);
|
||||||
NoUnboundElementsBindHandler handler = new NoUnboundElementsBindHandler(BindHandler.DEFAULT, (configurationPropertySource -> false));
|
NoUnboundElementsBindHandler handler = new NoUnboundElementsBindHandler(
|
||||||
Example bound = this.binder.bind("example", Bindable.of(Example.class),
|
BindHandler.DEFAULT, ((configurationPropertySource) -> false));
|
||||||
handler).get();
|
Example bound = this.binder.bind("example", Bindable.of(Example.class), handler)
|
||||||
|
.get();
|
||||||
assertThat(bound.getFoo()).isEqualTo("bar");
|
assertThat(bound.getFoo()).isEqualTo("bar");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -78,7 +78,7 @@ public abstract class AbstractReactiveWebServerFactoryTests {
|
||||||
Mono<String> result = getWebClient().post().uri("/test")
|
Mono<String> result = getWebClient().post().uri("/test")
|
||||||
.contentType(MediaType.TEXT_PLAIN)
|
.contentType(MediaType.TEXT_PLAIN)
|
||||||
.body(BodyInserters.fromObject("Hello World")).exchange()
|
.body(BodyInserters.fromObject("Hello World")).exchange()
|
||||||
.flatMap(response -> response.bodyToMono(String.class));
|
.flatMap((response) -> response.bodyToMono(String.class));
|
||||||
assertThat(result.block()).isEqualTo("Hello World");
|
assertThat(result.block()).isEqualTo("Hello World");
|
||||||
this.webServer.stop();
|
this.webServer.stop();
|
||||||
Mono<ClientResponse> response = getWebClient().post().uri("/test")
|
Mono<ClientResponse> response = getWebClient().post().uri("/test")
|
||||||
|
@ -97,7 +97,7 @@ public abstract class AbstractReactiveWebServerFactoryTests {
|
||||||
Mono<String> result = WebClient.create("http://localhost:" + specificPort).post()
|
Mono<String> result = WebClient.create("http://localhost:" + specificPort).post()
|
||||||
.uri("/test").contentType(MediaType.TEXT_PLAIN)
|
.uri("/test").contentType(MediaType.TEXT_PLAIN)
|
||||||
.body(BodyInserters.fromObject("Hello World")).exchange()
|
.body(BodyInserters.fromObject("Hello World")).exchange()
|
||||||
.flatMap(response -> response.bodyToMono(String.class));
|
.flatMap((response) -> response.bodyToMono(String.class));
|
||||||
assertThat(result.block()).isEqualTo("Hello World");
|
assertThat(result.block()).isEqualTo("Hello World");
|
||||||
assertThat(this.webServer.getPort()).isEqualTo(specificPort);
|
assertThat(this.webServer.getPort()).isEqualTo(specificPort);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue