Skip to content

Commit 24af90d

Browse files
committed
Reformat with fluent style
1 parent e42a506 commit 24af90d

File tree

1,896 files changed

+25715
-20481
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,896 files changed

+25715
-20481
lines changed

buildSrc/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ plugins {
66
}
77

88
repositories {
9+
mavenLocal()
910
mavenCentral()
1011
gradlePluginPortal()
1112
}

buildSrc/gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
javaFormatVersion=0.0.35
1+
javaFormatVersion=0.0.36-SNAPSHOT

buildSrc/settings.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
pluginManagement {
22
repositories {
3+
mavenLocal()
34
mavenCentral()
45
gradlePluginPortal()
56
}

buildSrc/src/main/java/org/springframework/boot/build/AsciidoctorConventions.java

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,9 @@ void apply(Project project) {
7171
makeAllWarningsFatal(project);
7272
upgradeAsciidoctorJVersion(project);
7373
createAsciidoctorExtensionsConfiguration(project);
74-
project.getTasks().withType(AbstractAsciidoctorTask.class,
75-
(asciidoctorTask) -> configureAsciidoctorTask(project, asciidoctorTask));
74+
project.getTasks()
75+
.withType(AbstractAsciidoctorTask.class,
76+
(asciidoctorTask) -> configureAsciidoctorTask(project, asciidoctorTask));
7677
});
7778
}
7879

@@ -86,12 +87,14 @@ private void upgradeAsciidoctorJVersion(Project project) {
8687

8788
private void createAsciidoctorExtensionsConfiguration(Project project) {
8889
project.getConfigurations().create(EXTENSIONS_CONFIGURATION_NAME, (configuration) -> {
89-
project.getConfigurations().matching((candidate) -> "dependencyManagement".equals(candidate.getName()))
90-
.all(configuration::extendsFrom);
91-
configuration.getDependencies().add(project.getDependencies()
90+
project.getConfigurations()
91+
.matching((candidate) -> "dependencyManagement".equals(candidate.getName()))
92+
.all(configuration::extendsFrom);
93+
configuration.getDependencies()
94+
.add(project.getDependencies()
9295
.create("io.spring.asciidoctor.backends:spring-asciidoctor-backends:0.0.4"));
9396
configuration.getDependencies()
94-
.add(project.getDependencies().create("org.asciidoctor:asciidoctorj-pdf:1.5.3"));
97+
.add(project.getDependencies().create("org.asciidoctor:asciidoctorj-pdf:1.5.3"));
9598
});
9699
}
97100

@@ -137,13 +140,15 @@ private void configureOptions(AbstractAsciidoctorTask asciidoctorTask) {
137140

138141
private Sync createSyncDocumentationSourceTask(Project project, AbstractAsciidoctorTask asciidoctorTask) {
139142
Sync syncDocumentationSource = project.getTasks()
140-
.create("syncDocumentationSourceFor" + StringUtils.capitalize(asciidoctorTask.getName()), Sync.class);
143+
.create("syncDocumentationSourceFor" + StringUtils.capitalize(asciidoctorTask.getName()), Sync.class);
141144
File syncedSource = new File(project.getBuildDir(), "docs/src/" + asciidoctorTask.getName());
142145
syncDocumentationSource.setDestinationDir(syncedSource);
143146
syncDocumentationSource.from("src/docs/");
144147
asciidoctorTask.dependsOn(syncDocumentationSource);
145-
asciidoctorTask.getInputs().dir(syncedSource).withPathSensitivity(PathSensitivity.RELATIVE)
146-
.withPropertyName("synced source");
148+
asciidoctorTask.getInputs()
149+
.dir(syncedSource)
150+
.withPathSensitivity(PathSensitivity.RELATIVE)
151+
.withPropertyName("synced source");
147152
asciidoctorTask.setSourceDir(project.relativePath(new File(syncedSource, "asciidoc/")));
148153
return syncDocumentationSource;
149154
}

buildSrc/src/main/java/org/springframework/boot/build/DeployedPlugin.java

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,16 @@ public void apply(Project project) {
4646
MavenPublication mavenPublication = publishing.getPublications().create("maven", MavenPublication.class);
4747
project.afterEvaluate((evaluated) -> project.getPlugins().withType(JavaPlugin.class).all((javaPlugin) -> {
4848
if (((Jar) project.getTasks().getByName(JavaPlugin.JAR_TASK_NAME)).isEnabled()) {
49-
project.getComponents().matching((component) -> component.getName().equals("java"))
50-
.all(mavenPublication::from);
49+
project.getComponents()
50+
.matching((component) -> component.getName().equals("java"))
51+
.all(mavenPublication::from);
5152
}
5253
}));
53-
project.getPlugins().withType(JavaPlatformPlugin.class).all((javaPlugin) -> project.getComponents()
54-
.matching((component) -> component.getName().equals("javaPlatform")).all(mavenPublication::from));
54+
project.getPlugins()
55+
.withType(JavaPlatformPlugin.class)
56+
.all((javaPlugin) -> project.getComponents()
57+
.matching((component) -> component.getName().equals("javaPlatform"))
58+
.all(mavenPublication::from));
5559
}
5660

5761
}

buildSrc/src/main/java/org/springframework/boot/build/JavaConventions.java

Lines changed: 24 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -121,16 +121,18 @@ void apply(Project project) {
121121
}
122122

123123
private void configureJarManifestConventions(Project project) {
124-
ExtractResources extractLegalResources = project.getTasks().create("extractLegalResources",
125-
ExtractResources.class);
124+
ExtractResources extractLegalResources = project.getTasks()
125+
.create("extractLegalResources", ExtractResources.class);
126126
extractLegalResources.getDestinationDirectory().set(project.getLayout().getBuildDirectory().dir("legal"));
127127
extractLegalResources.setResourcesNames(Arrays.asList("LICENSE.txt", "NOTICE.txt"));
128128
extractLegalResources.property("version", project.getVersion().toString());
129129
SourceSetContainer sourceSets = project.getExtensions().getByType(SourceSetContainer.class);
130-
Set<String> sourceJarTaskNames = sourceSets.stream().map(SourceSet::getSourcesJarTaskName)
131-
.collect(Collectors.toSet());
132-
Set<String> javadocJarTaskNames = sourceSets.stream().map(SourceSet::getJavadocJarTaskName)
133-
.collect(Collectors.toSet());
130+
Set<String> sourceJarTaskNames = sourceSets.stream()
131+
.map(SourceSet::getSourcesJarTaskName)
132+
.collect(Collectors.toSet());
133+
Set<String> javadocJarTaskNames = sourceSets.stream()
134+
.map(SourceSet::getJavadocJarTaskName)
135+
.collect(Collectors.toSet());
134136
project.getTasks().withType(Jar.class, (jar) -> project.afterEvaluate((evaluated) -> {
135137
jar.metaInf((metaInf) -> metaInf.from(extractLegalResources));
136138
jar.manifest((manifest) -> {
@@ -167,7 +169,8 @@ private void configureTestConventions(Project project) {
167169
testRetry.getFailOnPassedAfterRetry().set(true);
168170
testRetry.getMaxRetries().set(isCi() ? 3 : 0);
169171
});
170-
project.getPlugins().withType(JavaPlugin.class, (javaPlugin) -> project.getDependencies()
172+
project.getPlugins()
173+
.withType(JavaPlugin.class, (javaPlugin) -> project.getDependencies()
171174
.add(JavaPlugin.TEST_RUNTIME_ONLY_CONFIGURATION_NAME, "org.junit.platform:junit-platform-launcher"));
172175
}
173176

@@ -220,7 +223,7 @@ private void configureSpringJavaFormat(Project project) {
220223
String version = SpringJavaFormatPlugin.class.getPackage().getImplementationVersion();
221224
DependencySet checkstyleDependencies = project.getConfigurations().getByName("checkstyle").getDependencies();
222225
checkstyleDependencies
223-
.add(project.getDependencies().create("io.spring.javaformat:spring-javaformat-checkstyle:" + version));
226+
.add(project.getDependencies().create("io.spring.javaformat:spring-javaformat-checkstyle:" + version));
224227
}
225228

226229
private void configureDependencyManagement(Project project) {
@@ -231,14 +234,18 @@ private void configureDependencyManagement(Project project) {
231234
configuration.setCanBeResolved(false);
232235
});
233236
configurations
234-
.matching((configuration) -> configuration.getName().endsWith("Classpath")
235-
|| JavaPlugin.ANNOTATION_PROCESSOR_CONFIGURATION_NAME.equals(configuration.getName()))
236-
.all((configuration) -> configuration.extendsFrom(dependencyManagement));
237-
Dependency springBootParent = project.getDependencies().enforcedPlatform(project.getDependencies()
237+
.matching((configuration) -> configuration.getName().endsWith("Classpath")
238+
|| JavaPlugin.ANNOTATION_PROCESSOR_CONFIGURATION_NAME.equals(configuration.getName()))
239+
.all((configuration) -> configuration.extendsFrom(dependencyManagement));
240+
Dependency springBootParent = project.getDependencies()
241+
.enforcedPlatform(project.getDependencies()
238242
.project(Collections.singletonMap("path", ":spring-boot-project:spring-boot-parent")));
239243
dependencyManagement.getDependencies().add(springBootParent);
240-
project.getPlugins().withType(OptionalDependenciesPlugin.class, (optionalDependencies) -> configurations
241-
.getByName(OptionalDependenciesPlugin.OPTIONAL_CONFIGURATION_NAME).extendsFrom(dependencyManagement));
244+
project.getPlugins()
245+
.withType(OptionalDependenciesPlugin.class,
246+
(optionalDependencies) -> configurations
247+
.getByName(OptionalDependenciesPlugin.OPTIONAL_CONFIGURATION_NAME)
248+
.extendsFrom(dependencyManagement));
242249
}
243250

244251
private void configureToolchain(Project project) {
@@ -260,9 +267,9 @@ private void createProhibitedDependenciesChecks(Project project, String... confi
260267
}
261268

262269
private void createProhibitedDependenciesCheck(Configuration classpath, Project project) {
263-
CheckClasspathForProhibitedDependencies checkClasspathForProhibitedDependencies = project.getTasks().create(
264-
"check" + StringUtils.capitalize(classpath.getName() + "ForProhibitedDependencies"),
265-
CheckClasspathForProhibitedDependencies.class);
270+
CheckClasspathForProhibitedDependencies checkClasspathForProhibitedDependencies = project.getTasks()
271+
.create("check" + StringUtils.capitalize(classpath.getName() + "ForProhibitedDependencies"),
272+
CheckClasspathForProhibitedDependencies.class);
266273
checkClasspathForProhibitedDependencies.setClasspath(classpath);
267274
project.getTasks().getByName(JavaBasePlugin.CHECK_TASK_NAME).dependsOn(checkClasspathForProhibitedDependencies);
268275
}

buildSrc/src/main/java/org/springframework/boot/build/KotlinConventions.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,9 @@
4444
class KotlinConventions {
4545

4646
void apply(Project project) {
47-
project.getPlugins().withId("org.jetbrains.kotlin.jvm",
48-
(plugin) -> project.getTasks().withType(KotlinCompile.class, this::configure));
47+
project.getPlugins()
48+
.withId("org.jetbrains.kotlin.jvm",
49+
(plugin) -> project.getTasks().withType(KotlinCompile.class, this::configure));
4950
}
5051

5152
private void configure(KotlinCompile compile) {

buildSrc/src/main/java/org/springframework/boot/build/MavenPublishingConventions.java

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,9 @@ void apply(Project project) {
6767
mavenRepository.setName("deployment");
6868
});
6969
}
70-
publishing.getPublications().withType(MavenPublication.class)
71-
.all((mavenPublication) -> customizeMavenPublication(mavenPublication, project));
70+
publishing.getPublications()
71+
.withType(MavenPublication.class)
72+
.all((mavenPublication) -> customizeMavenPublication(mavenPublication, project));
7273
project.getPlugins().withType(JavaPlugin.class).all((javaPlugin) -> {
7374
JavaPluginExtension extension = project.getExtensions().getByType(JavaPluginExtension.class);
7475
extension.withJavadocJar();
@@ -79,8 +80,9 @@ void apply(Project project) {
7980

8081
private void customizeMavenPublication(MavenPublication publication, Project project) {
8182
customizePom(publication.getPom(), project);
82-
project.getPlugins().withType(JavaPlugin.class)
83-
.all((javaPlugin) -> customizeJavaMavenPublication(publication, project));
83+
project.getPlugins()
84+
.withType(JavaPlugin.class)
85+
.all((javaPlugin) -> customizeJavaMavenPublication(publication, project));
8486
suppressMavenOptionalFeatureWarnings(publication);
8587
}
8688

@@ -102,7 +104,7 @@ private void customizePom(MavenPom pom, Project project) {
102104
private void customizeJavaMavenPublication(MavenPublication publication, Project project) {
103105
addMavenOptionalFeature(project);
104106
publication.versionMapping((strategy) -> strategy.usage(Usage.JAVA_API, (mappingStrategy) -> mappingStrategy
105-
.fromResolutionOf(JavaPlugin.RUNTIME_CLASSPATH_CONFIGURATION_NAME)));
107+
.fromResolutionOf(JavaPlugin.RUNTIME_CLASSPATH_CONFIGURATION_NAME)));
106108
publication.versionMapping(
107109
(strategy) -> strategy.usage(Usage.JAVA_RUNTIME, VariantVersionMappingStrategy::fromResolutionResult));
108110
}
@@ -117,7 +119,7 @@ private void addMavenOptionalFeature(Project project) {
117119
extension.registerFeature("mavenOptional",
118120
(feature) -> feature.usingSourceSet(extension.getSourceSets().getByName("main")));
119121
AdhocComponentWithVariants javaComponent = (AdhocComponentWithVariants) project.getComponents()
120-
.findByName("java");
122+
.findByName("java");
121123
javaComponent.addVariantsFromConfiguration(
122124
project.getConfigurations().findByName("mavenOptionalRuntimeElements"),
123125
ConfigurationVariantDetails::mapToOptional);

buildSrc/src/main/java/org/springframework/boot/build/MavenRepositoryPlugin.java

Lines changed: 30 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -61,36 +61,45 @@ public void apply(Project project) {
6161
mavenRepository.setName("project");
6262
mavenRepository.setUrl(repositoryLocation.toURI());
6363
});
64-
project.getTasks().matching((task) -> task.getName().equals(PUBLISH_TO_PROJECT_REPOSITORY_TASK_NAME))
65-
.all((task) -> setUpProjectRepository(project, task, repositoryLocation));
66-
project.getTasks().matching((task) -> task.getName().equals("publishPluginMavenPublicationToProjectRepository"))
67-
.all((task) -> setUpProjectRepository(project, task, repositoryLocation));
64+
project.getTasks()
65+
.matching((task) -> task.getName().equals(PUBLISH_TO_PROJECT_REPOSITORY_TASK_NAME))
66+
.all((task) -> setUpProjectRepository(project, task, repositoryLocation));
67+
project.getTasks()
68+
.matching((task) -> task.getName().equals("publishPluginMavenPublicationToProjectRepository"))
69+
.all((task) -> setUpProjectRepository(project, task, repositoryLocation));
6870
}
6971

7072
private void setUpProjectRepository(Project project, Task publishTask, File repositoryLocation) {
7173
publishTask.doFirst(new CleanAction(repositoryLocation));
7274
Configuration projectRepository = project.getConfigurations().create(MAVEN_REPOSITORY_CONFIGURATION_NAME);
73-
project.getArtifacts().add(projectRepository.getName(), repositoryLocation,
74-
(artifact) -> artifact.builtBy(publishTask));
75+
project.getArtifacts()
76+
.add(projectRepository.getName(), repositoryLocation, (artifact) -> artifact.builtBy(publishTask));
7577
DependencySet target = projectRepository.getDependencies();
76-
project.getPlugins().withType(JavaPlugin.class).all((javaPlugin) -> addMavenRepositoryDependencies(project,
77-
JavaPlugin.IMPLEMENTATION_CONFIGURATION_NAME, target));
78-
project.getPlugins().withType(JavaLibraryPlugin.class)
79-
.all((javaLibraryPlugin) -> addMavenRepositoryDependencies(project, JavaPlugin.API_CONFIGURATION_NAME,
80-
target));
81-
project.getPlugins().withType(JavaPlatformPlugin.class)
82-
.all((javaPlugin) -> addMavenRepositoryDependencies(project, JavaPlatformPlugin.API_CONFIGURATION_NAME,
83-
target));
78+
project.getPlugins()
79+
.withType(JavaPlugin.class)
80+
.all((javaPlugin) -> addMavenRepositoryDependencies(project, JavaPlugin.IMPLEMENTATION_CONFIGURATION_NAME,
81+
target));
82+
project.getPlugins()
83+
.withType(JavaLibraryPlugin.class)
84+
.all((javaLibraryPlugin) -> addMavenRepositoryDependencies(project, JavaPlugin.API_CONFIGURATION_NAME,
85+
target));
86+
project.getPlugins()
87+
.withType(JavaPlatformPlugin.class)
88+
.all((javaPlugin) -> addMavenRepositoryDependencies(project, JavaPlatformPlugin.API_CONFIGURATION_NAME,
89+
target));
8490
}
8591

8692
private void addMavenRepositoryDependencies(Project project, String sourceConfigurationName, DependencySet target) {
87-
project.getConfigurations().getByName(sourceConfigurationName).getDependencies()
88-
.withType(ProjectDependency.class).all((dependency) -> {
89-
Map<String, String> dependencyDescriptor = new HashMap<>();
90-
dependencyDescriptor.put("path", dependency.getDependencyProject().getPath());
91-
dependencyDescriptor.put("configuration", MAVEN_REPOSITORY_CONFIGURATION_NAME);
92-
target.add(project.getDependencies().project(dependencyDescriptor));
93-
});
93+
project.getConfigurations()
94+
.getByName(sourceConfigurationName)
95+
.getDependencies()
96+
.withType(ProjectDependency.class)
97+
.all((dependency) -> {
98+
Map<String, String> dependencyDescriptor = new HashMap<>();
99+
dependencyDescriptor.put("path", dependency.getDependencyProject().getPath());
100+
dependencyDescriptor.put("configuration", MAVEN_REPOSITORY_CONFIGURATION_NAME);
101+
target.add(project.getDependencies().project(dependencyDescriptor));
102+
});
94103
}
95104

96105
private static final class CleanAction implements Action<Task> {

buildSrc/src/main/java/org/springframework/boot/build/SyncAppSource.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public SyncAppSource() {
4444
this.sourceDirectory = objects.directoryProperty();
4545
this.destinationDirectory = objects.directoryProperty();
4646
this.pluginVersion = objects.property(String.class)
47-
.convention(getProject().provider(() -> getProject().getVersion().toString()));
47+
.convention(getProject().provider(() -> getProject().getVersion().toString()));
4848
}
4949

5050
@TaskAction

buildSrc/src/main/java/org/springframework/boot/build/architecture/ArchitecturePlugin.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -46,14 +46,14 @@ private void registerTasks(Project project) {
4646
JavaPluginExtension javaPluginExtension = project.getExtensions().getByType(JavaPluginExtension.class);
4747
List<TaskProvider<PackageTangleCheck>> packageTangleChecks = new ArrayList<>();
4848
for (SourceSet sourceSet : javaPluginExtension.getSourceSets()) {
49-
TaskProvider<PackageTangleCheck> checkPackageTangles = project.getTasks().register(
50-
"checkForPackageTangles" + StringUtils.capitalize(sourceSet.getName()), PackageTangleCheck.class,
51-
(task) -> {
52-
task.setClasses(sourceSet.getOutput().getClassesDirs());
53-
task.setDescription("Checks the classes of the " + sourceSet.getName()
54-
+ " source set for package tangles.");
55-
task.setGroup(LifecycleBasePlugin.VERIFICATION_GROUP);
56-
});
49+
TaskProvider<PackageTangleCheck> checkPackageTangles = project.getTasks()
50+
.register("checkForPackageTangles" + StringUtils.capitalize(sourceSet.getName()),
51+
PackageTangleCheck.class, (task) -> {
52+
task.setClasses(sourceSet.getOutput().getClassesDirs());
53+
task.setDescription("Checks the classes of the " + sourceSet.getName()
54+
+ " source set for package tangles.");
55+
task.setGroup(LifecycleBasePlugin.VERIFICATION_GROUP);
56+
});
5757
packageTangleChecks.add(checkPackageTangles);
5858
}
5959
if (!packageTangleChecks.isEmpty()) {

buildSrc/src/main/java/org/springframework/boot/build/architecture/PackageTangleCheck.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ public PackageTangleCheck() {
6161
@TaskAction
6262
void checkForPackageTangles() throws IOException {
6363
JavaClasses javaClasses = new ClassFileImporter()
64-
.importPaths(this.classes.getFiles().stream().map(File::toPath).collect(Collectors.toList()));
64+
.importPaths(this.classes.getFiles().stream().map(File::toPath).collect(Collectors.toList()));
6565
SliceRule freeOfCycles = SlicesRuleDefinition.slices().matching("(**)").should().beFreeOfCycles();
6666
EvaluationResult result = freeOfCycles.evaluate(javaClasses);
6767
File outputFile = getOutputDirectory().file("failure-report.txt").get().getAsFile();

buildSrc/src/main/java/org/springframework/boot/build/autoconfigure/AutoConfigurationMetadata.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,14 +58,14 @@ public class AutoConfigurationMetadata extends DefaultTask {
5858

5959
public AutoConfigurationMetadata() {
6060
getInputs()
61-
.file((Callable<File>) () -> new File(this.sourceSet.getOutput().getResourcesDir(),
62-
"META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports"))
63-
.withPathSensitivity(PathSensitivity.RELATIVE)
64-
.withPropertyName("org.springframework.boot.autoconfigure.AutoConfiguration");
61+
.file((Callable<File>) () -> new File(this.sourceSet.getOutput().getResourcesDir(),
62+
"META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports"))
63+
.withPathSensitivity(PathSensitivity.RELATIVE)
64+
.withPropertyName("org.springframework.boot.autoconfigure.AutoConfiguration");
6565

6666
dependsOn((Callable<String>) () -> this.sourceSet.getProcessResourcesTaskName());
6767
getProject().getConfigurations()
68-
.maybeCreate(AutoConfigurationPlugin.AUTO_CONFIGURATION_METADATA_CONFIGURATION_NAME);
68+
.maybeCreate(AutoConfigurationPlugin.AUTO_CONFIGURATION_METADATA_CONFIGURATION_NAME);
6969
}
7070

7171
public void setSourceSet(SourceSet sourceSet) {

0 commit comments

Comments
 (0)