You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@polaris.apache.org by sn...@apache.org on 2026/06/16 06:26:21 UTC
(polaris) branch main updated: Build: remove another usage of `Project.extra` (#4775)
This is an automated email from the ASF dual-hosted git repository.
snazy pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/polaris.git
The following commit(s) were added to refs/heads/main by this push:
new cbb2cda1d9 Build: remove another usage of `Project.extra` (#4775)
cbb2cda1d9 is described below
commit cbb2cda1d9b6f9901aa43d299593133e47b96010
Author: Robert Stupp <sn...@snazy.de>
AuthorDate: Tue Jun 16 08:26:17 2026 +0200
Build: remove another usage of `Project.extra` (#4775)
* Replaced with simple `noSourceCheckProjects` in `Utilities.kt`
* Evaluate in polaris-spotless and polaris-java convention plugins
---
build-logic/src/main/kotlin/Utilities.kt | 2 ++
build-logic/src/main/kotlin/polaris-java.gradle.kts | 10 ++++++++--
build-logic/src/main/kotlin/polaris-root.gradle.kts | 12 +-----------
build-logic/src/main/kotlin/polaris-spotless.gradle.kts | 16 ++++++++++++++--
settings.gradle.kts | 10 ----------
5 files changed, 25 insertions(+), 25 deletions(-)
diff --git a/build-logic/src/main/kotlin/Utilities.kt b/build-logic/src/main/kotlin/Utilities.kt
index f75ff5b3f8..d700fc2a83 100644
--- a/build-logic/src/main/kotlin/Utilities.kt
+++ b/build-logic/src/main/kotlin/Utilities.kt
@@ -17,6 +17,8 @@
import org.gradle.api.Project
import org.gradle.process.JavaForkOptions
+val noSourceCheckProjects = listOf(":polaris-spark-3.5_2.13", ":polaris-spark-integration-3.5_2.13")
+
/**
* Extract the scala version from polaris spark project, and points the build directory to a sub-dir
* that uses scala version as name. The polaris spark project name is in format of
diff --git a/build-logic/src/main/kotlin/polaris-java.gradle.kts b/build-logic/src/main/kotlin/polaris-java.gradle.kts
index 603b5985e7..b498824f7e 100644
--- a/build-logic/src/main/kotlin/polaris-java.gradle.kts
+++ b/build-logic/src/main/kotlin/polaris-java.gradle.kts
@@ -78,8 +78,14 @@ checkstyle {
maxWarnings = 0
}
-// Ensure Checkstyle runs after jandex to avoid task dependency issues
-tasks.withType<Checkstyle>().configureEach { tasks.findByName("jandex")?.let { mustRunAfter(it) } }
+tasks.withType<Checkstyle>().configureEach {
+ if (noSourceCheckProjects.contains(project.path)) {
+ enabled = false
+ } else {
+ // Ensure Checkstyle runs after jandex to avoid task dependency issues
+ tasks.findByName("jandex")?.let { mustRunAfter(it) }
+ }
+}
tasks.withType(JavaCompile::class.java).configureEach {
options.compilerArgs.addAll(
diff --git a/build-logic/src/main/kotlin/polaris-root.gradle.kts b/build-logic/src/main/kotlin/polaris-root.gradle.kts
index 4e9b4584c0..34fac94679 100644
--- a/build-logic/src/main/kotlin/polaris-root.gradle.kts
+++ b/build-logic/src/main/kotlin/polaris-root.gradle.kts
@@ -25,22 +25,12 @@ import publishing.PublishingHelperPlugin
plugins {
id("polaris-base")
- id("com.diffplug.spotless")
+ id("polaris-spotless")
id("org.jetbrains.gradle.plugin.idea-ext")
}
apply<PublishingHelperPlugin>()
-if (!project.extra.has("duplicated-project-sources")) {
- spotless {
- kotlinGradle {
- ktfmt().googleStyle()
- // licenseHeaderFile(rootProject.file("codestyle/copyright-header-java.txt"), "$")
- target("*.gradle.kts", "build-logic/*.gradle.kts", "build-logic/src/**/*.kt*")
- }
- }
-}
-
if (providers.systemProperty("idea.sync.active").getOrElse("false").toBoolean()) {
idea {
module {
diff --git a/build-logic/src/main/kotlin/polaris-spotless.gradle.kts b/build-logic/src/main/kotlin/polaris-spotless.gradle.kts
index b6ae54efa6..a6ccae867b 100644
--- a/build-logic/src/main/kotlin/polaris-spotless.gradle.kts
+++ b/build-logic/src/main/kotlin/polaris-spotless.gradle.kts
@@ -20,8 +20,20 @@
plugins { id("com.diffplug.spotless") }
// skip spotless check for duplicated projects
-if (!project.extra.has("duplicated-project-sources")) {
- spotless {
+spotless {
+ if (project.path == ":") {
+ // Root project
+ kotlinGradle {
+ ktfmt().googleStyle()
+ target(
+ "*.gradle.kts",
+ "build-logic/*.gradle.kts",
+ "build-logic/src/**/*.kt*",
+ "gradle/server-test-runner/**/*.gradle.kts",
+ "gradle/server-test-runner/src/**/*.kt*",
+ )
+ }
+ } else if (!noSourceCheckProjects.contains(project.path)) {
java {
target("src/*/java/**/*.java")
googleJavaFormat()
diff --git a/settings.gradle.kts b/settings.gradle.kts
index 8e4db0cb62..1958bd9abb 100644
--- a/settings.gradle.kts
+++ b/settings.gradle.kts
@@ -55,10 +55,6 @@ val baseVersion = layout.rootDirectory.file("version.txt").asFile.readText().tri
gradle.beforeProject {
version = baseVersion
group = "org.apache.polaris"
-
- if (noSourceChecksProjects.contains(this.path)) {
- project.extra["duplicated-project-sources"] = true
- }
}
fun loadProperties(file: File): Properties {
@@ -87,9 +83,6 @@ val polarisSparkDir = "plugins/spark"
val sparkScalaVersions = loadProperties(file("${polarisSparkDir}/spark-scala.properties"))
val sparkVersions = sparkScalaVersions["sparkVersions"].toString().split(",").map { it.trim() }
-// records the spark projects that maps to the same project dir
-val noSourceChecksProjects = mutableSetOf<String>()
-
for (sparkVersion in sparkVersions) {
val scalaVersionsKey = "scalaVersions.${sparkVersion}"
val scalaVersionsStr = sparkScalaVersions[scalaVersionsKey].toString()
@@ -108,9 +101,6 @@ for (sparkVersion in sparkVersions) {
)
if (first) {
first = false
- } else {
- noSourceChecksProjects.add(":$sparkArtifactId")
- noSourceChecksProjects.add(":$sparkIntArtifactId")
}
// Skip all duplicated spark client projects while using Intelij IDE.
// This is to avoid problems during dependency analysis and sync when