0.15.8-kotlin-2.1.0 #51

Merged
altavir merged 54 commits from dev into master 2024-12-09 09:49:38 +03:00
6 changed files with 33 additions and 23 deletions
Showing only changes of commit 54952c3da6 - Show all commits

View File

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

View File

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

View File

@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
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
zipStorePath=wrapper/dists

View File

@ -1,6 +1,5 @@
package space.kscience.gradle
import org.gradle.api.Action
import org.gradle.api.Project
import org.gradle.api.file.DuplicatesStrategy
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.KotlinDependencyHandler
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.tasks.KotlinCompile
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.configure<KotlinMultiplatformExtension> {
@ -373,7 +368,7 @@ public open class KScienceMppExtension(project: Project) : KScienceExtension(pro
project.configure<KotlinMultiplatformExtension> {
jvm {
compilations.all {
compilerOptions {
compilerOptions.configure {
freeCompilerArgs.addAll(defaultKotlinJvmArgs)
}
}
@ -421,8 +416,11 @@ public open class KScienceMppExtension(project: Project) : KScienceExtension(pro
}
}
/**
* Add Wasm/Js target
*/
@OptIn(ExperimentalWasmDsl::class)
public fun wasm(block: KotlinWasmTargetDsl.() -> Unit = {}) {
public fun wasm(block: KotlinWasmJsTargetDsl.() -> Unit = {}) {
// if (project.requestPropertyOrNull("kscience.wasm.disabled") == "true") {
// project.logger.warn("Wasm target is disabled with 'kscience.wasm.disabled' property")
// return
@ -434,7 +432,7 @@ public open class KScienceMppExtension(project: Project) : KScienceExtension(pro
browser {
testTask {
useKarma {
this.webpackConfig.experiments.add("topLevelAwait")
webpackConfig.experiments.add("topLevelAwait")
useChromeHeadlessWasmGc()
useConfigDirectory(project.projectDir.resolve("karma.config.d").resolve("wasm"))
}
@ -469,14 +467,14 @@ public open class KScienceMppExtension(project: Project) : KScienceExtension(pro
browserConfig: KotlinJsBrowserDsl.() -> Unit = {},
) {
js {
binaries.executable()
browser {
webpackTask(Action {
webpackTask {
mainOutputFileName.set(bundleName)
})
}
browserConfig()
}
jsConfig()
binaries.executable()
}
jvm {
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.plugin.mpp.KotlinMultiplatformPlugin
import space.kscience.gradle.internal.applySettings
import space.kscience.gradle.internal.defaultKotlinCommonArgs
public open class KScienceMPPlugin : Plugin<Project> {
override fun apply(project: Project): Unit = project.run {
@ -23,7 +24,6 @@ public open class KScienceMPPlugin : Plugin<Project> {
registerKScienceExtension(::KScienceMppExtension)
configure<KotlinMultiplatformExtension> {
sourceSets {
getByName("commonMain") {
dependencies {
@ -36,10 +36,17 @@ public open class KScienceMPPlugin : Plugin<Project> {
implementation(kotlin("test-annotations-common"))
}
}
all {
languageSettings.applySettings()
}
}
sourceSets.all {
languageSettings.applySettings()
targets.all {
compilations.all {
kotlinOptions{
freeCompilerArgs += defaultKotlinCommonArgs
}
}
}
if (explicitApi == null) explicitApiWarning()

View File

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