22
33package common
44
5- import com.google.devtools.ksp.gradle.KspAATask
65import java.io.ByteArrayOutputStream
76import java.io.File
87import java.nio.file.Path
@@ -176,7 +175,8 @@ val Project.defaultJarManifest
176175 put(" Built-Jdk" , System .getProperty(" java.runtime.version" ))
177176 put(
178177 " Built-OS" ,
179- " ${System .getProperty(" os.name" )} ${System .getProperty(" os.arch" )} ${System .getProperty(" os.version" )} " )
178+ " ${System .getProperty(" os.name" )} ${System .getProperty(" os.arch" )} ${System .getProperty(" os.version" )} " ,
179+ )
180180 put(" Build-Timestamp" , DateTimeFormatter .ISO_INSTANT .format(ZonedDateTime .now()))
181181 put(" Created-By" , " Gradle ${gradle.gradleVersion} " )
182182 put(Attributes .Name .IMPLEMENTATION_TITLE .toString(), project.name)
@@ -198,7 +198,8 @@ val Project.containerLabels
198198 " org.opencontainers.image.vendor" to project.githubUser,
199199 " org.opencontainers.image.url" to project.githubRepo,
200200 " org.opencontainers.image.source" to project.githubRepo,
201- " org.opencontainers.image.licenses" to " Apache-2.0" )
201+ " org.opencontainers.image.licenses" to " Apache-2.0" ,
202+ )
202203
203204val Project .defaultJvmArgs
204205 get() = buildList {
@@ -357,7 +358,8 @@ val Project.runJvmArgs
357358 // "-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:5005",
358359 // "-agentlib:jdwp=transport=dt_socket,server=n,address=host:5005,suspend=y,onthrow=<FQ
359360 // exception class name>,onuncaught=<y/n>"
360- ))
361+ )
362+ )
361363 }
362364 }
363365 }
@@ -391,14 +393,17 @@ fun JavaCompile.configureJavac(project: Project) =
391393 // add("--patch-module")
392394 // add("$moduleName=${sourceSets.main.get().output.asPath}")
393395 // add("-Xplugin:unchecked") // compiler plugin
394- })
396+ }
397+ )
395398
396399 // Add the Kotlin classes to the module path (compileKotlinJvm)
397400 val compileKotlin = tasks.findByName(" compileKotlin" ) as ? KotlinCompile
398401 if (compileKotlin != null ) {
399402 compilerArgumentProviders + =
400403 PatchModuleArgProvider (
401- provider { project.group.toString() }, compileKotlin.destinationDirectory)
404+ provider { project.group.toString() },
405+ compileKotlin.destinationDirectory,
406+ )
402407 }
403408 }
404409 }
@@ -440,19 +445,8 @@ fun KotlinCommonCompilerOptions.configureKotlinCommon(project: Project) =
440445 " kotlin.ExperimentalMultiplatform" ,
441446 " kotlin.js.ExperimentalJsExport" ,
442447 " kotlin.uuid.ExperimentalUuidApi" ,
443- " kotlin.concurrent.atomics.ExperimentalAtomicApi"
444- // "org.jetbrains.kotlin.compiler.plugin.ExperimentalCompilerApi",
445- )
446- }
447-
448- fun KspAATask.configureKspConfig () =
449- with (project) {
450- kspConfig.apply {
451- jvmTarget = kotlinJvmTarget.map { it.target }
452- apiVersion = kotlinApiVersion.map { it.version }
453- languageVersion = kotlinLangVersion.map { it.version }
454- allWarningsAsErrors = false
455- }
448+ " kotlin.concurrent.atomics.ExperimentalAtomicApi" ,
449+ )
456450 }
457451
458452/* *
@@ -482,6 +476,7 @@ fun KotlinJvmCompilerOptions.configureKotlinJvm(project: Project) =
482476 " -Xemit-jvm-type-annotations" ,
483477 " -Xjspecify-annotations=strict" ,
484478 " -Xskip-prerelease-check" ,
479+ " -Xwhen-expressions=indy" ,
485480 // Remove null check intrinsics from bytecode
486481 " -Xno-param-assertions" ,
487482 " -Xno-call-assertions" ,
@@ -538,11 +533,12 @@ fun Test.configureJavaTest() {
538533 |Passed : ${result.successfulTestCount}
539534 |Failed : ${result.failedTestCount}
540535 |Skipped : ${result.skippedTestCount}
541- |
542- """
543- .trimMargin() )
536+ |"""
537+ .trimMargin()
538+ )
544539 }
545- }))
540+ })
541+ )
546542}
547543
548544fun TestLoggingContainer.configureLogEvents () {
@@ -568,7 +564,8 @@ fun TestLoggingContainer.configureLogEvents() {
568564 TestLogEvent .PASSED ,
569565 TestLogEvent .SKIPPED ,
570566 TestLogEvent .STANDARD_ERROR ,
571- TestLogEvent .STANDARD_OUT )
567+ TestLogEvent .STANDARD_OUT ,
568+ )
572569 exceptionFormat = TestExceptionFormat .FULL
573570 }
574571}
@@ -595,7 +592,8 @@ fun KotlinSourceSet.ksp(dependencyNotation: Any) {
595592 name in
596593 listOf (
597594 KotlinSourceSet .COMMON_MAIN_SOURCE_SET_NAME ,
598- KotlinSourceSet .COMMON_TEST_SOURCE_SET_NAME ) -> " commonMainMetadata"
595+ KotlinSourceSet .COMMON_TEST_SOURCE_SET_NAME ,
596+ ) -> " commonMainMetadata"
599597
600598 name.endsWith(" Main" ) -> name.substringBeforeLast(" Main" )
601599 else -> name
0 commit comments