Skip to content

Commit 5eb63ae

Browse files
committed
Refactoring wire-runtime to proper Hierarchical Multi-Platform Project.
1 parent ce13a51 commit 5eb63ae

File tree

27 files changed

+108
-1165
lines changed

27 files changed

+108
-1165
lines changed

gradle/libs.versions.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ kotlin-test-annotations = { module = "org.jetbrains.kotlin:kotlin-test-annotatio
6262
kotlin-test-common = { module = "org.jetbrains.kotlin:kotlin-test-common" }
6363
kotlin-test-js = { module = "org.jetbrains.kotlin:kotlin-test-js" }
6464
kotlin-test-junit = { module = "org.jetbrains.kotlin:kotlin-test-junit" }
65+
kotlin-test-wasm-js = { module = "org.jetbrains.kotlin:kotlin-test-wasm-js" }
6566
kotlinpoet = { module = "com.squareup:kotlinpoet", version.ref = "kotlinpoet" }
6667
misk = { module = "com.squareup.misk:misk", version = "2025.02.21.143120-9967585" }
6768
moshi = { module = "com.squareup.moshi:moshi", version.ref = "moshi" }

wire-runtime/build.gradle.kts

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@ kotlin {
4242
}
4343

4444
if (System.getProperty("kwasm", "true").toBoolean()) {
45+
wasmJs {
46+
browser()
47+
}
4548
@OptIn(ExperimentalWasmDsl::class)
4649
wasmWasi {
4750
nodejs()
@@ -71,15 +74,46 @@ kotlin {
7174
implementation(libs.kotlin.test.junit)
7275
}
7376
}
77+
val nonJvmMain by creating {
78+
dependsOn(commonMain)
79+
}
80+
val nonJvmTest by creating {
81+
dependsOn(commonTest)
82+
}
83+
if (System.getProperty("knative", "true").toBoolean()) {
84+
val nativeMain by getting {
85+
dependsOn(nonJvmMain)
86+
}
87+
val nativeTest by getting {
88+
dependsOn(nonJvmTest)
89+
}
90+
}
7491
if (System.getProperty("kjs", "true").toBoolean()) {
92+
val jsMain by getting {
93+
dependsOn(nonJvmMain)
94+
}
7595
val jsTest by getting {
96+
dependsOn(nonJvmTest)
7697
dependencies {
7798
implementation(libs.kotlin.test.js)
7899
}
79100
}
80101
}
81102
if (System.getProperty("kwasm", "true").toBoolean()) {
103+
val wasmJsMain by getting {
104+
dependsOn(nonJvmMain)
105+
}
106+
val wasmJsTest by getting {
107+
dependsOn(nonJvmTest)
108+
dependencies {
109+
implementation(libs.kotlin.test.wasm.js)
110+
}
111+
}
112+
val wasmWasiMain by getting {
113+
dependsOn(nonJvmMain)
114+
}
82115
val wasmWasiTest by getting {
116+
dependsOn(nonJvmTest)
83117
dependencies {
84118
implementation(libs.kotlin.test)
85119
}

wire-runtime/src/jsMain/kotlin/com/squareup/wire/MessageSink.kt

Lines changed: 0 additions & 24 deletions
This file was deleted.

wire-runtime/src/jsMain/kotlin/com/squareup/wire/ProtoAdapter.kt

Lines changed: 0 additions & 225 deletions
This file was deleted.

wire-runtime/src/jsMain/kotlin/com/squareup/wire/internal/-Platform.kt

Lines changed: 1 addition & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -15,48 +15,4 @@
1515
*/
1616
package com.squareup.wire.internal
1717

18-
import okio.IOException
19-
20-
actual interface Serializable
21-
22-
/** This annotation is an empty placeholder. */
23-
actual annotation class JvmField
24-
25-
/** This annotation is an empty placeholder. */
26-
actual annotation class JvmSynthetic
27-
28-
/** This annotation is an empty placeholder. */
29-
actual annotation class JvmStatic
30-
31-
actual abstract class ObjectStreamException : IOException()
32-
33-
actual class ProtocolException actual constructor(host: String) : IOException(host)
34-
35-
@Suppress("NOTHING_TO_INLINE") // Syntactic sugar.
36-
actual inline fun <T> MutableList<T>.toUnmodifiableList(): List<T> = this
37-
38-
@Suppress("NOTHING_TO_INLINE") // Syntactic sugar.
39-
actual inline fun <K, V> MutableMap<K, V>.toUnmodifiableMap(): Map<K, V> = this
40-
41-
// TODO: Use code points to process each char.
42-
actual fun camelCase(string: String, upperCamel: Boolean): String {
43-
return buildString(string.length) {
44-
var index = 0
45-
var uppercase = upperCamel
46-
while (index < string.length) {
47-
var char = string[index]
48-
49-
index++
50-
51-
if (char == '_') {
52-
uppercase = true
53-
continue
54-
}
55-
if (uppercase) {
56-
if (char in 'a'..'z') char += 'A' - 'a'
57-
}
58-
append(char)
59-
uppercase = false
60-
}
61-
}
62-
}
18+
actual typealias JsName = kotlin.js.JsName

0 commit comments

Comments
 (0)