Skip to content

Commit c5b8366

Browse files
committed
Reformat with fluent style
1 parent e42a506 commit c5b8366

File tree

1,006 files changed

+10312
-4905
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,006 files changed

+10312
-4905
lines changed

buildSrc/build.gradle

+1
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

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
javaFormatVersion=0.0.35
1+
javaFormatVersion=0.0.36-SNAPSHOT

buildSrc/settings.gradle

+1
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

+11-6
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,10 +87,12 @@ 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+
project.getConfigurations()
91+
.matching((candidate) -> "dependencyManagement".equals(candidate.getName()))
9092
.all(configuration::extendsFrom);
91-
configuration.getDependencies().add(project.getDependencies()
92-
.create("io.spring.asciidoctor.backends:spring-asciidoctor-backends:0.0.4"));
93+
configuration.getDependencies()
94+
.add(project.getDependencies()
95+
.create("io.spring.asciidoctor.backends:spring-asciidoctor-backends:0.0.4"));
9396
configuration.getDependencies()
9497
.add(project.getDependencies().create("org.asciidoctor:asciidoctorj-pdf:1.5.3"));
9598
});
@@ -142,7 +145,9 @@ private Sync createSyncDocumentationSourceTask(Project project, AbstractAsciidoc
142145
syncDocumentationSource.setDestinationDir(syncedSource);
143146
syncDocumentationSource.from("src/docs/");
144147
asciidoctorTask.dependsOn(syncDocumentationSource);
145-
asciidoctorTask.getInputs().dir(syncedSource).withPathSensitivity(PathSensitivity.RELATIVE)
148+
asciidoctorTask.getInputs()
149+
.dir(syncedSource)
150+
.withPathSensitivity(PathSensitivity.RELATIVE)
146151
.withPropertyName("synced source");
147152
asciidoctorTask.setSourceDir(project.relativePath(new File(syncedSource, "asciidoc/")));
148153
return syncDocumentationSource;

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

+7-3
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"))
49+
project.getComponents()
50+
.matching((component) -> component.getName().equals("java"))
5051
.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

+22-13
Original file line numberDiff line numberDiff line change
@@ -121,15 +121,17 @@ 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)
130+
Set<String> sourceJarTaskNames = sourceSets.stream()
131+
.map(SourceSet::getSourcesJarTaskName)
131132
.collect(Collectors.toSet());
132-
Set<String> javadocJarTaskNames = sourceSets.stream().map(SourceSet::getJavadocJarTaskName)
133+
Set<String> javadocJarTaskNames = sourceSets.stream()
134+
.map(SourceSet::getJavadocJarTaskName)
133135
.collect(Collectors.toSet());
134136
project.getTasks().withType(Jar.class, (jar) -> project.afterEvaluate((evaluated) -> {
135137
jar.metaInf((metaInf) -> metaInf.from(extractLegalResources));
@@ -167,8 +169,11 @@ 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()
171-
.add(JavaPlugin.TEST_RUNTIME_ONLY_CONFIGURATION_NAME, "org.junit.platform:junit-platform-launcher"));
172+
project.getPlugins()
173+
.withType(JavaPlugin.class,
174+
(javaPlugin) -> project.getDependencies()
175+
.add(JavaPlugin.TEST_RUNTIME_ONLY_CONFIGURATION_NAME,
176+
"org.junit.platform:junit-platform-launcher"));
172177
}
173178

174179
private boolean isCi() {
@@ -234,11 +239,15 @@ private void configureDependencyManagement(Project project) {
234239
.matching((configuration) -> configuration.getName().endsWith("Classpath")
235240
|| JavaPlugin.ANNOTATION_PROCESSOR_CONFIGURATION_NAME.equals(configuration.getName()))
236241
.all((configuration) -> configuration.extendsFrom(dependencyManagement));
237-
Dependency springBootParent = project.getDependencies().enforcedPlatform(project.getDependencies()
238-
.project(Collections.singletonMap("path", ":spring-boot-project:spring-boot-parent")));
242+
Dependency springBootParent = project.getDependencies()
243+
.enforcedPlatform(project.getDependencies()
244+
.project(Collections.singletonMap("path", ":spring-boot-project:spring-boot-parent")));
239245
dependencyManagement.getDependencies().add(springBootParent);
240-
project.getPlugins().withType(OptionalDependenciesPlugin.class, (optionalDependencies) -> configurations
241-
.getByName(OptionalDependenciesPlugin.OPTIONAL_CONFIGURATION_NAME).extendsFrom(dependencyManagement));
246+
project.getPlugins()
247+
.withType(OptionalDependenciesPlugin.class,
248+
(optionalDependencies) -> configurations
249+
.getByName(OptionalDependenciesPlugin.OPTIONAL_CONFIGURATION_NAME)
250+
.extendsFrom(dependencyManagement));
242251
}
243252

244253
private void configureToolchain(Project project) {
@@ -260,9 +269,9 @@ private void createProhibitedDependenciesChecks(Project project, String... confi
260269
}
261270

262271
private void createProhibitedDependenciesCheck(Configuration classpath, Project project) {
263-
CheckClasspathForProhibitedDependencies checkClasspathForProhibitedDependencies = project.getTasks().create(
264-
"check" + StringUtils.capitalize(classpath.getName() + "ForProhibitedDependencies"),
265-
CheckClasspathForProhibitedDependencies.class);
272+
CheckClasspathForProhibitedDependencies checkClasspathForProhibitedDependencies = project.getTasks()
273+
.create("check" + StringUtils.capitalize(classpath.getName() + "ForProhibitedDependencies"),
274+
CheckClasspathForProhibitedDependencies.class);
266275
checkClasspathForProhibitedDependencies.setClasspath(classpath);
267276
project.getTasks().getByName(JavaBasePlugin.CHECK_TASK_NAME).dependsOn(checkClasspathForProhibitedDependencies);
268277
}

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

+3-2
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

+4-2
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,8 @@ void apply(Project project) {
6767
mavenRepository.setName("deployment");
6868
});
6969
}
70-
publishing.getPublications().withType(MavenPublication.class)
70+
publishing.getPublications()
71+
.withType(MavenPublication.class)
7172
.all((mavenPublication) -> customizeMavenPublication(mavenPublication, project));
7273
project.getPlugins().withType(JavaPlugin.class).all((javaPlugin) -> {
7374
JavaPluginExtension extension = project.getExtensions().getByType(JavaPluginExtension.class);
@@ -79,7 +80,8 @@ 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+
project.getPlugins()
84+
.withType(JavaPlugin.class)
8385
.all((javaPlugin) -> customizeJavaMavenPublication(publication, project));
8486
suppressMavenOptionalFeatureWarnings(publication);
8587
}

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

+19-10
Original file line numberDiff line numberDiff line change
@@ -61,31 +61,40 @@ 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))
64+
project.getTasks()
65+
.matching((task) -> task.getName().equals(PUBLISH_TO_PROJECT_REPOSITORY_TASK_NAME))
6566
.all((task) -> setUpProjectRepository(project, task, repositoryLocation));
66-
project.getTasks().matching((task) -> task.getName().equals("publishPluginMavenPublicationToProjectRepository"))
67+
project.getTasks()
68+
.matching((task) -> task.getName().equals("publishPluginMavenPublicationToProjectRepository"))
6769
.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)
78+
project.getPlugins()
79+
.withType(JavaPlugin.class)
80+
.all((javaPlugin) -> addMavenRepositoryDependencies(project,
81+
JavaPlugin.IMPLEMENTATION_CONFIGURATION_NAME, target));
82+
project.getPlugins()
83+
.withType(JavaLibraryPlugin.class)
7984
.all((javaLibraryPlugin) -> addMavenRepositoryDependencies(project, JavaPlugin.API_CONFIGURATION_NAME,
8085
target));
81-
project.getPlugins().withType(JavaPlatformPlugin.class)
86+
project.getPlugins()
87+
.withType(JavaPlatformPlugin.class)
8288
.all((javaPlugin) -> addMavenRepositoryDependencies(project, JavaPlatformPlugin.API_CONFIGURATION_NAME,
8389
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) -> {
93+
project.getConfigurations()
94+
.getByName(sourceConfigurationName)
95+
.getDependencies()
96+
.withType(ProjectDependency.class)
97+
.all((dependency) -> {
8998
Map<String, String> dependencyDescriptor = new HashMap<>();
9099
dependencyDescriptor.put("path", dependency.getDependencyProject().getPath());
91100
dependencyDescriptor.put("configuration", MAVEN_REPOSITORY_CONFIGURATION_NAME);

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

+8-8
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/autoconfigure/AutoConfigurationPlugin.java

+13-7
Original file line numberDiff line numberDiff line change
@@ -60,19 +60,25 @@ public void apply(Project project) {
6060
Configuration annotationProcessors = project.getConfigurations()
6161
.getByName(JavaPlugin.ANNOTATION_PROCESSOR_CONFIGURATION_NAME);
6262
annotationProcessors.getDependencies()
63-
.add(project.getDependencies().project(Collections.singletonMap("path",
64-
":spring-boot-project:spring-boot-tools:spring-boot-autoconfigure-processor")));
63+
.add(project.getDependencies()
64+
.project(Collections.singletonMap("path",
65+
":spring-boot-project:spring-boot-tools:spring-boot-autoconfigure-processor")));
6566
annotationProcessors.getDependencies()
66-
.add(project.getDependencies().project(Collections.singletonMap("path",
67-
":spring-boot-project:spring-boot-tools:spring-boot-configuration-processor")));
67+
.add(project.getDependencies()
68+
.project(Collections.singletonMap("path",
69+
":spring-boot-project:spring-boot-tools:spring-boot-configuration-processor")));
6870
project.getTasks().create("autoConfigurationMetadata", AutoConfigurationMetadata.class, (task) -> {
69-
SourceSet main = project.getExtensions().getByType(JavaPluginExtension.class).getSourceSets()
71+
SourceSet main = project.getExtensions()
72+
.getByType(JavaPluginExtension.class)
73+
.getSourceSets()
7074
.getByName(SourceSet.MAIN_SOURCE_SET_NAME);
7175
task.setSourceSet(main);
7276
task.dependsOn(main.getClassesTaskName());
7377
task.setOutputFile(new File(project.getBuildDir(), "auto-configuration-metadata.properties"));
74-
project.getArtifacts().add(AutoConfigurationPlugin.AUTO_CONFIGURATION_METADATA_CONFIGURATION_NAME,
75-
project.provider((Callable<File>) task::getOutputFile), (artifact) -> artifact.builtBy(task));
78+
project.getArtifacts()
79+
.add(AutoConfigurationPlugin.AUTO_CONFIGURATION_METADATA_CONFIGURATION_NAME,
80+
project.provider((Callable<File>) task::getOutputFile),
81+
(artifact) -> artifact.builtBy(task));
7682
});
7783
});
7884
}

buildSrc/src/main/java/org/springframework/boot/build/bom/BomExtension.java

+13-9
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,8 @@ public void library(String name, String version, Action<LibraryHandler> action)
125125

126126
public void effectiveBomArtifact() {
127127
Configuration effectiveBomConfiguration = this.project.getConfigurations().create("effectiveBom");
128-
this.project.getTasks().matching((task) -> task.getName().equals(DeployedPlugin.GENERATE_POM_TASK_NAME))
128+
this.project.getTasks()
129+
.matching((task) -> task.getName().equals(DeployedPlugin.GENERATE_POM_TASK_NAME))
129130
.all((task) -> {
130131
Sync syncBom = this.project.getTasks().create("syncBom", Sync.class);
131132
syncBom.dependsOn(task);
@@ -145,8 +146,8 @@ public void effectiveBomArtifact() {
145146
catch (IOException ex) {
146147
throw new GradleException("Failed to prepare settings.xml", ex);
147148
}
148-
MavenExec generateEffectiveBom = this.project.getTasks().create("generateEffectiveBom",
149-
MavenExec.class);
149+
MavenExec generateEffectiveBom = this.project.getTasks()
150+
.create("generateEffectiveBom", MavenExec.class);
150151
generateEffectiveBom.setProjectDir(generatedBomDir);
151152
File effectiveBom = new File(this.project.getBuildDir(),
152153
"generated/effective-bom/" + this.project.getName() + "-effective-bom.xml");
@@ -155,8 +156,9 @@ public void effectiveBomArtifact() {
155156
generateEffectiveBom.dependsOn(syncBom);
156157
generateEffectiveBom.getOutputs().file(effectiveBom);
157158
generateEffectiveBom.doLast(new StripUnrepeatableOutputAction(effectiveBom));
158-
this.project.getArtifacts().add(effectiveBomConfiguration.getName(), effectiveBom,
159-
(artifact) -> artifact.builtBy(generateEffectiveBom));
159+
this.project.getArtifacts()
160+
.add(effectiveBomConfiguration.getName(), effectiveBom,
161+
(artifact) -> artifact.builtBy(generateEffectiveBom));
160162
});
161163
}
162164

@@ -196,8 +198,9 @@ private void addLibrary(Library library) {
196198
for (Group group : library.getGroups()) {
197199
for (Module module : group.getModules()) {
198200
putArtifactVersionProperty(group.getId(), module.getName(), module.getClassifier(), versionProperty);
199-
this.dependencyHandler.getConstraints().add(JavaPlatformPlugin.API_CONFIGURATION_NAME,
200-
createDependencyNotation(group.getId(), module.getName(), library.getVersion().getVersion()));
201+
this.dependencyHandler.getConstraints()
202+
.add(JavaPlatformPlugin.API_CONFIGURATION_NAME, createDependencyNotation(group.getId(),
203+
module.getName(), library.getVersion().getVersion()));
201204
}
202205
for (String bomImport : group.getBoms()) {
203206
putArtifactVersionProperty(group.getId(), bomImport, versionProperty);
@@ -530,8 +533,9 @@ public void execute(Task task) {
530533
org.w3c.dom.Node reporting = (org.w3c.dom.Node) xpath.evaluate("/project/reporting", document,
531534
XPathConstants.NODE);
532535
reporting.getParentNode().removeChild(reporting);
533-
TransformerFactory.newInstance().newTransformer().transform(new DOMSource(document),
534-
new StreamResult(this.effectiveBom));
536+
TransformerFactory.newInstance()
537+
.newTransformer()
538+
.transform(new DOMSource(document), new StreamResult(this.effectiveBom));
535539
}
536540
catch (Exception ex) {
537541
throw new TaskExecutionException(task, ex);

0 commit comments

Comments
 (0)