Skip to content

Commit bffc4da

Browse files
committed
Try kotlin-multiplatform withJava approach
1 parent 18a2c42 commit bffc4da

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

okio/build.gradle.kts

+6-9
Original file line numberDiff line numberDiff line change
@@ -187,26 +187,23 @@ kotlin {
187187
}
188188
}
189189
}
190+
191+
jvm {
192+
withJava()
193+
}
190194
}
191195

192196
tasks {
193-
val compileModuleInfo by registering(JavaCompile::class) {
194-
classpath = objects.fileCollection()
195-
.from(configurations.named("jvmCompileClasspath"))
197+
named<JavaCompile>("compileJava") {
196198
val compileKotlinJvm = named<KotlinCompile>("compileKotlinJvm")
197199
dependsOn(compileKotlinJvm)
198200
options.compilerArgumentProviders.plusAssign(CommandLineArgumentProvider {
199201
listOf("--patch-module", "okio=${compileKotlinJvm.get().destinationDirectory.get().asFile.absolutePath}")
200202
})
201-
destinationDirectory = layout.buildDirectory.dir("classes/java/moduleInfo")
202-
options.release = 11
203-
source(layout.projectDirectory.dir("src/jvmMain/java"))
203+
options.release.set(11)
204204
}
205205

206206
val jvmJar by getting(Jar::class) {
207-
// BundleTaskConvention() crashes unless there's a 'main' source set.
208-
sourceSets.create(SourceSet.MAIN_SOURCE_SET_NAME)
209-
from(compileModuleInfo)
210207
val bndConvention = BundleTaskConvention(this)
211208
bndConvention.setBnd(
212209
"""

0 commit comments

Comments
 (0)