add ios and wasm targets (#81)

* add wasm and ios targets

* add yarn.lock file to gitignore

* clean up code

* fix typo in method name

* add wasm server example

* update jrelease publishing for klibs

* update gradle-publish workflow to use macos runner

* update README to reflect multiplatform support and clarify server setup for JVM and WASM

* remove the old main file from the kotlin-mcp-server example

* update api dump

* Refactor `build.gradle.kts`

* clean up imports and remove unnecessary charset specification in tests

* add JS target configuration and update API dump
This commit is contained in:
Pavel Gorgulov 2025-05-29 07:01:50 +02:00 • committed by GitHub
commit 0cff2ca718
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1,9 +1,14 @@
@file:OptIn(ExperimentalKotlinGradlePluginApi::class)
@file:OptIn(ExperimentalKotlinGradlePluginApi::class, ExperimentalWasmDsl::class)
import org.jetbrains.dokka.gradle.engine.parameters.VisibilityModifier
import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi
import org.jetbrains.kotlin.gradle.ExperimentalWasmDsl
import org.jetbrains.kotlin.gradle.dsl.ExplicitApiMode
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.plugin.KotlinPlatformType
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinAndroidTarget
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinMetadataTarget
import org.jetbrains.kotlin.gradle.targets.jvm.KotlinJvmTarget
import org.jreleaser.model.Active
plugins {
@ -27,9 +32,11 @@ publishing {
val javadocJar = configureEmptyJavadocArtifact()
publications.withType(MavenPublication::class).all {
if (name.contains("jvm", ignoreCase = true)) {
artifact(javadocJar)
}
pom.configureMavenCentralMetadata()
signPublicationIfKeyPresent()
artifact(javadocJar)
}
repositories {
@ -53,10 +60,28 @@ jreleaser {
active.set(Active.ALWAYS)
mavenCentral {
val ossrh by creating {
applyMavenCentralRules = true
active.set(Active.ALWAYS)
url.set("https://central.sonatype.com/api/v1/publisher")
applyMavenCentralRules = false
maxRetries = 240
stagingRepository(layout.buildDirectory.dir("staging-deploy").get().asFile.path)
// workaround: https://github.com/jreleaser/jreleaser/issues/1784
kotlin.targets.forEach { target ->
if (target !is KotlinJvmTarget && target !is KotlinAndroidTarget && target !is KotlinMetadataTarget) {
val klibArtifactId = if (target.platformType == KotlinPlatformType.wasm) {
"${name}-wasm-${target.name.lowercase().substringAfter("wasm")}"
} else {
"${name}-${target.name.lowercase()}"
}
artifactOverride {
artifactId = klibArtifactId
jar = false
verifyPom = false
sourceJar = false
javadocJar = false
}
}
}
}
}
}
@ -194,6 +219,24 @@ kotlin {
}
}
iosArm64()
iosX64()
iosSimulatorArm64()
js(IR) {
nodejs {
testTask {
useMocha {
timeout = "30s"
}
}
}
}
wasmJs {
nodejs()
}
explicitApi = ExplicitApiMode.Strict
jvmToolchain(21)
@ -217,7 +260,6 @@ kotlin {
implementation(libs.kotlin.test)
implementation(libs.ktor.server.test.host)
implementation(libs.kotlinx.coroutines.test)
implementation(libs.kotlinx.coroutines.debug)
implementation(libs.kotest.assertions.json)
}
}