-
Notifications
You must be signed in to change notification settings - Fork 316
Make the kotlinpoet module multi-platform and add source set configuration for the JS and wasmJs platforms #1959
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 1 commit
ae89e37
a46a5a7
4d24217
52068af
02569d1
92495f2
511e8e8
6a9198d
43197b0
5259b9c
11522f1
8c8ddeb
e31e57c
462aa07
80fb80d
28248a9
c3719ec
3dfd12f
d5be4e7
16a0cf0
4725895
e158bba
3151780
63440e7
12b6818
e44b6fb
0c04c8d
4e062d9
97755a2
7afe913
dcfab3f
ca71f03
9133127
36c8e23
9343ea2
71a69af
8eed20b
584fe49
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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") | ||
|
|
@@ -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", | ||
| ) | ||
| } | ||
| } | ||
|
|
@@ -37,19 +39,61 @@ kotlin { | |
| withJava() | ||
| } | ||
|
|
||
| js { | ||
| browser { | ||
| testTask { | ||
| useKarma { | ||
| useChromeHeadless() | ||
| } | ||
| } | ||
| } | ||
| nodejs { | ||
| testTask { | ||
| useMocha() | ||
| } | ||
| } | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There's no need to run the tests in both the browser and on Node. Just Node is fine. |
||
| binaries.library() | ||
|
|
||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: delete empty line. |
||
| } | ||
|
|
||
| @OptIn(ExperimentalWasmDsl::class) | ||
| wasmJs { | ||
| browser { | ||
| testTask { | ||
| useKarma { | ||
| useChromeHeadless() | ||
| } | ||
| } | ||
| } | ||
| nodejs { | ||
| testTask { | ||
| useMocha() | ||
| } | ||
| } | ||
| binaries.library() | ||
| } | ||
|
|
||
| @OptIn(ExperimentalKotlinGradlePluginApi::class) | ||
| compilerOptions { | ||
| allWarningsAsErrors.set(true) | ||
| optIn.add("com.squareup.kotlinpoet.DelicateKotlinPoetApi") | ||
| freeCompilerArgs.add("-Xexpect-actual-classes") | ||
|
Egorand marked this conversation as resolved.
|
||
| } | ||
|
|
||
| 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) | ||
|
|
@@ -62,6 +106,18 @@ kotlin { | |
| implementation(libs.kotlin.compilerEmbeddable) | ||
| } | ||
| } | ||
|
|
||
| val nonJvmMain by creating { | ||
| dependsOn(commonMain.get()) | ||
| } | ||
|
|
||
| jsMain { | ||
| dependsOn(nonJvmMain) | ||
| } | ||
| wasmJsMain { | ||
| dependsOn(nonJvmMain) | ||
| } | ||
|
|
||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: remove empty line. |
||
| } | ||
| } | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.