@@ -203,13 +203,13 @@ kotlin {
203
203
}
204
204
205
205
tasks {
206
- named( " jvmTest" , Test ::class ) {
206
+ val jvmTest by existing( Test ::class ) {
207
207
// maxHeapSize = "1024m"
208
208
}
209
209
210
- create( " compileJavaModuleInfo" , JavaCompile ::class ) {
210
+ val compileJavaModuleInfo by registering( JavaCompile ::class ) {
211
211
val moduleName = " kotlinx.datetime" // this module's name
212
- val compileKotlinJvm = getByName< KotlinCompile >( " compileKotlinJvm " )
212
+ val compileKotlinJvm by getting( KotlinCompile :: class )
213
213
val sourceDir = file(" jvm/java9/" )
214
214
val targetDir = compileKotlinJvm.destinationDir.resolve(" ../java9/" )
215
215
@@ -227,7 +227,7 @@ tasks {
227
227
// but it currently won't compile to a module-info.class file.
228
228
// Note that module checking only works on JDK 9+,
229
229
// because the JDK built-in base modules are not available in earlier versions.
230
- val javaVersion = compileKotlinJvm.kotlinJavaToolchain.javaVersion.orNull
230
+ val javaVersion = compileKotlinJvm.kotlinJavaToolchain.javaVersion.getOrNull()
231
231
if (javaVersion?.isJava9Compatible == true ) {
232
232
logger.info(" Module-info checking is enabled; $compileKotlinJvm is compiled using Java $javaVersion " )
233
233
compileKotlinJvm.source(sourceDir)
@@ -247,6 +247,7 @@ tasks {
247
247
options.release.set(9 )
248
248
249
249
// Ignore warnings about using 'requires transitive' on automatic modules.
250
+ // not needed when compiling with recent JDKs, e.g. 17
250
251
options.compilerArgs.add(" -Xlint:-requires-transitive-automatic" )
251
252
252
253
// Patch the compileKotlinJvm output classes into the compilation so exporting packages works correctly.
@@ -256,21 +257,20 @@ tasks {
256
257
// Also ensure that the module path is used instead of classpath.
257
258
classpath = compileKotlinJvm.classpath
258
259
modularity.inferModulePath.set(true )
260
+ }
259
261
260
- // Configure the JAR task so that it will include the compiled module-info class file.
261
- getByName<Jar >(" jvmJar" ) {
262
- dependsOn(this @create)
263
- manifest {
264
- attributes(" Multi-Release" to true )
265
- }
266
- from(targetDir) {
267
- into(" META-INF/versions/9/" )
268
- }
262
+ // Configure the JAR task so that it will include the compiled module-info class file.
263
+ val jvmJar by existing(Jar ::class ) {
264
+ manifest {
265
+ attributes(" Multi-Release" to true )
266
+ }
267
+ from(compileJavaModuleInfo) {
268
+ into(" META-INF/versions/9/" )
269
269
}
270
270
}
271
271
}
272
272
273
- task( " downloadWindowsZonesMapping" ) {
273
+ val downloadWindowsZonesMapping by tasks.registering {
274
274
description = " Updates the mapping between Windows-specific and usual names for timezones"
275
275
val output = " $projectDir /nativeMain/cinterop/public/windows_zones.hpp"
276
276
outputs.file(output)
0 commit comments