Update to 1.9.20-RC. Fix warnings

This commit is contained in:
Alexander Nozik 2023-10-18 11:27:37 +03:00
parent 89af2dd644
commit 54952c3da6
6 changed files with 33 additions and 23 deletions

View File

@ -25,6 +25,7 @@ kotlin.explicitApiWarning()
dependencies { dependencies {
api(libs.kotlin.gradle) api(libs.kotlin.gradle)
api("org.gradle.toolchains:foojay-resolver:0.7.0")
implementation(libs.binary.compatibility.validator) implementation(libs.binary.compatibility.validator)
implementation(libs.changelog.gradle) implementation(libs.changelog.gradle)
implementation(libs.dokka.gradle) implementation(libs.dokka.gradle)

View File

@ -1,6 +1,6 @@
[versions] [versions]
tools = "0.15.0-kotlin-1.9.20-Beta2" tools = "0.15.0-kotlin-1.9.20-RC"
kotlin = "1.9.20-Beta2" kotlin = "1.9.20-RC"
# https://github.com/Kotlin/kotlinx-atomicfu # https://github.com/Kotlin/kotlinx-atomicfu
atomicfu = "0.22.0" atomicfu = "0.22.0"
# https://github.com/Kotlin/binary-compatibility-validator # https://github.com/Kotlin/binary-compatibility-validator

View File

@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-bin.zip distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists

View File

@ -1,6 +1,5 @@
package space.kscience.gradle package space.kscience.gradle
import org.gradle.api.Action
import org.gradle.api.Project import org.gradle.api.Project
import org.gradle.api.file.DuplicatesStrategy import org.gradle.api.file.DuplicatesStrategy
import org.gradle.api.plugins.ApplicationPlugin import org.gradle.api.plugins.ApplicationPlugin
@ -17,7 +16,10 @@ import org.jetbrains.kotlin.gradle.dsl.KotlinProjectExtension
import org.jetbrains.kotlin.gradle.plugin.KotlinCompilation import org.jetbrains.kotlin.gradle.plugin.KotlinCompilation
import org.jetbrains.kotlin.gradle.plugin.KotlinDependencyHandler import org.jetbrains.kotlin.gradle.plugin.KotlinDependencyHandler
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget
import org.jetbrains.kotlin.gradle.targets.js.dsl.* import org.jetbrains.kotlin.gradle.targets.js.dsl.ExperimentalWasmDsl
import org.jetbrains.kotlin.gradle.targets.js.dsl.KotlinJsBrowserDsl
import org.jetbrains.kotlin.gradle.targets.js.dsl.KotlinJsTargetDsl
import org.jetbrains.kotlin.gradle.targets.js.dsl.KotlinWasmJsTargetDsl
import org.jetbrains.kotlin.gradle.targets.jvm.KotlinJvmTarget import org.jetbrains.kotlin.gradle.targets.jvm.KotlinJvmTarget
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import org.jetbrains.kotlinx.jupyter.api.plugin.tasks.JupyterApiResourcesTask import org.jetbrains.kotlinx.jupyter.api.plugin.tasks.JupyterApiResourcesTask
@ -179,13 +181,6 @@ public open class KScienceExtension(public val project: Project) {
} }
} }
project.pluginManager.withPlugin("org.jetbrains.kotlin.js") {
project.configure<KotlinJsProjectExtension> {
sourceSets.getByName(sourceSet ?: "test") {
dependencies(dependencyBlock)
}
}
}
project.pluginManager.withPlugin("org.jetbrains.kotlin.multiplatform") { project.pluginManager.withPlugin("org.jetbrains.kotlin.multiplatform") {
project.configure<KotlinMultiplatformExtension> { project.configure<KotlinMultiplatformExtension> {
@ -373,7 +368,7 @@ public open class KScienceMppExtension(project: Project) : KScienceExtension(pro
project.configure<KotlinMultiplatformExtension> { project.configure<KotlinMultiplatformExtension> {
jvm { jvm {
compilations.all { compilations.all {
compilerOptions { compilerOptions.configure {
freeCompilerArgs.addAll(defaultKotlinJvmArgs) freeCompilerArgs.addAll(defaultKotlinJvmArgs)
} }
} }
@ -421,8 +416,11 @@ public open class KScienceMppExtension(project: Project) : KScienceExtension(pro
} }
} }
/**
* Add Wasm/Js target
*/
@OptIn(ExperimentalWasmDsl::class) @OptIn(ExperimentalWasmDsl::class)
public fun wasm(block: KotlinWasmTargetDsl.() -> Unit = {}) { public fun wasm(block: KotlinWasmJsTargetDsl.() -> Unit = {}) {
// if (project.requestPropertyOrNull("kscience.wasm.disabled") == "true") { // if (project.requestPropertyOrNull("kscience.wasm.disabled") == "true") {
// project.logger.warn("Wasm target is disabled with 'kscience.wasm.disabled' property") // project.logger.warn("Wasm target is disabled with 'kscience.wasm.disabled' property")
// return // return
@ -434,7 +432,7 @@ public open class KScienceMppExtension(project: Project) : KScienceExtension(pro
browser { browser {
testTask { testTask {
useKarma { useKarma {
this.webpackConfig.experiments.add("topLevelAwait") webpackConfig.experiments.add("topLevelAwait")
useChromeHeadlessWasmGc() useChromeHeadlessWasmGc()
useConfigDirectory(project.projectDir.resolve("karma.config.d").resolve("wasm")) useConfigDirectory(project.projectDir.resolve("karma.config.d").resolve("wasm"))
} }
@ -469,14 +467,14 @@ public open class KScienceMppExtension(project: Project) : KScienceExtension(pro
browserConfig: KotlinJsBrowserDsl.() -> Unit = {}, browserConfig: KotlinJsBrowserDsl.() -> Unit = {},
) { ) {
js { js {
binaries.executable()
browser { browser {
webpackTask(Action { webpackTask {
mainOutputFileName.set(bundleName) mainOutputFileName.set(bundleName)
}) }
browserConfig() browserConfig()
} }
jsConfig() jsConfig()
binaries.executable()
} }
jvm { jvm {
val processResourcesTaskName = val processResourcesTaskName =

View File

@ -10,6 +10,7 @@ import org.jetbrains.dokka.gradle.DokkaPlugin
import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinMultiplatformPlugin import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinMultiplatformPlugin
import space.kscience.gradle.internal.applySettings import space.kscience.gradle.internal.applySettings
import space.kscience.gradle.internal.defaultKotlinCommonArgs
public open class KScienceMPPlugin : Plugin<Project> { public open class KScienceMPPlugin : Plugin<Project> {
override fun apply(project: Project): Unit = project.run { override fun apply(project: Project): Unit = project.run {
@ -23,23 +24,29 @@ public open class KScienceMPPlugin : Plugin<Project> {
registerKScienceExtension(::KScienceMppExtension) registerKScienceExtension(::KScienceMppExtension)
configure<KotlinMultiplatformExtension> { configure<KotlinMultiplatformExtension> {
sourceSets { sourceSets {
getByName("commonMain"){ getByName("commonMain") {
dependencies { dependencies {
api(project.dependencies.platform("org.jetbrains.kotlin-wrappers:kotlin-wrappers-bom:${KScienceVersions.jsBom}")) api(project.dependencies.platform("org.jetbrains.kotlin-wrappers:kotlin-wrappers-bom:${KScienceVersions.jsBom}"))
} }
} }
getByName("commonTest"){ getByName("commonTest") {
dependencies { dependencies {
implementation(kotlin("test-common")) implementation(kotlin("test-common"))
implementation(kotlin("test-annotations-common")) implementation(kotlin("test-annotations-common"))
} }
} }
all {
languageSettings.applySettings()
}
} }
sourceSets.all { targets.all {
languageSettings.applySettings() compilations.all {
kotlinOptions{
freeCompilerArgs += defaultKotlinCommonArgs
}
}
} }
if (explicitApi == null) explicitApiWarning() if (explicitApi == null) explicitApiWarning()

View File

@ -13,6 +13,10 @@ internal val defaultKotlinJvmArgs: List<String> = listOf(
/* "-Xjdk-release=${KScienceVersions.JVM_TARGET}"*/ /* "-Xjdk-release=${KScienceVersions.JVM_TARGET}"*/
) )
internal val defaultKotlinCommonArgs: List<String> = listOf(
"-Xexpect-actual-classes"
)
internal fun resolveKotlinVersion(): KotlinVersion { internal fun resolveKotlinVersion(): KotlinVersion {
val (major, minor, patch) = KScienceVersions.kotlinVersion.split(".", "-") val (major, minor, patch) = KScienceVersions.kotlinVersion.split(".", "-")
return KotlinVersion(major.toInt(), minor.toInt(), patch.toInt()) return KotlinVersion(major.toInt(), minor.toInt(), patch.toInt())