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 {
|
||||
return """
|
||||
kotlin {
|
||||
targets {
|
||||
// For ARM, preset should be changed to presets.iosArm32 or presets.iosArm64
|
||||
// For Linux, preset should be changed to e.g. presets.linuxX64
|
||||
// For MacOS, preset should be changed to e.g. presets.macosX64
|
||||
fromPreset(presets.$nativePresetName, '$nativeTargetName')
|
||||
|
||||
configure([$nativeTargetName]) {
|
||||
// For ARM, should be changed to iosArm32 or iosArm64
|
||||
// For Linux, should be changed to e.g. linuxX64
|
||||
// For MacOS, should be changed to e.g. macosX64
|
||||
// For Windows, should be changed to e.g. mingwX64
|
||||
$nativePresetName("$nativeTargetName") {
|
||||
compilations.main {
|
||||
// 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:
|
||||
compilations.main.entryPoint 'sample.main'
|
||||
entryPoint 'sample.main'
|
||||
}
|
||||
}
|
||||
sourceSets {
|
||||
|
||||
+11
-13
@@ -306,35 +306,33 @@ sdk.dir=PleaseSpecifyAndroidSdkPathHere
|
||||
}
|
||||
|
||||
kotlin {
|
||||
targets {
|
||||
fromPreset(presets.android, '$jvmTargetName')
|
||||
// This preset is for iPhone emulator
|
||||
// Switch here to presets.iosArm64 (or iosArm32) to build library for iPhone device
|
||||
fromPreset(presets.iosX64, '$nativeTargetName') {
|
||||
compilations.main.outputKinds 'FRAMEWORK'
|
||||
}
|
||||
android("$jvmTargetName")
|
||||
// This is for iPhone emulator
|
||||
// Switch here to iosArm64 (or iosArm32) to build library for iPhone device
|
||||
iosX64("$nativeTargetName") {
|
||||
compilations.main.outputKinds("framework")
|
||||
}
|
||||
sourceSets {
|
||||
$commonSourceName {
|
||||
dependencies {
|
||||
implementation 'org.jetbrains.kotlin:kotlin-stdlib-common'
|
||||
implementation kotlin('stdlib-common')
|
||||
}
|
||||
}
|
||||
$commonTestName {
|
||||
dependencies {
|
||||
implementation 'org.jetbrains.kotlin:kotlin-test-common'
|
||||
implementation 'org.jetbrains.kotlin:kotlin-test-annotations-common'
|
||||
implementation kotlin('test-common')
|
||||
implementation kotlin('test-annotations-common')
|
||||
}
|
||||
}
|
||||
$jvmSourceName {
|
||||
dependencies {
|
||||
implementation 'org.jetbrains.kotlin:kotlin-stdlib'
|
||||
implementation kotlin('stdlib')
|
||||
}
|
||||
}
|
||||
$jvmTestName {
|
||||
dependencies {
|
||||
implementation 'org.jetbrains.kotlin:kotlin-test'
|
||||
implementation 'org.jetbrains.kotlin:kotlin-test-junit'
|
||||
implementation kotlin('test')
|
||||
implementation kotlin('test-junit')
|
||||
}
|
||||
}
|
||||
$nativeSourceName {
|
||||
|
||||
+11
-13
@@ -145,35 +145,33 @@ class KotlinGradleMobileSharedMultiplatformModuleBuilder : KotlinGradleAbstractM
|
||||
apply plugin: 'maven-publish'
|
||||
|
||||
kotlin {
|
||||
targets {
|
||||
fromPreset(presets.jvm, '$jvmTargetName')
|
||||
// This preset is for iPhone emulator
|
||||
// Switch here to presets.iosArm64 to build library for iPhone device
|
||||
fromPreset(presets.iosX64, '$nativeTargetName') {
|
||||
compilations.main.outputKinds 'FRAMEWORK'
|
||||
}
|
||||
jvm("$jvmTargetName")
|
||||
// This is for iPhone emulator
|
||||
// Switch here to iosArm64 (or iosArm32) to build library for iPhone device
|
||||
iosX64("$nativeTargetName") {
|
||||
compilations.main.outputKinds("framework")
|
||||
}
|
||||
sourceSets {
|
||||
$commonSourceName {
|
||||
dependencies {
|
||||
implementation 'org.jetbrains.kotlin:kotlin-stdlib-common'
|
||||
implementation kotlin('stdlib-common')
|
||||
}
|
||||
}
|
||||
$commonTestName {
|
||||
dependencies {
|
||||
implementation 'org.jetbrains.kotlin:kotlin-test-common'
|
||||
implementation 'org.jetbrains.kotlin:kotlin-test-annotations-common'
|
||||
implementation kotlin('test-common')
|
||||
implementation kotlin('test-annotations-common')
|
||||
}
|
||||
}
|
||||
$jvmSourceName {
|
||||
dependencies {
|
||||
implementation 'org.jetbrains.kotlin:kotlin-stdlib'
|
||||
implementation kotlin('stdlib')
|
||||
}
|
||||
}
|
||||
$jvmTestName {
|
||||
dependencies {
|
||||
implementation 'org.jetbrains.kotlin:kotlin-test'
|
||||
implementation 'org.jetbrains.kotlin:kotlin-test-junit'
|
||||
implementation kotlin('test')
|
||||
implementation kotlin('test-junit')
|
||||
}
|
||||
}
|
||||
$nativeSourceName {
|
||||
|
||||
+15
-16
@@ -181,45 +181,44 @@ class KotlinGradleSharedMultiplatformModuleBuilder : KotlinGradleAbstractMultipl
|
||||
apply plugin: 'maven-publish'
|
||||
|
||||
kotlin {
|
||||
targets {
|
||||
fromPreset(presets.jvm, '$jvmTargetName')
|
||||
fromPreset(presets.js, '$jsTargetName')
|
||||
// For ARM, preset should be changed to presets.iosArm32 or presets.iosArm64
|
||||
// For Linux, preset should be changed to e.g. presets.linuxX64
|
||||
// For MacOS, preset should be changed to e.g. presets.macosX64
|
||||
fromPreset(presets.${defaultNativeTarget.presetName}, '${defaultNativeTarget.userTargetName}')
|
||||
}
|
||||
jvm("$jvmTargetName")
|
||||
js("$jsTargetName")
|
||||
// For ARM, should be changed to iosArm32 or iosArm64
|
||||
// For Linux, should be changed to e.g. linuxX64
|
||||
// For MacOS, should be changed to e.g. macosX64
|
||||
// For Windows, should be changed to e.g. mingwX64
|
||||
${defaultNativeTarget.presetName}("${defaultNativeTarget.userTargetName}")
|
||||
sourceSets {
|
||||
$commonSourceName {
|
||||
dependencies {
|
||||
implementation 'org.jetbrains.kotlin:kotlin-stdlib-common'
|
||||
implementation kotlin('stdlib-common')
|
||||
}
|
||||
}
|
||||
$commonTestName {
|
||||
dependencies {
|
||||
implementation 'org.jetbrains.kotlin:kotlin-test-common'
|
||||
implementation 'org.jetbrains.kotlin:kotlin-test-annotations-common'
|
||||
implementation kotlin('test-common')
|
||||
implementation kotlin('test-annotations-common')
|
||||
}
|
||||
}
|
||||
$jvmSourceName {
|
||||
dependencies {
|
||||
implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk8'
|
||||
implementation kotlin('stdlib-jdk8')
|
||||
}
|
||||
}
|
||||
$jvmTestName {
|
||||
dependencies {
|
||||
implementation 'org.jetbrains.kotlin:kotlin-test'
|
||||
implementation 'org.jetbrains.kotlin:kotlin-test-junit'
|
||||
implementation kotlin('test')
|
||||
implementation kotlin('test-junit')
|
||||
}
|
||||
}
|
||||
$jsSourceName {
|
||||
dependencies {
|
||||
implementation 'org.jetbrains.kotlin:kotlin-stdlib-js'
|
||||
implementation kotlin('stdlib-js')
|
||||
}
|
||||
}
|
||||
$jsTestName {
|
||||
dependencies {
|
||||
implementation 'org.jetbrains.kotlin:kotlin-test-js'
|
||||
implementation kotlin('test-js')
|
||||
}
|
||||
}
|
||||
$nativeSourceName {
|
||||
|
||||
+12
-12
@@ -236,10 +236,10 @@ class KotlinGradleWebMultiplatformModuleBuilder : KotlinGradleAbstractMultiplatf
|
||||
def logback_version = '1.2.3'
|
||||
|
||||
kotlin {
|
||||
targets {
|
||||
fromPreset(presets.jvm, '$jvmTargetName')
|
||||
fromPreset(presets.js, '$jsTargetName') {
|
||||
[tasks.getByName(compilations.main.compileKotlinTaskName), tasks.getByName(compilations.test.compileKotlinTaskName)]*.kotlinOptions {
|
||||
jvm("$jvmTargetName")
|
||||
js("$jsTargetName") {
|
||||
compilations.all {
|
||||
kotlinOptions {
|
||||
languageVersion = "1.3"
|
||||
moduleKind = "umd"
|
||||
sourceMap = true
|
||||
@@ -250,18 +250,18 @@ class KotlinGradleWebMultiplatformModuleBuilder : KotlinGradleAbstractMultiplatf
|
||||
sourceSets {
|
||||
$commonSourceName {
|
||||
dependencies {
|
||||
implementation 'org.jetbrains.kotlin:kotlin-stdlib-common'
|
||||
implementation kotlin('stdlib-common')
|
||||
}
|
||||
}
|
||||
$commonTestName {
|
||||
dependencies {
|
||||
implementation 'org.jetbrains.kotlin:kotlin-test-common'
|
||||
implementation 'org.jetbrains.kotlin:kotlin-test-annotations-common'
|
||||
implementation kotlin('test-common')
|
||||
implementation kotlin('test-annotations-common')
|
||||
}
|
||||
}
|
||||
$jvmSourceName {
|
||||
dependencies {
|
||||
implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk8'
|
||||
implementation kotlin('stdlib-jdk8')
|
||||
implementation "io.ktor:ktor-server-netty:${"$"}ktor_version"
|
||||
implementation "io.ktor:ktor-html-builder:${"$"}ktor_version"
|
||||
implementation "ch.qos.logback:logback-classic:${"$"}logback_version"
|
||||
@@ -269,18 +269,18 @@ class KotlinGradleWebMultiplatformModuleBuilder : KotlinGradleAbstractMultiplatf
|
||||
}
|
||||
$jvmTestName {
|
||||
dependencies {
|
||||
implementation 'org.jetbrains.kotlin:kotlin-test'
|
||||
implementation 'org.jetbrains.kotlin:kotlin-test-junit'
|
||||
implementation kotlin('test')
|
||||
implementation kotlin('test-junit')
|
||||
}
|
||||
}
|
||||
$jsSourceName {
|
||||
dependencies {
|
||||
implementation 'org.jetbrains.kotlin:kotlin-stdlib-js'
|
||||
implementation kotlin('stdlib-js')
|
||||
}
|
||||
}
|
||||
$jsTestName {
|
||||
dependencies {
|
||||
implementation 'org.jetbrains.kotlin:kotlin-test-js'
|
||||
implementation kotlin('test-js')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user