1414 * limitations under the License.
1515 */
1616import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi
17+ import org.jetbrains.kotlin.gradle.targets.js.dsl.ExperimentalWasmDsl
1718
1819plugins {
1920 kotlin(" multiplatform" )
@@ -23,11 +24,12 @@ spotless {
2324 kotlin {
2425 targetExclude(
2526 // Non-Square licensed files
26- " src/commonMain/kotlin/com/squareup/kotlinpoet/ClassName.kt" ,
27- " src/commonTest/kotlin/com/squareup/kotlinpoet/AbstractTypesTest.kt" ,
28- " src/commonTest/kotlin/com/squareup/kotlinpoet/ClassNameTest.kt" ,
29- " src/commonTest/kotlin/com/squareup/kotlinpoet/TypesEclipseTest.kt" ,
30- " src/commonTest/kotlin/com/squareup/kotlinpoet/TypesTest.kt" ,
27+ " src/*Main/kotlin/com/squareup/kotlinpoet/ClassName.kt" ,
28+ " src/*Main/kotlin/com/squareup/kotlinpoet/ClassName.*.kt" ,
29+ " src/*Test/kotlin/com/squareup/kotlinpoet/AbstractTypesTest.kt" ,
30+ " src/*Test/kotlin/com/squareup/kotlinpoet/ClassNameTest.kt" ,
31+ " src/*Test/kotlin/com/squareup/kotlinpoet/TypesEclipseTest.kt" ,
32+ " src/*Test/kotlin/com/squareup/kotlinpoet/TypesTest.kt" ,
3133 )
3234 }
3335}
@@ -37,19 +39,46 @@ kotlin {
3739 withJava()
3840 }
3941
42+ js {
43+ nodejs {
44+ testTask {
45+ useMocha()
46+ }
47+ }
48+ binaries.library()
49+ }
50+
51+ @OptIn(ExperimentalWasmDsl ::class )
52+ wasmJs {
53+ nodejs {
54+ testTask {
55+ useMocha()
56+ }
57+ }
58+ binaries.library()
59+ }
60+
4061 @OptIn(ExperimentalKotlinGradlePluginApi ::class )
4162 compilerOptions {
4263 allWarningsAsErrors = true
4364 optIn.add(" com.squareup.kotlinpoet.DelicateKotlinPoetApi" )
65+ freeCompilerArgs.add(" -Xexpect-actual-classes" )
4466 }
4567
4668 sourceSets {
47- val commonMain by getting {
69+ commonMain {
4870 dependencies {
4971 implementation(libs.kotlin.reflect)
5072 }
5173 }
52- val commonTest by getting {
74+
75+ commonTest {
76+ dependencies {
77+ implementation(kotlin(" test" ))
78+ }
79+ }
80+
81+ jvmTest {
5382 dependencies {
5483 implementation(libs.kotlin.junit)
5584 implementation(libs.truth)
@@ -62,6 +91,17 @@ kotlin {
6291 implementation(libs.kotlin.compilerEmbeddable)
6392 }
6493 }
94+
95+ val nonJvmMain by creating {
96+ dependsOn(commonMain.get())
97+ }
98+
99+ jsMain {
100+ dependsOn(nonJvmMain)
101+ }
102+ wasmJsMain {
103+ dependsOn(nonJvmMain)
104+ }
65105 }
66106}
67107
0 commit comments