Skip to content

Commit 7bfb790

Browse files
committed
Update JVM config and gradle
1 parent 29fb96f commit 7bfb790

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

buildSrc/src/main/kotlin/JvmConfig.kt

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ import org.jetbrains.kotlin.gradle.targets.jvm.KotlinJvmTarget
3030

3131

3232
inline fun KotlinJvmTarget.configJava(jdkVersion: Int, crossinline block: KotlinJvmTarget.() -> Unit = {}) {
33-
withJava()
3433
compilerOptions {
3534
javaParameters.set(true)
3635
jvmTarget.set(JvmTarget.fromTarget(jdkVersion.toString()))
@@ -88,12 +87,15 @@ inline fun Project.configJavaCompileWithModule(
8887
targetCompatibility = jvmVersion
8988

9089
if (moduleName != null) {
91-
options.compilerArgumentProviders.add(
92-
CommandLineArgumentProvider {
90+
options.compilerArgumentProviders.add(CommandLineArgumentProvider {
91+
val sourceSet = sourceSets.findByName("main") ?: sourceSets.findByName("jvmMain")
92+
if (sourceSet != null) {
9393
// Provide compiled Kotlin classes to javac – needed for Java/Kotlin mixed sources to work
94-
listOf("--patch-module", "$moduleName=${sourceSets["main"].output.asPath}")
94+
listOf("--patch-module", "$moduleName=${sourceSet.output.asPath}")
95+
} else {
96+
emptyList()
9597
}
96-
)
98+
})
9799
}
98100

99101
block()
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#Thu Mar 21 17:22:56 CST 2024
22
distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
4-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
4+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-bin.zip
55
zipStoreBase=GRADLE_USER_HOME
66
zipStorePath=wrapper/dists

0 commit comments

Comments
 (0)