add mppJsProject

This commit is contained in:
InsanusMokrassar 2021-03-07 21:22:27 +06:00
parent 75adbed45a
commit 13782a263c
3 changed files with 73 additions and 0 deletions

View File

@ -127,6 +127,46 @@ kotlin {
}
```
### `mppJsProject`
This type of preset have only `JS` target and available using `apply from: "mppJsProjectPresetPath"`. Template for
project with this preset looks like next snippet:
```groovy
plugins {
id "org.jetbrains.kotlin.multiplatform"
}
apply from: "$mppJsProjectPresetPath"
// The code below is optional
kotlin {
sourceSets {
commonMain {
dependencies {
// common dependencies
}
}
commonTest {
dependencies {
// common test dependencies
}
}
jsMain {
dependencies {
// jvm dependencies
}
}
jsTest {
dependencies {
// jvm test dependencies
}
}
}
}
```
### `mppAndroidProject`
This type of preset have only `Android` target and available using `apply from: "$mppAndroidProjectPresetPath"`. Template for

View File

@ -15,6 +15,7 @@ allprojects {
mppProjectWithSerializationPresetPath = "${rootProject.projectDir.absolutePath}/mppProjectWithSerialization.gradle"
mppJavaProjectPresetPath = "${rootProject.projectDir.absolutePath}/mppJavaProject.gradle"
mppJsProjectPresetPath = "${rootProject.projectDir.absolutePath}/mppJsProject.gradle"
mppAndroidProjectPresetPath = "${rootProject.projectDir.absolutePath}/mppAndroidProject.gradle"
defaultAndroidSettingsPresetPath = "${rootProject.projectDir.absolutePath}/defaultAndroidSettings.gradle"

32
mppJsProject.gradle Normal file
View File

@ -0,0 +1,32 @@
project.version = "$version"
project.group = "$group"
// apply from: "$publishGradlePath"
kotlin {
js (BOTH) {
browser()
nodejs()
}
sourceSets {
commonMain {
dependencies {
implementation kotlin('stdlib')
api "org.jetbrains.kotlinx:kotlinx-serialization-json:$kotlin_serialisation_core_version"
}
}
commonTest {
dependencies {
implementation kotlin('test-common')
implementation kotlin('test-annotations-common')
}
}
jsTest {
dependencies {
implementation kotlin('test-js')
implementation kotlin('test-junit')
}
}
}
}