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
commit c080a700d4a656f55945b58d15d15fa6fed55c49 Author: fanng <[email protected]> AuthorDate: Wed Mar 11 21:15:42 2026 +0800 [#10262] build: remove release task and centralize JDK8 compatibility - remove the root Gradle release task and update release-build.sh to use build -x test\n- centralize JDK8 compatibility module matching and JavaCompile release configuration in root build logic\n- keep test compilation for spark/flink/client-java on release 17 with TargetJvmVersion=17 classpath attributes\n- drop duplicated client-java test JVM compatibility wiring from module build script\n- replace Map.of with Collections.emptyMap in flink connector to keep Java 8 API compatibility --- build.gradle.kts | 91 +++++++++++++++++------------------- clients/client-java/build.gradle.kts | 17 ------- dev/release/release-build.sh | 4 +- 3 files changed, 45 insertions(+), 67 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index bbd90c9f65..19cd85aa8b 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -24,6 +24,7 @@ import com.github.jk1.license.render.InventoryHtmlReportRenderer import com.github.jk1.license.render.ReportRenderer import com.github.vlsi.gradle.dsl.configureEach import net.ltgt.gradle.errorprone.errorprone +import org.gradle.api.attributes.java.TargetJvmVersion import org.gradle.api.tasks.testing.logging.TestExceptionFormat import org.gradle.internal.hash.ChecksumService import org.gradle.internal.os.OperatingSystem @@ -331,39 +332,35 @@ subprojects { mavenLocal() } - fun compatibleWithJDK8(project: Project): Boolean { - val name = project.name.lowercase() - val path = project.path.lowercase() - if (path.startsWith(":maintenance:jobs") || - path.startsWith(":maintenance:optimizer-api") || - path.startsWith(":maintenance:gravitino-updaters") || - path.startsWith(":clients:client-java") || - name == "api" || - name == "common" || - name == "catalog-common" || - name == "hadoop-common" - ) { - return true - } + val jdk8CompatibleProjectNames = setOf("api", "common", "catalog-common", "hadoop-common") + val jdk8CompatibleProjectPrefixes = listOf( + ":maintenance:jobs", + ":maintenance:optimizer-api", + ":maintenance:gravitino-updaters", + ":clients", + ":bundles", + ":spark-connector", + ":flink-connector" + ) + val mainRelease8ProjectPrefixes = listOf( + ":spark-connector", + ":flink-connector", + ":clients:client-java" + ) - val isReleaseRun = gradle.startParameter.taskNames.any { - it == "release" || it == "publish" || it == "publishToMavenLocal" || it.endsWith(":release") || it.endsWith( - ":publish" - ) || it.endsWith(":publishToMavenLocal") - } - if (!isReleaseRun) { - return false - } + fun hasProjectPrefix(path: String, prefixes: List<String>): Boolean { + return prefixes.any { path.startsWith(it) } + } - if (path.startsWith(":client") || - path.startsWith(":spark-connector") || - path.startsWith(":flink-connector") || - path.startsWith(":bundles") - ) { - return true - } + fun compatibleWithJDK8(project: Project): Boolean { + val path = project.path.lowercase() + val name = project.name.lowercase() + return name in jdk8CompatibleProjectNames || hasProjectPrefix(path, jdk8CompatibleProjectPrefixes) + } - return false + fun enforceMainRelease8(project: Project): Boolean { + val path = project.path.lowercase() + return hasProjectPrefix(path, mainRelease8ProjectPrefixes) } extensions.extraProperties.set("excludePackagesForSparkConnector", ::excludePackagesForSparkConnector) @@ -426,6 +423,22 @@ subprojects { } } + if (enforceMainRelease8(project)) { + tasks.named<JavaCompile>("compileJava") { + options.release.set(8) + } + + tasks.named<JavaCompile>("compileTestJava") { + options.release.set(17) + } + + val targetJvmVersionAttribute = TargetJvmVersion.TARGET_JVM_VERSION_ATTRIBUTE + configurations.matching { it.name in setOf("testCompileClasspath", "testRuntimeClasspath") } + .configureEach { + attributes.attribute(targetJvmVersionAttribute, 17) + } + } + gradle.projectsEvaluated { tasks.withType<JavaCompile> { options.compilerArgs.addAll( @@ -1313,21 +1326,3 @@ fun checkOrbStackStatus() { } printDockerCheckInfo() - -tasks.register("release") { - group = "release" - description = "Builds and package a release version." - doFirst { - println("Releasing project...") - } - - // Use 'assemble' instead of 'build' to skip tests during release - // Tests have JDK version conflicts (some need JDK 8, some need JDK 17) - // and should be run separately in CI/CD with appropriate JDK configurations - // Only include subprojects that apply the Java plugin (exclude client-python) - dependsOn( - subprojects - .filter { it.name != "client-python" } - .map { it.tasks.named("assemble") } - ) -} diff --git a/clients/client-java/build.gradle.kts b/clients/client-java/build.gradle.kts index 80d7093857..9a4f74a5fb 100644 --- a/clients/client-java/build.gradle.kts +++ b/clients/client-java/build.gradle.kts @@ -16,29 +16,12 @@ * specific language governing permissions and limitations * under the License. */ -import org.gradle.api.attributes.java.TargetJvmVersion -import org.gradle.api.tasks.compile.JavaCompile - plugins { `maven-publish` id("java") id("idea") } -tasks.named<JavaCompile>("compileTestJava") { - // client-java main artifact targets Java 8; tests depend on modules that publish Java 17 variants. - // Compile tests with release 17 to make Gradle variant matching for :core/:server test classpath deterministic. - options.release.set(17) -} - -val targetJvmVersionAttribute = TargetJvmVersion.TARGET_JVM_VERSION_ATTRIBUTE -configurations.named("testCompileClasspath") { - attributes.attribute(targetJvmVersionAttribute, 17) -} -configurations.named("testRuntimeClasspath") { - attributes.attribute(targetJvmVersionAttribute, 17) -} - dependencies { implementation(project(":api")) implementation(project(":common")) { diff --git a/dev/release/release-build.sh b/dev/release/release-build.sh index 0800453c24..99615298c0 100755 --- a/dev/release/release-build.sh +++ b/dev/release/release-build.sh @@ -348,8 +348,8 @@ if [[ "$1" == "publish-release" ]]; then cd .. $GRADLE clean - $GRADLE release -x test -PdefaultScalaVersion=2.12 - $GRADLE release -x test -PdefaultScalaVersion=2.13 + $GRADLE build -x test -PdefaultScalaVersion=2.12 + $GRADLE build -x test -PdefaultScalaVersion=2.13 $GRADLE -Dmaven.repo.local=$tmp_repo publishToMavenLocal -PdefaultScalaVersion=2.12 $GRADLE -Dmaven.repo.local=$tmp_repo publishToMavenLocal -PdefaultScalaVersion=2.13
