Skip to content

Commit 79fc77f

Browse files
committed
Upgrade to spring-javaformat 0.0.31
Closes gh-29633
1 parent 2b40ce0 commit 79fc77f

File tree

3 files changed

+20
-2
lines changed

3 files changed

+20
-2
lines changed

.springjavaformatconfig

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
java-baseline=8

buildSrc/gradle.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
javaFormatVersion=0.0.29
1+
javaFormatVersion=0.0.31

buildSrc/src/main/java/org/springframework/boot/build/mavenplugin/MavenPluginPlugin.java

+18-1
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@
3838
import javax.xml.xpath.XPathExpressionException;
3939
import javax.xml.xpath.XPathFactory;
4040

41+
import io.spring.javaformat.config.IndentationStyle;
42+
import io.spring.javaformat.config.JavaBaseline;
43+
import io.spring.javaformat.config.JavaFormatConfig;
4144
import io.spring.javaformat.formatter.FileEdit;
4245
import io.spring.javaformat.formatter.FileFormatter;
4346
import org.gradle.api.DefaultTask;
@@ -98,6 +101,20 @@
98101
*/
99102
public class MavenPluginPlugin implements Plugin<Project> {
100103

104+
private static final JavaFormatConfig FORMATTER_CONFIG = new JavaFormatConfig() {
105+
106+
@Override
107+
public JavaBaseline getJavaBaseline() {
108+
return JavaBaseline.V8;
109+
}
110+
111+
@Override
112+
public IndentationStyle getIndentationStyle() {
113+
return IndentationStyle.TABS;
114+
}
115+
116+
};
117+
101118
@Override
102119
public void apply(Project project) {
103120
project.getPlugins().apply(JavaLibraryPlugin.class);
@@ -297,7 +314,7 @@ void setOutputDir(File outputDir) {
297314

298315
@TaskAction
299316
void syncAndFormat() {
300-
FileFormatter formatter = new FileFormatter();
317+
FileFormatter formatter = new FileFormatter(FORMATTER_CONFIG);
301318
for (File output : this.generator.getOutputs().getFiles()) {
302319
formatter.formatFiles(getProject().fileTree(output), StandardCharsets.UTF_8)
303320
.forEach((edit) -> save(output, edit));

0 commit comments

Comments
 (0)