Skip to content

Commit

Permalink
Simplify module compilation
Browse files Browse the repository at this point in the history
  • Loading branch information
Sineaggi committed Jun 3, 2024
1 parent d9363fd commit 3524cf2
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions okio/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -196,8 +196,10 @@ kotlin {

val java9 by sourceSets.creating {
java.srcDir("src/jvmMain/java9")
compileClasspath = objects.fileCollection()
.from(configurations.named("jvmCompileClasspath"))
}

configurations.named("java9CompileClasspath") {
extendsFrom(configurations["jvmCompileClasspath"])
}

testing {
Expand All @@ -220,14 +222,11 @@ testing {

tasks {
val compileJava9Java by getting(JavaCompile::class) {
val compileKotlinJvm = named<KotlinCompile>("compileKotlinJvm")
.flatMap { it.destinationDirectory }.map { it.asFile.absolutePath }
inputs.dir(compileKotlinJvm)
options.compilerArgumentProviders.plusAssign(
CommandLineArgumentProvider {
listOf("--patch-module", "okio=${compileKotlinJvm.get()}")
},
)
dependsOn("compileKotlinJvm")
// https://kotlinlang.org/docs/gradle-configure-project.html#configure-with-java-modules-jpms-enabled
options.compilerArgumentProviders.add(CommandLineArgumentProvider {
listOf("--patch-module", "okio=${sourceSets["main"].output.asPath}")
})
options.release = 9
}

Expand Down

0 comments on commit 3524cf2

Please sign in to comment.