Skip to content

Commit

Permalink
Apply the JS and WasmJs source sets to the main module (#1992)
Browse files Browse the repository at this point in the history
* 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.
  • Loading branch information
ForteScarlet authored Oct 15, 2024
1 parent 57586fe commit e4e7a6f
Show file tree
Hide file tree
Showing 74 changed files with 577 additions and 7 deletions.
529 changes: 529 additions & 0 deletions kotlin-js-store/yarn.lock

Large diffs are not rendered by default.

54 changes: 47 additions & 7 deletions kotlinpoet/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
* limitations under the License.
*/
import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi
import org.jetbrains.kotlin.gradle.targets.js.dsl.ExperimentalWasmDsl

plugins {
kotlin("multiplatform")
Expand All @@ -23,11 +24,12 @@ spotless {
kotlin {
targetExclude(
// Non-Square licensed files
"src/commonMain/kotlin/com/squareup/kotlinpoet/ClassName.kt",
"src/commonTest/kotlin/com/squareup/kotlinpoet/AbstractTypesTest.kt",
"src/commonTest/kotlin/com/squareup/kotlinpoet/ClassNameTest.kt",
"src/commonTest/kotlin/com/squareup/kotlinpoet/TypesEclipseTest.kt",
"src/commonTest/kotlin/com/squareup/kotlinpoet/TypesTest.kt",
"src/*Main/kotlin/com/squareup/kotlinpoet/ClassName.kt",
"src/*Main/kotlin/com/squareup/kotlinpoet/ClassName.*.kt",
"src/*Test/kotlin/com/squareup/kotlinpoet/AbstractTypesTest.kt",
"src/*Test/kotlin/com/squareup/kotlinpoet/ClassNameTest.kt",
"src/*Test/kotlin/com/squareup/kotlinpoet/TypesEclipseTest.kt",
"src/*Test/kotlin/com/squareup/kotlinpoet/TypesTest.kt",
)
}
}
Expand All @@ -37,19 +39,46 @@ kotlin {
withJava()
}

js {
nodejs {
testTask {
useMocha()
}
}
binaries.library()
}

@OptIn(ExperimentalWasmDsl::class)
wasmJs {
nodejs {
testTask {
useMocha()
}
}
binaries.library()
}

@OptIn(ExperimentalKotlinGradlePluginApi::class)
compilerOptions {
allWarningsAsErrors = true
optIn.add("com.squareup.kotlinpoet.DelicateKotlinPoetApi")
freeCompilerArgs.add("-Xexpect-actual-classes")
}

sourceSets {
val commonMain by getting {
commonMain {
dependencies {
implementation(libs.kotlin.reflect)
}
}
val commonTest by getting {

commonTest {
dependencies {
implementation(kotlin("test"))
}
}

jvmTest {
dependencies {
implementation(libs.kotlin.junit)
implementation(libs.truth)
Expand All @@ -62,6 +91,17 @@ kotlin {
implementation(libs.kotlin.compilerEmbeddable)
}
}

val nonJvmMain by creating {
dependsOn(commonMain.get())
}

jsMain {
dependsOn(nonJvmMain)
}
wasmJsMain {
dependsOn(nonJvmMain)
}
}
}

Expand Down
1 change: 1 addition & 0 deletions kotlinpoet/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ POM_ARTIFACT_ID=kotlinpoet
POM_NAME=KotlinPoet
POM_DESCRIPTION=Use beautiful Kotlin code to generate beautiful Kotlin code.
POM_PACKAGING=jar
kotlin.mpp.applyDefaultHierarchyTemplate=false

0 comments on commit e4e7a6f

Please sign in to comment.