Skip to content

Commit dab0673

Browse files
committed
Add serialization module
1 parent 06d2854 commit dab0673

File tree

1 file changed

+170
-0
lines changed

1 file changed

+170
-0
lines changed

serialization/build.gradle.kts

Lines changed: 170 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,170 @@
1+
import kotlinx.team.infra.mavenPublicationsPom
2+
3+
plugins {
4+
id("kotlin-multiplatform")
5+
`maven-publish`
6+
kotlin("plugin.serialization") version "1.9.21"
7+
}
8+
9+
base {
10+
archivesBaseName = "kotlinx-collections-immutable-serialization" // doesn't work
11+
}
12+
13+
mavenPublicationsPom {
14+
description.set("Kotlin Immutable Collections serializers")
15+
}
16+
17+
kotlin {
18+
applyDefaultHierarchyTemplate()
19+
explicitApi()
20+
21+
// According to https://kotlinlang.org/docs/native-target-support.html
22+
// Tier 1
23+
linuxX64()
24+
macosX64()
25+
macosArm64()
26+
iosSimulatorArm64()
27+
iosX64()
28+
29+
// Tier 2
30+
linuxArm64()
31+
watchosSimulatorArm64()
32+
watchosX64()
33+
watchosArm32()
34+
watchosArm64()
35+
tvosSimulatorArm64()
36+
tvosX64()
37+
tvosArm64()
38+
iosArm64()
39+
40+
// Tier 3
41+
androidNativeArm32()
42+
androidNativeArm64()
43+
androidNativeX86()
44+
androidNativeX64()
45+
mingwX64()
46+
watchosDeviceArm64()
47+
48+
jvm {
49+
compilations.all {
50+
kotlinOptions {
51+
jvmTarget = "1.8"
52+
}
53+
}
54+
}
55+
56+
js {
57+
nodejs {
58+
testTask {
59+
useMocha {
60+
timeout = "30000"
61+
}
62+
}
63+
}
64+
compilations.all {
65+
kotlinOptions {
66+
sourceMap = true
67+
moduleKind = "umd"
68+
metaInfo = true
69+
}
70+
}
71+
}
72+
73+
wasmJs {
74+
nodejs {
75+
testTask {
76+
useMocha {
77+
timeout = "30000"
78+
}
79+
}
80+
}
81+
}
82+
83+
wasmWasi {
84+
nodejs {
85+
testTask {
86+
useMocha {
87+
timeout = "30000"
88+
}
89+
}
90+
}
91+
}
92+
93+
sourceSets.all {
94+
kotlin.setSrcDirs(listOf("$name/src"))
95+
resources.setSrcDirs(listOf("$name/resources"))
96+
languageSettings.apply {
97+
// progressiveMode = true
98+
optIn("kotlin.RequiresOptIn")
99+
}
100+
}
101+
102+
sourceSets {
103+
val commonMain by getting {
104+
dependencies {
105+
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.6.3")
106+
implementation(project(":kotlinx-collections-immutable"))
107+
}
108+
}
109+
val commonTest by getting {
110+
dependencies {
111+
implementation(kotlin("test"))
112+
}
113+
}
114+
115+
val jvmMain by getting {
116+
}
117+
val jvmTest by getting {
118+
dependencies {
119+
implementation("com.google.guava:guava-testlib:18.0")
120+
}
121+
}
122+
123+
val jsMain by getting {
124+
}
125+
val jsTest by getting {
126+
}
127+
128+
val wasmMain by creating {
129+
dependsOn(commonMain)
130+
}
131+
val wasmTest by creating {
132+
dependsOn(commonTest)
133+
}
134+
135+
val wasmJsMain by getting {
136+
dependsOn(wasmMain)
137+
}
138+
val wasmJsTest by getting {
139+
dependsOn(wasmTest)
140+
}
141+
142+
val wasmWasiMain by getting {
143+
dependsOn(wasmMain)
144+
}
145+
val wasmWasiTest by getting {
146+
dependsOn(wasmTest)
147+
}
148+
149+
val nativeMain by getting {
150+
}
151+
val nativeTest by getting {
152+
}
153+
}
154+
}
155+
156+
tasks {
157+
named("jvmTest", Test::class) {
158+
maxHeapSize = "1024m"
159+
}
160+
}
161+
162+
with(org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsRootPlugin.apply(rootProject)) {
163+
nodeVersion = "21.0.0-v8-canary202309167e82ab1fa2"
164+
nodeDownloadBaseUrl = "https://nodejs.org/download/v8-canary"
165+
}
166+
167+
// Drop this when node js version become stable
168+
tasks.withType<org.jetbrains.kotlin.gradle.targets.js.npm.tasks.KotlinNpmInstallTask>().configureEach {
169+
args.add("--ignore-engines")
170+
}

0 commit comments

Comments
 (0)