Skip to content

Commit 32ca3cb

Browse files
committed
chore: fix app jvm args and kotlin compatibility check
1 parent 485b007 commit 32ca3cb

File tree

8 files changed

+25
-17
lines changed

8 files changed

+25
-17
lines changed

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,9 @@ $ ./gradlew checkBuildLogicBestPractices
5151
$ ./gradlew generateChangelog
5252
$ ./gradlew cleanAll
5353

54+
# Upgrade yarn lock file
55+
$ ./gradlew kotlinUpgradeYarnLock
56+
5457
# GitHub Actions lint
5558
$ actionlint
5659
```

backend/build.gradle.kts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,20 @@ import common.jvmArguments
22
import common.mppTargetName
33

44
plugins {
5-
application
65
plugins.kotlin.jvm
76
plugins.publishing
7+
application
88
}
99

1010
description = "Ktor backend application"
1111

12+
mppTargetName = "jvm"
13+
1214
application {
1315
mainClass = "AppKt"
1416
applicationDefaultJvmArgs += jvmArguments(forAppRun = true)
1517
}
1618

17-
mppTargetName = "jvm"
18-
1919
dependencies {
2020
implementation(projects.common)
2121
// Specify the classifier using variantOf

common/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ description = "Shared common module for all projects"
1111

1212
application {
1313
mainClass = libs.versions.app.mainclass
14-
applicationDefaultJvmArgs += jvmArguments()
14+
applicationDefaultJvmArgs += jvmArguments(forAppRun = true)
1515
}
1616

1717
buildConfig {

gradle/build-logic/common-plugins/src/main/kotlin/common/ProjectExtns.kt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -125,9 +125,6 @@ fun Project.jvmArguments(forAppRun: Boolean = false) = buildList {
125125
addAll(
126126
listOf(
127127
"--show-version",
128-
"-XshowSettings:vm",
129-
"-XshowSettings:system",
130-
"-XshowSettings:properties",
131128
"-XX:+PrintCommandLineFlags",
132129
"--enable-native-access=ALL-UNNAMED",
133130
"-Xmx96M",
@@ -180,6 +177,9 @@ fun Project.jvmArguments(forAppRun: Boolean = false) = buildList {
180177
"-Djdk.includeInExceptions=hostInfo,jar",
181178
"-Dkotlinx.coroutines.debug",
182179
// "-ea",
180+
// "-XshowSettings:vm",
181+
// "-XshowSettings:system",
182+
// "-XshowSettings:properties",
183183
// "--show-module-resolution",
184184
// "-XX:+ShowHiddenFrames",
185185
// "-XX:+AutoCreateSharedArchive",
@@ -301,8 +301,8 @@ fun KotlinCommonCompilerOptions.configureKotlinCommon() {
301301
freeCompilerArgs.addAll(
302302
"-Xcontext-receivers",
303303
"-Xallow-result-return-type",
304-
// "-P",
305-
// "plugin:androidx.compose.compiler.plugins.kotlin:suppressKotlinVersionCompatibilityCheck=true",
304+
"-P",
305+
"plugin:androidx.compose.compiler.plugins.kotlin:suppressKotlinVersionCompatibilityCheck=${kotlinVersion.get()}",
306306
// "-P",
307307
// "plugin:androidx.compose.compiler.plugins.kotlin:metricsDestination=...dir...",
308308
)

gradle/build-logic/common-plugins/src/main/kotlin/plugins/common.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ application { mainClass = libs.versions.app.mainclass }
4747

4848
@Suppress("UNUSED_VARIABLE")
4949
tasks {
50-
// run.invoke { args(true) }
50+
run.invoke { args(true) }
5151

5252
// Prints java module dependencies using jdeps
5353
val printModuleDeps by registering {

gradle/build-logic/common-plugins/src/main/kotlin/plugins/kotlin.jvm.gradle.kts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,11 @@ tasks {
8484
// finalizedBy("spotlessApply")
8585
}
8686

87-
withType<JavaExec> { jvmArgs(jvmArguments()) }
87+
withType<JavaExec>().configureEach {
88+
if (name != "run") {
89+
jvmArgs(jvmArguments())
90+
}
91+
}
8892

8993
// configure jvm target for ksp
9094
withType(KspTaskJvm::class).all {

gradle/build-logic/common-plugins/src/main/kotlin/plugins/kotlin.mpp.gradle.kts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ kotlinMultiplatform.apply {
4040
// Configure all compilations of all targets
4141
compilations.all {
4242
compileTaskProvider.configure { compilerOptions { configureKotlinCommon() } }
43-
compilerOptions.configure { configureKotlinCommon() }
43+
// compilerOptions.configure { configureKotlinCommon() }
4444
}
4545
}
4646

@@ -49,7 +49,8 @@ kotlinMultiplatform.apply {
4949
// withSourcesJar(publish = false)
5050
compilations.all {
5151
compileJavaTaskProvider?.configure { configureJavac() }
52-
compilerOptions.configure { configureKotlinJvm() }
52+
compileTaskProvider.configure { compilerOptions { configureKotlinJvm() } }
53+
// compilerOptions.configure { configureKotlinJvm() }
5354
}
5455

5556
// val test by testRuns.existing
@@ -61,7 +62,7 @@ kotlinMultiplatform.apply {
6162
jvm("desktop") {
6263
compilations.all {
6364
compileJavaTaskProvider?.configure { configureJavac() }
64-
compilerOptions.configure { configureKotlinJvm() }
65+
compileTaskProvider.configure { compilerOptions { configureKotlinJvm() } }
6566
}
6667
testRuns.configureEach { executionTask.configure { configureKotlinTest() } }
6768
// Attribute to distinguish Desktop target

gradle/libs.versions.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[versions]
22
java = "22"
3-
kotlin = "1.9.0"
4-
kotlin-ksp = "1.9.0-1.0.13"
3+
kotlin = "1.9.10"
4+
kotlin-ksp = "1.9.10-1.0.13"
55
kotlin-jvmtarget = "20"
66
kotlin-dsl-jvmtarget = "17"
77
kotlin-api-version = "1.9"
@@ -26,7 +26,7 @@ kotlinx-io = "0.2.1"
2626
kotlinx-atomicfu = "0.22.0"
2727
kotlinx-coroutines = "1.7.3"
2828
kotlinx-datetime = "0.4.0"
29-
kotlinx-serialization = "1.6.0-RC"
29+
kotlinx-serialization = "1.6.0"
3030
kotlinx-collections-immutable = "0.3.5"
3131
kotlinx-lincheck = "2.23"
3232
kotlinx-html = "0.9.1"

0 commit comments

Comments
 (0)