Skip to content

Commit

Permalink
Use sourceSets
Browse files Browse the repository at this point in the history
  • Loading branch information
Sineaggi committed Jun 1, 2024
1 parent 8924329 commit 03e81b8
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions okio/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -189,26 +189,28 @@ kotlin {
}
}

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

tasks {
val compileModuleInfo by registering(JavaCompile::class) {
classpath = objects.fileCollection()
.from(configurations.named("jvmCompileClasspath"))
val compileJava9Java by getting(JavaCompile::class) {
val compileKotlinJvm = named<KotlinCompile>("compileKotlinJvm")
dependsOn(compileKotlinJvm)
options.compilerArgumentProviders.plusAssign(
CommandLineArgumentProvider {
listOf("--patch-module", "okio=${compileKotlinJvm.get().destinationDirectory.get().asFile.absolutePath}")
},
)
destinationDirectory = layout.buildDirectory.dir("classes/java/moduleInfo")
options.release = 9
source(layout.projectDirectory.dir("src/jvmMain/java"))
}

val jvmJar by getting(Jar::class) {
// BundleTaskConvention() crashes unless there's a 'main' source set.
sourceSets.create(SourceSet.MAIN_SOURCE_SET_NAME)
from(compileModuleInfo) {
from(compileJava9Java) {
into("META-INF/versions/9")
}
val bndConvention = BundleTaskConvention(this)
Expand Down
Empty file.
File renamed without changes.

0 comments on commit 03e81b8

Please sign in to comment.