Skip to content

Commit dce6c6c

Browse files
Artem.KobzarArtem.Kobzar
authored andcommitted
Use 2.1.20-Beta2 to use common webMain for both JS and WasmJS
1 parent a39765a commit dce6c6c

33 files changed

+18
-36
lines changed

build.gradle.kts

Lines changed: 12 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
1-
import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi
2-
import org.jetbrains.kotlin.gradle.targets.js.dsl.ExperimentalWasmDsl
3-
import org.jetbrains.kotlin.gradle.tasks.KotlinCompileCommon
1+
@file:OptIn(org.jetbrains.kotlin.gradle.ExperimentalWasmDsl::class)
42

53
plugins {
6-
kotlin("multiplatform") version "2.1.10"
4+
kotlin("multiplatform") version "2.2.20-Beta2"
75
`maven-publish`
86
signing
97
}
@@ -28,7 +26,6 @@ afterEvaluate {
2826

2927
repositories {
3028
mavenCentral()
31-
mavenLocal()
3229
}
3330

3431
val artifactId = "kotlinx-browser"
@@ -42,43 +39,26 @@ if (!versionSuffix.isNullOrBlank()) {
4239
}
4340

4441
kotlin {
45-
js()
42+
compilerOptions {
43+
optIn.add("kotlin.js.ExperimentalWasmJsInterop")
44+
}
45+
46+
js {
47+
nodejs()
48+
}
4649

47-
@OptIn(ExperimentalWasmDsl::class)
4850
wasmJs {
4951
nodejs()
5052
}
5153

54+
applyDefaultHierarchyTemplate()
55+
5256
sourceSets {
5357
val commonMain by getting
54-
val commonTest by getting
55-
val browserMain by creating {
56-
dependsOn(commonMain)
57-
}
58-
val browserTest by creating {
59-
dependsOn(commonTest)
58+
val webTest by getting {
6059
dependencies {
6160
implementation(kotlin("test"))
6261
}
6362
}
64-
val jsMain by getting {
65-
dependsOn(browserMain)
66-
dependencies {
67-
implementation(kotlin("wasm-js-interop", "0.0.1-SNAPSHOT"))
68-
}
69-
}
70-
val jsTest by getting {
71-
dependsOn(browserTest)
72-
}
73-
val wasmJsMain by getting {
74-
dependsOn(browserMain)
75-
}
76-
val wasmJsTest by getting {
77-
dependsOn(browserTest)
78-
}
7963
}
80-
}
81-
82-
tasks.withType<KotlinCompileCommon>().configureEach {
83-
enabled = false
8464
}

generator/src/main/kotlin/dukat/launchBrowser.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import org.jetbrains.kotlin.tools.dukat.wasm.translateIdlToSourceSet
1111
import java.io.File
1212

1313
fun main() {
14-
val outputDirectory = "../src/browserMain/kotlin/org.w3c/"
14+
val outputDirectory = "../src/webMain/kotlin/org.w3c/"
1515
val input = "../idl/org.w3c.dom.idl"
1616

1717
val sourceSet = translateIdlToSourceSet(input)

generator/src/main/kotlin/helpers/generate.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ fun generatePublicStdlibFunctions() {
2626
Conversion("Double", "Float64")
2727
)
2828

29-
FileWriter(File("../src/browserMain/kotlin/arrayCopy.kt")).use { writer: FileWriter ->
29+
FileWriter(File("../src/webMain/kotlin/arrayCopy.kt")).use { writer: FileWriter ->
3030
with(writer) {
3131
appendLine(getHeader(seeDetailsAt = "generator/src/main/kotlin/helpers/generate.kt"))
3232
appendLine("package org.khronos.webgl")
@@ -148,7 +148,7 @@ private fun FileWriter.appendWasmConversionsForType(
148148
}
149149

150150
fun generateTests() {
151-
FileWriter(File("../src/browserTest/kotlin/arrayCopyTest.kt")).use { writer: FileWriter ->
151+
FileWriter(File("../src/webtest/kotlin/arrayCopyTest.kt")).use { writer: FileWriter ->
152152
with(writer) {
153153
appendLine(getHeader(seeDetailsAt = "generator/src/main/kotlin/helpers/generate.kt"))
154154

settings.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ pluginManagement {
33
gradlePluginPortal()
44
}
55
plugins {
6-
kotlin("multiplatform").version("2.1.10")
6+
kotlin("multiplatform").version("2.2.20-Beta2")
77
}
88
}
99

File renamed without changes.
File renamed without changes.
File renamed without changes.

src/browserMain/kotlin/kotlinx/dom/ItemArrayLike.kt renamed to src/webMain/kotlin/kotlinx/dom/ItemArrayLike.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55

66
package org.w3c.dom
77

8+
import kotlin.js.JsAny
9+
810
public external interface ItemArrayLike<out T : JsAny?> : JsAny {
911
public val length: Int
1012
public fun item(index: Int): T?

0 commit comments

Comments
 (0)