Skip to content

Commit e4e7a6f

Browse files
authored
Apply the JS and WasmJs source sets to the main module (#1992)
* Apply the JS and WasmJs source sets to the main module and move the contents of commonMain and commonTest to the JVM source set. * Remove a blank line.
1 parent 57586fe commit e4e7a6f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

74 files changed

+577
-7
lines changed

kotlin-js-store/yarn.lock

Lines changed: 529 additions & 0 deletions
Large diffs are not rendered by default.

kotlinpoet/build.gradle.kts

Lines changed: 47 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
* limitations under the License.
1515
*/
1616
import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi
17+
import org.jetbrains.kotlin.gradle.targets.js.dsl.ExperimentalWasmDsl
1718

1819
plugins {
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

kotlinpoet/gradle.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ POM_ARTIFACT_ID=kotlinpoet
22
POM_NAME=KotlinPoet
33
POM_DESCRIPTION=Use beautiful Kotlin code to generate beautiful Kotlin code.
44
POM_PACKAGING=jar
5+
kotlin.mpp.applyDefaultHierarchyTemplate=false

0 commit comments

Comments
 (0)