This is an automated email from the ASF dual-hosted git repository.

fanng pushed a commit to branch remove_release
in repository https://gitbox.apache.org/repos/asf/gravitino.git


The following commit(s) were added to refs/heads/remove_release by this push:
     new 4c5367d91b build: centralize JDK8 main compilation
4c5367d91b is described below

commit 4c5367d91b511d3219652251596a153cbe187cc7
Author: fanng <[email protected]>
AuthorDate: Fri Mar 13 15:23:07 2026 +0800

    build: centralize JDK8 main compilation
    
    Configure all JDK8-compatible projects to compile main sources with release 
8 while resolving and compiling tests with JDK 17. Also set JavaCompile 
encoding to UTF-8 so existing non-ASCII sources compile reliably.
---
 build.gradle.kts | 20 ++------------------
 1 file changed, 2 insertions(+), 18 deletions(-)

diff --git a/build.gradle.kts b/build.gradle.kts
index 19cd85aa8b..5832e9ba71 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -342,12 +342,6 @@ subprojects {
     ":spark-connector",
     ":flink-connector"
   )
-  val mainRelease8ProjectPrefixes = listOf(
-    ":spark-connector",
-    ":flink-connector",
-    ":clients:client-java"
-  )
-
   fun hasProjectPrefix(path: String, prefixes: List<String>): Boolean {
     return prefixes.any { path.startsWith(it) }
   }
@@ -357,11 +351,6 @@ subprojects {
     val name = project.name.lowercase()
     return name in jdk8CompatibleProjectNames || hasProjectPrefix(path, 
jdk8CompatibleProjectPrefixes)
   }
-
-  fun enforceMainRelease8(project: Project): Boolean {
-    val path = project.path.lowercase()
-    return hasProjectPrefix(path, mainRelease8ProjectPrefixes)
-  }
   extensions.extraProperties.set("excludePackagesForSparkConnector", 
::excludePackagesForSparkConnector)
 
   tasks.register("printJvm") {
@@ -396,12 +385,6 @@ subprojects {
     }
   }
 
-  tasks.withType<JavaCompile>().configureEach {
-    if (compatibleWithJDK8(project)) {
-      options.release.set(8)
-    }
-  }
-
   java {
     toolchain {
       // Some JDK vendors like Homebrew installed OpenJDK 17 have problems in 
building trino-connector:
@@ -423,7 +406,7 @@ subprojects {
     }
   }
 
-  if (enforceMainRelease8(project)) {
+  if (compatibleWithJDK8(project)) {
     tasks.named<JavaCompile>("compileJava") {
       options.release.set(8)
     }
@@ -463,6 +446,7 @@ subprojects {
   }
 
   tasks.withType<JavaCompile>().configureEach {
+    options.encoding = "UTF-8"
     options.errorprone.isEnabled.set(true)
     options.errorprone.disableWarningsInGeneratedCode.set(true)
     options.errorprone.disable(

Reply via email to