From 3524cf21c28a352a70d561fa9a0bb38f38d587a9 Mon Sep 17 00:00:00 2001 From: Clayton Walker Date: Mon, 3 Jun 2024 16:50:31 -0600 Subject: [PATCH] Simplify module compilation --- okio/build.gradle.kts | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/okio/build.gradle.kts b/okio/build.gradle.kts index c50f65c722..90aeea0e5f 100644 --- a/okio/build.gradle.kts +++ b/okio/build.gradle.kts @@ -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 { @@ -220,14 +222,11 @@ testing { tasks { val compileJava9Java by getting(JavaCompile::class) { - val compileKotlinJvm = named("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 }