@@ -79,18 +79,18 @@ kotlin {
79
79
// from https://github.com/Kotlin/kotlinx-datetime/blob/bc8adee2b9e3659e8e1c38fc09f3a4a1bdf85276/core/build.gradle.kts
80
80
tasks {
81
81
val compileJavaModuleInfo by registering(JavaCompile ::class ) {
82
- val moduleName = " org.jetbrains.annotations.multiplatform " // this module's name
82
+ val moduleName = " org.jetbrains.annotations" // this module's name
83
83
val compileKotlinJvm by getting(KotlinCompile ::class )
84
+ val compileJava by getting(JavaCompile ::class )
84
85
val sourceDir = file(" src/jvmMain/moduleInfo/" )
85
- println (" sourceDir: $sourceDir " )
86
86
val targetDir = compileKotlinJvm.destinationDirectory.map { it.dir(" ../moduleInfo/" ) }
87
- println (" targetDir: $targetDir " )
88
87
89
88
// Use a Java 11 compiler for the module info.
90
89
javaCompiler.set(project.javaToolchains.compilerFor { languageVersion.set(JavaLanguageVersion .of(11 )) })
91
90
92
- // Always compile kotlin classes before the module descriptor.
91
+ // Always compile kotlin and java classes before the module descriptor.
93
92
dependsOn(compileKotlinJvm)
93
+ dependsOn(compileJava)
94
94
95
95
// Add the module-info source file.
96
96
source(sourceDir)
@@ -111,7 +111,7 @@ tasks {
111
111
options.compilerArgs.add(" -Xlint:-requires-transitive-automatic" )
112
112
113
113
// Patch the compileKotlinJvm output classes into the compilation so exporting packages works correctly.
114
- options.compilerArgs.addAll(listOf (" --patch-module" , " $moduleName =${compileKotlinJvm .destinationDirectory.get()} " ))
114
+ options.compilerArgs.addAll(listOf (" --patch-module" , " $moduleName =${compileJava .destinationDirectory.get()} " ))
115
115
116
116
// Use the classpath of the compileKotlinJvm task.
117
117
// Also ensure that the module path is used instead of classpath.
0 commit comments