Skip to content

Commit 7d53b73

Browse files
snazyrenovate-bot
andauthored
Bump spotless to v7 (#697)
* Prepare version bump of spotless spotless v7 fails on Gradle with some `SerializationException`, moving the `callable` works around this issue (as [mentioned here](diffplug/spotless#2387)). Also removing the unnecessary `buildscript.dependencies` and the implied 2nd spotless version definition. * main: Update dependency com.diffplug.spotless:spotless-plugin-gradle to v7 * spotlessApply --------- Co-authored-by: Mend Renovate <[email protected]>
1 parent 9db2892 commit 7d53b73

File tree

15 files changed

+44
-43
lines changed

15 files changed

+44
-43
lines changed

api/iceberg-service/build.gradle.kts

+1-1
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ openApiGenerate {
100100
"CommitTableRequest" to "org.apache.polaris.service.types.CommitTableRequest",
101101
"NotificationRequest" to "org.apache.polaris.service.types.NotificationRequest",
102102
"TableUpdateNotification" to "org.apache.polaris.service.types.TableUpdateNotification",
103-
"NotificationType" to "org.apache.polaris.service.types.NotificationType"
103+
"NotificationType" to "org.apache.polaris.service.types.NotificationType",
104104
)
105105
}
106106

build-logic/src/main/kotlin/polaris-java.gradle.kts

+15-9
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
* under the License.
1818
*/
1919

20+
import com.diffplug.spotless.FormatterFunc
21+
import java.io.Serializable
2022
import net.ltgt.gradle.errorprone.errorprone
2123
import org.gradle.api.tasks.compile.JavaCompile
2224
import org.gradle.api.tasks.testing.Test
@@ -74,25 +76,29 @@ tasks.withType(Jar::class).configureEach {
7476
// manifests for release(-like) builds.
7577
"Implementation-Title" to "Apache Polaris(TM) (incubating)",
7678
"Implementation-Vendor" to "Apache Software Foundation",
77-
"Implementation-URL" to "https://polaris.apache.org/"
79+
"Implementation-URL" to "https://polaris.apache.org/",
7880
)
7981
}
8082
}
8183

8284
spotless {
83-
val disallowWildcardImports = { text: String ->
84-
val regex = "~/import .*\\.\\*;/".toRegex()
85-
if (regex.matches(text)) {
86-
throw GradleException("Wildcard imports disallowed - ${regex.findAll(text)}")
87-
}
88-
text
89-
}
9085
java {
9186
target("src/main/java/**/*.java", "src/testFixtures/java/**/*.java", "src/test/java/**/*.java")
9287
googleJavaFormat()
9388
licenseHeaderFile(rootProject.file("codestyle/copyright-header-java.txt"))
9489
endWithNewline()
95-
custom("disallowWildcardImports", disallowWildcardImports)
90+
custom(
91+
"disallowWildcardImports",
92+
object : Serializable, FormatterFunc {
93+
override fun apply(text: String): String {
94+
val regex = "~/import .*\\.\\*;/".toRegex()
95+
if (regex.matches(text)) {
96+
throw GradleException("Wildcard imports disallowed - ${regex.findAll(text)}")
97+
}
98+
return text
99+
}
100+
},
101+
)
96102
toggleOffOn()
97103
}
98104
kotlinGradle {

build-logic/src/main/kotlin/polaris-license-report.gradle.kts

+3-3
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@ afterEvaluate {
3131
arrayOf(
3232
LicenseBundleNormalizer(
3333
"${rootProject.projectDir}/gradle/license/normalizer-bundle.json",
34-
false
34+
false,
3535
),
36-
LicenseFileValidation()
36+
LicenseFileValidation(),
3737
)
3838
allowedLicensesFile = rootProject.projectDir.resolve("gradle/license/allowed-licenses.json")
3939
renderers =
@@ -48,7 +48,7 @@ val generateLicenseReport =
4848
inputs
4949
.files(
5050
rootProject.projectDir.resolve("gradle/license/normalizer-bundle.json"),
51-
rootProject.projectDir.resolve("gradle/license/allowed-licenses.json")
51+
rootProject.projectDir.resolve("gradle/license/allowed-licenses.json"),
5252
)
5353
.withPathSensitivity(PathSensitivity.RELATIVE)
5454
inputs.property("renderersHash", Arrays.hashCode(licenseReport.renderers))

build-logic/src/main/kotlin/publishing/MemoizedGitInfo.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ internal class MemoizedGitInfo {
8080
"Apache-Polaris-Build-Git-Describe" to gitDescribe,
8181
"Apache-Polaris-Build-Timestamp" to timestamp,
8282
"Apache-Polaris-Build-System" to system,
83-
"Apache-Polaris-Build-Java-Version" to javaVersion
83+
"Apache-Polaris-Build-Java-Version" to javaVersion,
8484
)
8585
rootProject.extra["gitReleaseInfo"] = info
8686
return info

build-logic/src/main/kotlin/publishing/configurePom.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ fun addMissingMandatoryDependencyVersions(project: Project, projectNode: Node) {
169169
findDependency(
170170
project.configurations.findByName("testRuntimeClasspath"),
171171
depGroup,
172-
depName
172+
depName,
173173
)
174174
}
175175

build-logic/src/main/kotlin/publishing/rootProject.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ internal fun configureOnRootProject(project: Project) =
5656
"--prefix=${e.baseName.get()}/",
5757
"--format=tar.gz",
5858
"--output=${e.sourceTarball.get().asFile.relativeTo(projectDir)}",
59-
"HEAD"
59+
"HEAD",
6060
)
6161
workingDir(project.projectDir)
6262
}

build-logic/src/main/kotlin/publishing/shadowPub.kt

+4-4
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ import org.gradle.api.publish.maven.MavenPublication
4242
internal fun configureShadowPublishing(
4343
project: Project,
4444
mavenPublication: MavenPublication,
45-
softwareComponentFactory: SoftwareComponentFactory
45+
softwareComponentFactory: SoftwareComponentFactory,
4646
) =
4747
project.run {
4848
fun isPublishable(element: ConfigurationVariant): Boolean {
@@ -64,15 +64,15 @@ internal fun configureShadowPublishing(
6464
attribute(Usage.USAGE_ATTRIBUTE, project.objects.named(Usage::class.java, Usage.JAVA_API))
6565
attribute(
6666
Category.CATEGORY_ATTRIBUTE,
67-
project.objects.named(Category::class.java, Category.LIBRARY)
67+
project.objects.named(Category::class.java, Category.LIBRARY),
6868
)
6969
attribute(
7070
LibraryElements.LIBRARY_ELEMENTS_ATTRIBUTE,
71-
project.objects.named(LibraryElements::class.java, LibraryElements.JAR)
71+
project.objects.named(LibraryElements::class.java, LibraryElements.JAR),
7272
)
7373
attribute(
7474
Bundling.BUNDLING_ATTRIBUTE,
75-
project.objects.named(Bundling::class.java, Bundling.SHADOWED)
75+
project.objects.named(Bundling::class.java, Bundling.SHADOWED),
7676
)
7777
}
7878
outgoing.artifact(shadowJar)

build-logic/src/main/kotlin/publishing/util.kt

+5-4
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ import org.gradle.api.artifacts.result.DependencyResult
3434
internal fun findDependency(
3535
config: Configuration?,
3636
depGroup: String,
37-
depName: String
37+
depName: String,
3838
): DependencyResult? {
3939
if (config != null) {
4040
val depResult =
@@ -78,7 +78,8 @@ internal fun generateDigest(input: File, output: File, algorithm: String) {
7878
}
7979

8080
internal fun <T : Any> unsafeCast(o: Any?): T {
81-
@Suppress("UNCHECKED_CAST") return o as T
81+
@Suppress("UNCHECKED_CAST")
82+
return o as T
8283
}
8384

8485
internal fun <T : Any> parseJson(url: String): T {
@@ -206,7 +207,7 @@ internal fun fetchProjectPeople(apacheId: String): ProjectPeople {
206207
licenseUrl,
207208
bugDatabase,
208209
inceptionYear,
209-
peopleList
210+
peopleList,
210211
)
211212
}
212213

@@ -219,7 +220,7 @@ internal class ProjectPeople(
219220
val licenseUrl: String,
220221
val bugDatabase: String,
221222
val inceptionYear: Int,
222-
val people: List<ProjectMember>
223+
val people: List<ProjectMember>,
223224
)
224225

225226
internal class ProjectMember(val apacheId: String, val name: String, val roles: List<String>)

build.gradle.kts

+1-6
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,7 @@
2020
import java.net.URI
2121
import org.nosphere.apache.rat.RatTask
2222

23-
buildscript {
24-
repositories { maven { url = java.net.URI("https://plugins.gradle.org/m2/") } }
25-
dependencies {
26-
classpath("com.diffplug.spotless:spotless-plugin-gradle:${libs.plugins.spotless.get().version}")
27-
}
28-
}
23+
buildscript { repositories { maven { url = java.net.URI("https://plugins.gradle.org/m2/") } } }
2924

3025
plugins {
3126
id("idea")

gradle/baselibs.versions.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,4 @@ idea-ext = { module = "gradle.plugin.org.jetbrains.gradle.plugin.idea-ext:gradle
2323
license-report = { module = "com.github.jk1:gradle-license-report", version = "2.9" }
2424
nexus-publish = { module = "io.github.gradle-nexus:publish-plugin", version = "2.0.0" }
2525
shadow = { module = "com.gradleup.shadow:shadow-gradle-plugin", version = "8.3.5" }
26-
spotless = { module = "com.diffplug.spotless:spotless-plugin-gradle", version = "6.25.0" }
26+
spotless = { module = "com.diffplug.spotless:spotless-plugin-gradle", version = "7.0.1" }

gradle/libs.versions.toml

-1
Original file line numberDiff line numberDiff line change
@@ -80,4 +80,3 @@ threeten-extra = { module = "org.threeten:threeten-extra", version = "1.8.0" }
8080
[plugins]
8181
openapi-generator = { id = "org.openapi.generator", version = "7.10.0" }
8282
rat = { id = "org.nosphere.apache.rat", version = "0.8.1" }
83-
spotless = { id = "com.diffplug.spotless", version = "6.25.0" }

polaris-core/src/main/java/org/apache/polaris/core/storage/PolarisStorageIntegrationProvider.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
*/
2727
public interface PolarisStorageIntegrationProvider {
2828
@SuppressWarnings("unchecked")
29-
<T extends PolarisStorageConfigurationInfo> @Nullable
30-
PolarisStorageIntegration<T> getStorageIntegrationForConfig(
29+
<T extends PolarisStorageConfigurationInfo>
30+
@Nullable PolarisStorageIntegration<T> getStorageIntegrationForConfig(
3131
PolarisStorageConfigurationInfo polarisStorageConfigurationInfo);
3232
}

service/common/src/main/java/org/apache/polaris/service/admin/PolarisServiceImpl.java

+4-4
Original file line numberDiff line numberDiff line change
@@ -519,8 +519,8 @@ public Response addGrantToCatalogRole(
519519
catalogName);
520520
PolarisAdminService adminService = newAdminService(realmContext, securityContext);
521521
switch (grantRequest.getGrant()) {
522-
// The per-securable-type Privilege enums must be exact String match for a subset of all
523-
// PolarisPrivilege values.
522+
// The per-securable-type Privilege enums must be exact String match for a subset of all
523+
// PolarisPrivilege values.
524524
case ViewGrant viewGrant:
525525
{
526526
PolarisPrivilege privilege =
@@ -595,8 +595,8 @@ public Response revokeGrantFromCatalogRole(
595595

596596
PolarisAdminService adminService = newAdminService(realmContext, securityContext);
597597
switch (grantRequest.getGrant()) {
598-
// The per-securable-type Privilege enums must be exact String match for a subset of all
599-
// PolarisPrivilege values.
598+
// The per-securable-type Privilege enums must be exact String match for a subset of all
599+
// PolarisPrivilege values.
600600
case ViewGrant viewGrant:
601601
{
602602
PolarisPrivilege privilege =

service/common/src/main/java/org/apache/polaris/service/catalog/BasePolarisCatalog.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -1735,16 +1735,16 @@ private void renameTableLike(
17351735
case BaseResult.ReturnStatus.ENTITY_NOT_FOUND:
17361736
throw new NotFoundException("Cannot rename %s to %s. %s does not exist", from, to, from);
17371737

1738-
// this is temporary. Should throw a special error that will be caught and retried
1738+
// this is temporary. Should throw a special error that will be caught and retried
17391739
case BaseResult.ReturnStatus.TARGET_ENTITY_CONCURRENTLY_MODIFIED:
17401740
case BaseResult.ReturnStatus.ENTITY_CANNOT_BE_RESOLVED:
17411741
throw new RuntimeException("concurrent update detected, please retry");
17421742

1743-
// some entities cannot be renamed
1743+
// some entities cannot be renamed
17441744
case BaseResult.ReturnStatus.ENTITY_CANNOT_BE_RENAMED:
17451745
throw new BadRequestException("Cannot rename built-in object %s", leafEntity.getName());
17461746

1747-
// some entities cannot be renamed
1747+
// some entities cannot be renamed
17481748
default:
17491749
throw new IllegalStateException(
17501750
"Unknown error status " + returnedEntityResult.getReturnStatus());

service/common/src/main/java/org/apache/polaris/service/storage/PolarisStorageIntegrationProviderImpl.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ public PolarisStorageIntegrationProviderImpl(
5454

5555
@Override
5656
@SuppressWarnings("unchecked")
57-
public <T extends PolarisStorageConfigurationInfo> @Nullable
58-
PolarisStorageIntegration<T> getStorageIntegrationForConfig(
57+
public <T extends PolarisStorageConfigurationInfo>
58+
@Nullable PolarisStorageIntegration<T> getStorageIntegrationForConfig(
5959
PolarisStorageConfigurationInfo polarisStorageConfigurationInfo) {
6060
if (polarisStorageConfigurationInfo == null) {
6161
return null;

0 commit comments

Comments
 (0)