Migrate mobile (shared) / native / shared library MPP wizards to new DSL
#KT-28458 Fixed
This commit is contained in:
+8
-9
@@ -70,17 +70,16 @@ class KotlinGradleNativeMultiplatformModuleBuilder : KotlinGradleAbstractMultipl
|
|||||||
override fun buildMultiPlatformPart(): String {
|
override fun buildMultiPlatformPart(): String {
|
||||||
return """
|
return """
|
||||||
kotlin {
|
kotlin {
|
||||||
targets {
|
// For ARM, should be changed to iosArm32 or iosArm64
|
||||||
// For ARM, preset should be changed to presets.iosArm32 or presets.iosArm64
|
// For Linux, should be changed to e.g. linuxX64
|
||||||
// For Linux, preset should be changed to e.g. presets.linuxX64
|
// For MacOS, should be changed to e.g. macosX64
|
||||||
// For MacOS, preset should be changed to e.g. presets.macosX64
|
// For Windows, should be changed to e.g. mingwX64
|
||||||
fromPreset(presets.$nativePresetName, '$nativeTargetName')
|
$nativePresetName("$nativeTargetName") {
|
||||||
|
compilations.main {
|
||||||
configure([$nativeTargetName]) {
|
|
||||||
// Comment to generate Kotlin/Native library (KLIB) instead of executable file:
|
// Comment to generate Kotlin/Native library (KLIB) instead of executable file:
|
||||||
compilations.main.outputKinds 'EXECUTABLE'
|
outputKinds("executable")
|
||||||
// Change to specify fully qualified name of your application's entry point:
|
// Change to specify fully qualified name of your application's entry point:
|
||||||
compilations.main.entryPoint 'sample.main'
|
entryPoint 'sample.main'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
sourceSets {
|
sourceSets {
|
||||||
|
|||||||
+11
-13
@@ -306,35 +306,33 @@ sdk.dir=PleaseSpecifyAndroidSdkPathHere
|
|||||||
}
|
}
|
||||||
|
|
||||||
kotlin {
|
kotlin {
|
||||||
targets {
|
android("$jvmTargetName")
|
||||||
fromPreset(presets.android, '$jvmTargetName')
|
// This is for iPhone emulator
|
||||||
// This preset is for iPhone emulator
|
// Switch here to iosArm64 (or iosArm32) to build library for iPhone device
|
||||||
// Switch here to presets.iosArm64 (or iosArm32) to build library for iPhone device
|
iosX64("$nativeTargetName") {
|
||||||
fromPreset(presets.iosX64, '$nativeTargetName') {
|
compilations.main.outputKinds("framework")
|
||||||
compilations.main.outputKinds 'FRAMEWORK'
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
sourceSets {
|
sourceSets {
|
||||||
$commonSourceName {
|
$commonSourceName {
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation 'org.jetbrains.kotlin:kotlin-stdlib-common'
|
implementation kotlin('stdlib-common')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$commonTestName {
|
$commonTestName {
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation 'org.jetbrains.kotlin:kotlin-test-common'
|
implementation kotlin('test-common')
|
||||||
implementation 'org.jetbrains.kotlin:kotlin-test-annotations-common'
|
implementation kotlin('test-annotations-common')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$jvmSourceName {
|
$jvmSourceName {
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation 'org.jetbrains.kotlin:kotlin-stdlib'
|
implementation kotlin('stdlib')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$jvmTestName {
|
$jvmTestName {
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation 'org.jetbrains.kotlin:kotlin-test'
|
implementation kotlin('test')
|
||||||
implementation 'org.jetbrains.kotlin:kotlin-test-junit'
|
implementation kotlin('test-junit')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$nativeSourceName {
|
$nativeSourceName {
|
||||||
|
|||||||
+11
-13
@@ -145,35 +145,33 @@ class KotlinGradleMobileSharedMultiplatformModuleBuilder : KotlinGradleAbstractM
|
|||||||
apply plugin: 'maven-publish'
|
apply plugin: 'maven-publish'
|
||||||
|
|
||||||
kotlin {
|
kotlin {
|
||||||
targets {
|
jvm("$jvmTargetName")
|
||||||
fromPreset(presets.jvm, '$jvmTargetName')
|
// This is for iPhone emulator
|
||||||
// This preset is for iPhone emulator
|
// Switch here to iosArm64 (or iosArm32) to build library for iPhone device
|
||||||
// Switch here to presets.iosArm64 to build library for iPhone device
|
iosX64("$nativeTargetName") {
|
||||||
fromPreset(presets.iosX64, '$nativeTargetName') {
|
compilations.main.outputKinds("framework")
|
||||||
compilations.main.outputKinds 'FRAMEWORK'
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
sourceSets {
|
sourceSets {
|
||||||
$commonSourceName {
|
$commonSourceName {
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation 'org.jetbrains.kotlin:kotlin-stdlib-common'
|
implementation kotlin('stdlib-common')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$commonTestName {
|
$commonTestName {
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation 'org.jetbrains.kotlin:kotlin-test-common'
|
implementation kotlin('test-common')
|
||||||
implementation 'org.jetbrains.kotlin:kotlin-test-annotations-common'
|
implementation kotlin('test-annotations-common')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$jvmSourceName {
|
$jvmSourceName {
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation 'org.jetbrains.kotlin:kotlin-stdlib'
|
implementation kotlin('stdlib')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$jvmTestName {
|
$jvmTestName {
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation 'org.jetbrains.kotlin:kotlin-test'
|
implementation kotlin('test')
|
||||||
implementation 'org.jetbrains.kotlin:kotlin-test-junit'
|
implementation kotlin('test-junit')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$nativeSourceName {
|
$nativeSourceName {
|
||||||
|
|||||||
+15
-16
@@ -181,45 +181,44 @@ class KotlinGradleSharedMultiplatformModuleBuilder : KotlinGradleAbstractMultipl
|
|||||||
apply plugin: 'maven-publish'
|
apply plugin: 'maven-publish'
|
||||||
|
|
||||||
kotlin {
|
kotlin {
|
||||||
targets {
|
jvm("$jvmTargetName")
|
||||||
fromPreset(presets.jvm, '$jvmTargetName')
|
js("$jsTargetName")
|
||||||
fromPreset(presets.js, '$jsTargetName')
|
// For ARM, should be changed to iosArm32 or iosArm64
|
||||||
// For ARM, preset should be changed to presets.iosArm32 or presets.iosArm64
|
// For Linux, should be changed to e.g. linuxX64
|
||||||
// For Linux, preset should be changed to e.g. presets.linuxX64
|
// For MacOS, should be changed to e.g. macosX64
|
||||||
// For MacOS, preset should be changed to e.g. presets.macosX64
|
// For Windows, should be changed to e.g. mingwX64
|
||||||
fromPreset(presets.${defaultNativeTarget.presetName}, '${defaultNativeTarget.userTargetName}')
|
${defaultNativeTarget.presetName}("${defaultNativeTarget.userTargetName}")
|
||||||
}
|
|
||||||
sourceSets {
|
sourceSets {
|
||||||
$commonSourceName {
|
$commonSourceName {
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation 'org.jetbrains.kotlin:kotlin-stdlib-common'
|
implementation kotlin('stdlib-common')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$commonTestName {
|
$commonTestName {
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation 'org.jetbrains.kotlin:kotlin-test-common'
|
implementation kotlin('test-common')
|
||||||
implementation 'org.jetbrains.kotlin:kotlin-test-annotations-common'
|
implementation kotlin('test-annotations-common')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$jvmSourceName {
|
$jvmSourceName {
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk8'
|
implementation kotlin('stdlib-jdk8')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$jvmTestName {
|
$jvmTestName {
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation 'org.jetbrains.kotlin:kotlin-test'
|
implementation kotlin('test')
|
||||||
implementation 'org.jetbrains.kotlin:kotlin-test-junit'
|
implementation kotlin('test-junit')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$jsSourceName {
|
$jsSourceName {
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation 'org.jetbrains.kotlin:kotlin-stdlib-js'
|
implementation kotlin('stdlib-js')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$jsTestName {
|
$jsTestName {
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation 'org.jetbrains.kotlin:kotlin-test-js'
|
implementation kotlin('test-js')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$nativeSourceName {
|
$nativeSourceName {
|
||||||
|
|||||||
+12
-12
@@ -236,10 +236,10 @@ class KotlinGradleWebMultiplatformModuleBuilder : KotlinGradleAbstractMultiplatf
|
|||||||
def logback_version = '1.2.3'
|
def logback_version = '1.2.3'
|
||||||
|
|
||||||
kotlin {
|
kotlin {
|
||||||
targets {
|
jvm("$jvmTargetName")
|
||||||
fromPreset(presets.jvm, '$jvmTargetName')
|
js("$jsTargetName") {
|
||||||
fromPreset(presets.js, '$jsTargetName') {
|
compilations.all {
|
||||||
[tasks.getByName(compilations.main.compileKotlinTaskName), tasks.getByName(compilations.test.compileKotlinTaskName)]*.kotlinOptions {
|
kotlinOptions {
|
||||||
languageVersion = "1.3"
|
languageVersion = "1.3"
|
||||||
moduleKind = "umd"
|
moduleKind = "umd"
|
||||||
sourceMap = true
|
sourceMap = true
|
||||||
@@ -250,18 +250,18 @@ class KotlinGradleWebMultiplatformModuleBuilder : KotlinGradleAbstractMultiplatf
|
|||||||
sourceSets {
|
sourceSets {
|
||||||
$commonSourceName {
|
$commonSourceName {
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation 'org.jetbrains.kotlin:kotlin-stdlib-common'
|
implementation kotlin('stdlib-common')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$commonTestName {
|
$commonTestName {
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation 'org.jetbrains.kotlin:kotlin-test-common'
|
implementation kotlin('test-common')
|
||||||
implementation 'org.jetbrains.kotlin:kotlin-test-annotations-common'
|
implementation kotlin('test-annotations-common')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$jvmSourceName {
|
$jvmSourceName {
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk8'
|
implementation kotlin('stdlib-jdk8')
|
||||||
implementation "io.ktor:ktor-server-netty:${"$"}ktor_version"
|
implementation "io.ktor:ktor-server-netty:${"$"}ktor_version"
|
||||||
implementation "io.ktor:ktor-html-builder:${"$"}ktor_version"
|
implementation "io.ktor:ktor-html-builder:${"$"}ktor_version"
|
||||||
implementation "ch.qos.logback:logback-classic:${"$"}logback_version"
|
implementation "ch.qos.logback:logback-classic:${"$"}logback_version"
|
||||||
@@ -269,18 +269,18 @@ class KotlinGradleWebMultiplatformModuleBuilder : KotlinGradleAbstractMultiplatf
|
|||||||
}
|
}
|
||||||
$jvmTestName {
|
$jvmTestName {
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation 'org.jetbrains.kotlin:kotlin-test'
|
implementation kotlin('test')
|
||||||
implementation 'org.jetbrains.kotlin:kotlin-test-junit'
|
implementation kotlin('test-junit')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$jsSourceName {
|
$jsSourceName {
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation 'org.jetbrains.kotlin:kotlin-stdlib-js'
|
implementation kotlin('stdlib-js')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$jsTestName {
|
$jsTestName {
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation 'org.jetbrains.kotlin:kotlin-test-js'
|
implementation kotlin('test-js')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user