Skip to content

Commit e3f4c86

Browse files
jushgithub-actions[bot]
authored andcommitted
Fix Ktlint format crashing on JVM 17+ (#6512)
Due to the [Java Platform Module System](http://openjdk.java.net/projects/jigsaw/spec/sotms) that was introduced in Java 9 `./gradlew ktlintFormat` was failing with error: ``` Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make field private transient java.lang.Object java.lang.Throwable.backtrace accessible: module java.base does not "opens java.lang" to unnamed module @3ab35c25 ``` This PR: - fixes it by adding the `add-opens` to `ktlinFormat` task. - Rewrote `ktlin.grale` to Kotlin. - From now on `build.gradle.kts` are also formatted cc @mapbox/maps-android GitOrigin-RevId: c784b4f85f976f9eba3629ccd223e333445b7ea0
1 parent fa67481 commit e3f4c86

File tree

26 files changed

+68
-59
lines changed

26 files changed

+68
-59
lines changed

android-auto-app/build.gradle.kts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ plugins {
22
id("com.mapbox.gradle.application")
33
}
44

5-
65
android {
76
compileSdk = libs.versions.autoCompileSdkVersion.get().toInt()
87
namespace = "com.mapbox.maps.testapp.auto"
@@ -61,7 +60,7 @@ dependencies {
6160
}
6261

6362
project.apply {
64-
from("$rootDir/gradle/ktlint.gradle")
63+
from("$rootDir/gradle/ktlint.gradle.kts")
6564
from("$rootDir/gradle/lint.gradle")
6665
from("$rootDir/gradle/dependency-updates.gradle")
6766
}

app/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ dependencies {
135135
}
136136

137137
project.apply {
138-
from("$rootDir/gradle/ktlint.gradle")
138+
from("$rootDir/gradle/ktlint.gradle.kts")
139139
from("$rootDir/gradle/lint.gradle")
140140
from("$rootDir/gradle/dependency-updates.gradle")
141141
}

compose-app/build.gradle.kts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ plugins {
33
id("org.jetbrains.kotlin.plugin.parcelize")
44
}
55

6-
76
android {
87
compileSdk = libs.versions.androidCompileSdkVersion.get().toInt()
98
namespace = "com.mapbox.maps.compose.testapp"
@@ -88,7 +87,7 @@ dependencies {
8887
}
8988

9089
project.apply {
91-
from("$rootDir/gradle/ktlint.gradle")
90+
from("$rootDir/gradle/ktlint.gradle.kts")
9291
from("$rootDir/gradle/lint.gradle")
9392
from("$rootDir/gradle/dependency-updates.gradle")
9493
}

extension-androidauto/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ dependencies {
4646
}
4747

4848
project.apply {
49-
from("$rootDir/gradle/ktlint.gradle")
49+
from("$rootDir/gradle/ktlint.gradle.kts")
5050
from("$rootDir/gradle/lint.gradle")
5151
from("$rootDir/gradle/track-public-apis.gradle")
5252
from("$rootDir/gradle/dependency-updates.gradle")

extension-compose/build.gradle.kts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@ mapboxLibrary {
6060
}
6161
}
6262

63-
6463
dependencies {
6564
dependencies {
6665
compileOnly(project(":maps-sdk"))
@@ -89,7 +88,7 @@ dependencies {
8988
}
9089

9190
project.apply {
92-
from("$rootDir/gradle/ktlint.gradle")
91+
from("$rootDir/gradle/ktlint.gradle.kts")
9392
from("$rootDir/gradle/lint.gradle")
9493
from("$rootDir/gradle/track-public-apis.gradle")
9594
from("$rootDir/gradle/dependency-updates.gradle")

extension-localization/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ dependencies {
3232
}
3333

3434
project.apply {
35-
from("$rootDir/gradle/ktlint.gradle")
35+
from("$rootDir/gradle/ktlint.gradle.kts")
3636
from("$rootDir/gradle/lint.gradle")
3737
from("$rootDir/gradle/track-public-apis.gradle")
3838
from("$rootDir/gradle/dependency-updates.gradle")

extension-style-app/build.gradle.kts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ plugins {
33
id("com.mapbox.maps.token")
44
}
55

6-
76
android {
87
compileSdk = libs.versions.androidCompileSdkVersion.get().toInt()
98
namespace = "com.mapbox.maps.extension.testapp"
@@ -28,7 +27,6 @@ android {
2827
execution = "ANDROIDX_TEST_ORCHESTRATOR"
2928
}
3029
}
31-
3230
}
3331

3432
dependencies {
@@ -45,10 +43,10 @@ dependencies {
4543
}
4644

4745
project.apply {
48-
from("$rootDir/gradle/ktlint.gradle")
46+
from("$rootDir/gradle/ktlint.gradle.kts")
4947
from("$rootDir/gradle/lint.gradle")
5048
from("$rootDir/gradle/dependency-updates.gradle")
5149
}
5250

53-
val localPath:String = org.apache.commons.io.FilenameUtils.getFullPathNoEndSeparator(project.buildscript.sourceFile.toString())
54-
the<com.mapbox.AccessTokenExtension>().file = "${localPath}/src/main/res/values/developer-config.xml"
51+
val localPath: String = org.apache.commons.io.FilenameUtils.getFullPathNoEndSeparator(project.buildscript.sourceFile.toString())
52+
the<com.mapbox.AccessTokenExtension>().file = "$localPath/src/main/res/values/developer-config.xml"

extension-style-lint-rules/build.gradle.kts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,17 @@ dependencies {
2121
compileOnly(libs.lintApi)
2222
compileOnly(libs.lintChecks)
2323
compileOnly(libs.kotlin)
24-
24+
2525
testImplementation(libs.junit)
2626
testImplementation(libs.lint)
2727
testImplementation(libs.lintTests)
2828
testImplementation(libs.testUtils)
2929
}
3030
project.apply {
31-
from("$rootDir/gradle/ktlint.gradle")
31+
from("$rootDir/gradle/ktlint.gradle.kts")
3232
from("$rootDir/gradle/dependency-updates.gradle")
3333
}
3434

3535
tasks.withType<Test> {
3636
maxParallelForks = (Runtime.getRuntime().availableProcessors()).takeIf { it > 0 } ?: 1
37-
}
37+
}

extension-style/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ dependencies {
3333
}
3434

3535
project.apply {
36-
from("$rootDir/gradle/ktlint.gradle")
36+
from("$rootDir/gradle/ktlint.gradle.kts")
3737
from("$rootDir/gradle/lint.gradle")
3838
from("$rootDir/gradle/track-public-apis.gradle")
3939
from("$rootDir/gradle/dependency-updates.gradle")

gradle/ktlint.gradle

Lines changed: 0 additions & 21 deletions
This file was deleted.

0 commit comments

Comments
 (0)