Преглед на файлове

Make Javaformat and AOT work together

Spring JavaFormat seems to process all source directories,
including those that contain AOT-generated sources.

This causes failures for checkFormat as well as checkstyle.
These are failures that we can ignore since the source code
is generated.

Additionally, there is some kind of interaction between
JavaFormat and the Spring Boot AOT support that makes Gradle
think that compileJava and a few other tasks need to depend
on formatMain and formatTest.
Josh Cummings преди 11 месеца
родител
ревизия
93ebfca7b8
променени са 2 файла, в които са добавени 33 реда и са изтрити 8 реда
  1. 20 1
      build.gradle
  2. 13 7
      servlet/spring-boot/java/aot/data/build.gradle

+ 20 - 1
build.gradle

@@ -26,9 +26,29 @@ allprojects {
 		options.compilerArgs.add("-parameters")
 	}
 
+	tasks.matching { it.name == 'formatAot' }.all { task ->
+		task.enabled = false
+	}
+
+	tasks.matching { it.name == 'formatAotTest' }.all { task ->
+		task.enabled = false
+	}
+
 	tasks.matching { it.name == 'checkFormatAot' }.all { task ->
 		task.enabled = false
 	}
+
+	tasks.matching { it.name == 'checkFormatAotTest' }.all { task ->
+		task.enabled = false
+	}
+
+	tasks.matching { it.name == "checkstyleAot" }.all { task ->
+		task.enabled = false
+	}
+
+	tasks.matching { it.name == "checkstyleAotTest" }.all { task ->
+		task.enabled = false
+	}
 }
 
 if (hasProperty('buildScan')) {
@@ -51,4 +71,3 @@ tasks.register('runAllTests') {
 		allTestsTasks
 	}
 }
-

+ 13 - 7
servlet/spring-boot/java/aot/data/build.gradle

@@ -40,11 +40,17 @@ tasks.withType(Test).configureEach {
 	outputs.upToDateWhen { false }
 }
 
-compileJava {
-	dependsOn("formatMain")
+if (plugins.hasPlugin("io.spring.javaformat")) {
+	compileJava {
+		dependsOn("formatMain")
+	}
+	tasks.checkFormatMain {
+		dependsOn("formatMain")
+	}
+	compileTestJava {
+		dependsOn("formatTest")
+	}
+	tasks.checkFormatTest {
+		dependsOn("formatTest")
+	}
 }
-
-compileTestJava {
-	dependsOn("formatTest")
-}
-