Skip to content

Commit df5898a

Browse files
committed
Reformat code following spring-javaformat upgrade
1 parent b93c9f7 commit df5898a

File tree

1,878 files changed

+27663
-22417
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,878 files changed

+27663
-22417
lines changed

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

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

@@ -87,12 +88,14 @@ private void upgradeAsciidoctorJVersion(Project project) {
8788

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

@@ -140,13 +143,15 @@ private void configureOptions(AbstractAsciidoctorTask asciidoctorTask) {
140143

141144
private Sync createSyncDocumentationSourceTask(Project project, AbstractAsciidoctorTask asciidoctorTask) {
142145
Sync syncDocumentationSource = project.getTasks()
143-
.create("syncDocumentationSourceFor" + StringUtils.capitalize(asciidoctorTask.getName()), Sync.class);
146+
.create("syncDocumentationSourceFor" + StringUtils.capitalize(asciidoctorTask.getName()), Sync.class);
144147
File syncedSource = new File(project.getBuildDir(), "docs/src/" + asciidoctorTask.getName());
145148
syncDocumentationSource.setDestinationDir(syncedSource);
146149
syncDocumentationSource.from("src/docs/");
147150
asciidoctorTask.dependsOn(syncDocumentationSource);
148-
asciidoctorTask.getInputs().dir(syncedSource).withPathSensitivity(PathSensitivity.RELATIVE)
149-
.withPropertyName("synced source");
151+
asciidoctorTask.getInputs()
152+
.dir(syncedSource)
153+
.withPathSensitivity(PathSensitivity.RELATIVE)
154+
.withPropertyName("synced source");
150155
asciidoctorTask.setSourceDir(project.relativePath(new File(syncedSource, "asciidoc/")));
151156
return syncDocumentationSource;
152157
}

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

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2022 the original author or authors.
2+
* Copyright 2012-2023 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -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: 23 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -120,16 +120,18 @@ void apply(Project project) {
120120
}
121121

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

@@ -214,7 +217,7 @@ private void configureSpringJavaFormat(Project project) {
214217
String version = SpringJavaFormatPlugin.class.getPackage().getImplementationVersion();
215218
DependencySet checkstyleDependencies = project.getConfigurations().getByName("checkstyle").getDependencies();
216219
checkstyleDependencies
217-
.add(project.getDependencies().create("io.spring.javaformat:spring-javaformat-checkstyle:" + version));
220+
.add(project.getDependencies().create("io.spring.javaformat:spring-javaformat-checkstyle:" + version));
218221
}
219222

220223
private void configureDependencyManagement(Project project) {
@@ -225,16 +228,19 @@ private void configureDependencyManagement(Project project) {
225228
configuration.setCanBeResolved(false);
226229
});
227230
configurations
228-
.matching((configuration) -> configuration.getName().endsWith("Classpath")
229-
|| JavaPlugin.ANNOTATION_PROCESSOR_CONFIGURATION_NAME.equals(configuration.getName()))
230-
.all((configuration) -> configuration.extendsFrom(dependencyManagement));
231+
.matching((configuration) -> configuration.getName().endsWith("Classpath")
232+
|| JavaPlugin.ANNOTATION_PROCESSOR_CONFIGURATION_NAME.equals(configuration.getName()))
233+
.all((configuration) -> configuration.extendsFrom(dependencyManagement));
231234
String path = project.getName().contains("spring-boot-starter")
232235
? ":spring-boot-project:spring-boot-dependencies" : ":spring-boot-project:spring-boot-parent";
233236
Dependency dependency = project.getDependencies()
234-
.enforcedPlatform(project.getDependencies().project(Collections.singletonMap("path", path)));
237+
.enforcedPlatform(project.getDependencies().project(Collections.singletonMap("path", path)));
235238
dependencyManagement.getDependencies().add(dependency);
236-
project.getPlugins().withType(OptionalDependenciesPlugin.class, (optionalDependencies) -> configurations
237-
.getByName(OptionalDependenciesPlugin.OPTIONAL_CONFIGURATION_NAME).extendsFrom(dependencyManagement));
239+
project.getPlugins()
240+
.withType(OptionalDependenciesPlugin.class,
241+
(optionalDependencies) -> configurations
242+
.getByName(OptionalDependenciesPlugin.OPTIONAL_CONFIGURATION_NAME)
243+
.extendsFrom(dependencyManagement));
238244
}
239245

240246
private void configureToolchain(Project project) {
@@ -256,9 +262,9 @@ private void createProhibitedDependenciesChecks(Project project, String... confi
256262
}
257263

258264
private void createProhibitedDependenciesCheck(Configuration classpath, Project project) {
259-
CheckClasspathForProhibitedDependencies checkClasspathForProhibitedDependencies = project.getTasks().create(
260-
"check" + StringUtils.capitalize(classpath.getName() + "ForProhibitedDependencies"),
261-
CheckClasspathForProhibitedDependencies.class);
265+
CheckClasspathForProhibitedDependencies checkClasspathForProhibitedDependencies = project.getTasks()
266+
.create("check" + StringUtils.capitalize(classpath.getName() + "ForProhibitedDependencies"),
267+
CheckClasspathForProhibitedDependencies.class);
262268
checkClasspathForProhibitedDependencies.setClasspath(classpath);
263269
project.getTasks().getByName(JavaBasePlugin.CHECK_TASK_NAME).dependsOn(checkClasspathForProhibitedDependencies);
264270
}

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2022 the original author or authors.
2+
* Copyright 2012-2023 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -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: 31 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2020 the original author or authors.
2+
* Copyright 2012-2023 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -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: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2021-2021 the original author or authors.
2+
* Copyright 2021-2023 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -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: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2022 the original author or authors.
2+
* Copyright 2012-2023 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -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: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2022-2022 the original author or authors.
2+
* Copyright 2022-2023 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -62,7 +62,7 @@ public PackageTangleCheck() {
6262
@TaskAction
6363
void checkForPackageTangles() throws IOException {
6464
JavaClasses javaClasses = new ClassFileImporter()
65-
.importPaths(this.classes.getFiles().stream().map(File::toPath).collect(Collectors.toList()));
65+
.importPaths(this.classes.getFiles().stream().map(File::toPath).collect(Collectors.toList()));
6666
SliceRule freeOfCycles = SlicesRuleDefinition.slices().matching("(**)").should().beFreeOfCycles();
6767
EvaluationResult result = freeOfCycles.evaluate(javaClasses);
6868
File outputFile = getOutputDirectory().file("failure-report.txt").get().getAsFile();

0 commit comments

Comments
 (0)