Polish lambda formatting
This commit is contained in:
@@ -19,16 +19,17 @@ package org.springframework.boot.gradle.dsl;
|
||||
import java.io.File;
|
||||
import java.util.concurrent.Callable;
|
||||
|
||||
import org.gradle.api.Action;
|
||||
import javax.swing.Action;
|
||||
|
||||
import org.gradle.api.Project;
|
||||
import org.gradle.api.plugins.BasePlugin;
|
||||
import org.gradle.api.plugins.JavaPlugin;
|
||||
import org.gradle.api.plugins.JavaPluginConvention;
|
||||
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.BuildInfoProperties;
|
||||
import org.springframework.boot.loader.tools.Layouts.Jar;
|
||||
|
||||
/**
|
||||
* Entry point to Spring Boot's Gradle DSL.
|
||||
@@ -78,10 +79,10 @@ public class SpringBootExtension {
|
||||
BuildInfo.class);
|
||||
bootBuildInfo.setGroup(BasePlugin.BUILD_GROUP);
|
||||
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)
|
||||
.dependsOn(bootBuildInfo);
|
||||
this.project.afterEvaluate(evaluated -> {
|
||||
this.project.afterEvaluate((evaluated) -> {
|
||||
BuildInfoProperties properties = bootBuildInfo.getProperties();
|
||||
if (properties.getArtifact() == null) {
|
||||
properties.setArtifact(determineArtifactBaseName());
|
||||
|
||||
@@ -23,7 +23,6 @@ import java.io.StringWriter;
|
||||
import java.util.concurrent.Callable;
|
||||
|
||||
import org.gradle.api.GradleException;
|
||||
import org.gradle.api.Plugin;
|
||||
import org.gradle.api.Project;
|
||||
import org.gradle.api.distribution.Distribution;
|
||||
import org.gradle.api.distribution.DistributionContainer;
|
||||
@@ -59,7 +58,7 @@ final class ApplicationPluginAction implements PluginApplicationAction {
|
||||
((TemplateBasedScriptGenerator) bootStartScripts.getWindowsStartScriptGenerator())
|
||||
.setTemplate(project.getResources().getText()
|
||||
.fromString(loadResource("/windowsStartScript.txt")));
|
||||
project.getConfigurations().all(configuration -> {
|
||||
project.getConfigurations().all((configuration) -> {
|
||||
if ("bootArchives".equals(configuration.getName())) {
|
||||
distribution.getContents()
|
||||
.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.dsl.DependencyManagementExtension;
|
||||
import org.gradle.api.Action;
|
||||
import org.gradle.api.Plugin;
|
||||
import org.gradle.api.Project;
|
||||
|
||||
/**
|
||||
@@ -39,7 +37,7 @@ final class DependencyManagementPluginAction implements PluginApplicationAction
|
||||
@Override
|
||||
public void execute(Project project) {
|
||||
project.getExtensions().findByType(DependencyManagementExtension.class)
|
||||
.imports(importsHandler -> importsHandler.mavenBom(SPRING_BOOT_BOM));
|
||||
.imports((importsHandler) -> importsHandler.mavenBom(SPRING_BOOT_BOM));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -19,8 +19,6 @@ package org.springframework.boot.gradle.plugin;
|
||||
import java.util.Collections;
|
||||
import java.util.concurrent.Callable;
|
||||
|
||||
import org.gradle.api.Action;
|
||||
import org.gradle.api.Plugin;
|
||||
import org.gradle.api.Project;
|
||||
import org.gradle.api.file.FileCollection;
|
||||
import org.gradle.api.internal.artifacts.publish.ArchivePublishArtifact;
|
||||
@@ -113,8 +111,8 @@ final class JavaPluginAction implements PluginApplicationAction {
|
||||
}
|
||||
|
||||
private void configureUtf8Encoding(Project project) {
|
||||
project.afterEvaluate(
|
||||
evaluated -> evaluated.getTasks().withType(JavaCompile.class, compile -> {
|
||||
project.afterEvaluate(evaluated -> evaluated.getTasks()
|
||||
.withType(JavaCompile.class, (compile) -> {
|
||||
if (compile.getOptions().getEncoding() == null) {
|
||||
compile.getOptions().setEncoding("UTF-8");
|
||||
}
|
||||
|
||||
@@ -16,8 +16,6 @@
|
||||
|
||||
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.artifacts.maven.MavenResolver;
|
||||
import org.gradle.api.plugins.MavenPlugin;
|
||||
@@ -43,16 +41,16 @@ final class MavenPluginAction implements PluginApplicationAction {
|
||||
|
||||
@Override
|
||||
public void execute(Project project) {
|
||||
project.getTasks().withType(Upload.class, upload -> {
|
||||
project.getTasks().withType(Upload.class, (upload) -> {
|
||||
if (this.uploadTaskName.equals(upload.getName())) {
|
||||
project.afterEvaluate(evaluated -> clearConfigurationMappings(upload));
|
||||
project.afterEvaluate((evaluated) -> clearConfigurationMappings(upload));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void clearConfigurationMappings(Upload upload) {
|
||||
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.List;
|
||||
|
||||
import net.bytebuddy.build.Plugin;
|
||||
import org.gradle.api.GradleException;
|
||||
import org.gradle.api.Plugin;
|
||||
import org.gradle.api.Project;
|
||||
import org.gradle.api.artifacts.Configuration;
|
||||
import org.gradle.util.GradleVersion;
|
||||
|
||||
import org.springframework.boot.gradle.dsl.SpringBootExtension;
|
||||
@@ -96,19 +95,19 @@ public class SpringBootPlugin implements Plugin<Project> {
|
||||
new DependencyManagementPluginAction(), new ApplicationPluginAction());
|
||||
for (PluginApplicationAction action : actions) {
|
||||
project.getPlugins().withType(action.getPluginClass(),
|
||||
plugin -> action.execute(project));
|
||||
(plugin) -> action.execute(project));
|
||||
}
|
||||
}
|
||||
|
||||
private void unregisterUnresolvedDependenciesAnalyzer(Project project) {
|
||||
UnresolvedDependenciesAnalyzer unresolvedDependenciesAnalyzer = new UnresolvedDependenciesAnalyzer();
|
||||
project.getConfigurations().all(configuration -> configuration.getIncoming()
|
||||
.afterResolve(resolvableDependencies -> unresolvedDependenciesAnalyzer
|
||||
project.getConfigurations().all((configuration) -> configuration.getIncoming()
|
||||
.afterResolve((resolvableDependencies) -> unresolvedDependenciesAnalyzer
|
||||
.analyze(configuration.getResolvedConfiguration()
|
||||
.getLenientConfiguration()
|
||||
.getUnresolvedModuleDependencies())));
|
||||
project.getGradle().buildFinished(
|
||||
buildResult -> unresolvedDependenciesAnalyzer.buildFinished(project));
|
||||
(buildResult) -> unresolvedDependenciesAnalyzer.buildFinished(project));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ class UnresolvedDependenciesAnalyzer {
|
||||
|
||||
void analyze(Set<UnresolvedDependency> unresolvedDependencies) {
|
||||
this.dependenciesWithNoVersion = unresolvedDependencies.stream()
|
||||
.map(unresolvedDependency -> unresolvedDependency.getSelector())
|
||||
.map((unresolvedDependency) -> unresolvedDependency.getSelector())
|
||||
.filter(this::hasNoVersion).collect(Collectors.toSet());
|
||||
}
|
||||
|
||||
@@ -53,7 +53,7 @@ class UnresolvedDependenciesAnalyzer {
|
||||
message.append("\nDuring the build, one or more dependencies that were "
|
||||
+ "declared without a version failed to resolve:\n");
|
||||
this.dependenciesWithNoVersion.stream()
|
||||
.forEach(dependency -> message.append(" " + dependency + "\n"));
|
||||
.forEach((dependency) -> message.append(" " + dependency + "\n"));
|
||||
message.append("\nDid you forget to apply the "
|
||||
+ "io.spring.dependency-management plugin to the " + project.getName()
|
||||
+ " project?\n");
|
||||
|
||||
@@ -23,18 +23,19 @@ import java.util.Set;
|
||||
import java.util.TreeMap;
|
||||
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.FileTreeElement;
|
||||
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.FileCopyDetailsInternal;
|
||||
import org.gradle.api.java.archives.Attributes;
|
||||
import org.gradle.api.specs.Spec;
|
||||
import org.gradle.api.specs.Specs;
|
||||
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}.
|
||||
@@ -138,10 +139,10 @@ class BootArchiveSupport {
|
||||
|
||||
@Override
|
||||
public WorkResult execute(CopyActionProcessingStream stream) {
|
||||
return this.delegate.execute(action -> {
|
||||
return this.delegate.execute((action) -> {
|
||||
Map<RelativePath, FileCopyDetailsInternal> detailsByPath = new TreeMap<>();
|
||||
stream.process(
|
||||
details -> detailsByPath.put(details.getRelativePath(), details));
|
||||
stream.process((details) -> detailsByPath.put(details.getRelativePath(),
|
||||
details));
|
||||
detailsByPath.values().stream().forEach(action::processFile);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -20,14 +20,16 @@ import java.io.File;
|
||||
import java.util.Collections;
|
||||
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.FileCollection;
|
||||
import org.gradle.api.file.FileCopyDetails;
|
||||
import org.gradle.api.file.FileTreeElement;
|
||||
import org.gradle.api.internal.file.copy.CopyAction;
|
||||
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.
|
||||
@@ -55,7 +57,7 @@ public class BootJar extends Jar implements BootArchive {
|
||||
}
|
||||
|
||||
private Action<CopySpec> classpathFiles(Spec<File> filter) {
|
||||
return copySpec -> copySpec
|
||||
return (copySpec) -> copySpec
|
||||
.from((Callable<Iterable<File>>) () -> this.classpath == null
|
||||
? Collections.emptyList() : this.classpath.filter(filter));
|
||||
|
||||
|
||||
@@ -20,15 +20,17 @@ import java.io.File;
|
||||
import java.util.Collections;
|
||||
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.file.FileCollection;
|
||||
import org.gradle.api.file.FileCopyDetails;
|
||||
import org.gradle.api.file.FileTreeElement;
|
||||
import org.gradle.api.internal.file.copy.CopyAction;
|
||||
import org.gradle.api.specs.Spec;
|
||||
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.
|
||||
@@ -50,7 +52,7 @@ public class BootWar extends War implements BootArchive {
|
||||
*/
|
||||
public BootWar() {
|
||||
getWebInf().into("lib-provided",
|
||||
copySpec -> copySpec
|
||||
(copySpec) -> copySpec
|
||||
.from((Callable<Iterable<File>>) () -> this.providedClasspath == null
|
||||
? Collections.emptyList() : this.providedClasspath));
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ public class BootRun extends JavaExec {
|
||||
public void sourceResources(SourceSet sourceSet) {
|
||||
setClasspath(getProject()
|
||||
.files(sourceSet.getResources().getSrcDirs(), getClasspath())
|
||||
.filter(file -> !file.equals(sourceSet.getOutput().getResourcesDir())));
|
||||
.filter((file) -> !file.equals(sourceSet.getOutput().getResourcesDir())));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user