MPP Wizards: Clearer notation in generated build.gradle files
- Follow the same style as used in public documentation: https://kotlinlang.org/docs/reference/building-mpp-with-gradle.html - Use standard methods to get link task name, don't evaluate it manually
This commit is contained in:
+4
-4
@@ -75,9 +75,9 @@ class KotlinGradleNativeMultiplatformModuleBuilder : KotlinGradleAbstractMultipl
|
||||
|
||||
configure([$nativeTargetName]) {
|
||||
// Comment to generate Kotlin/Native library (KLIB) instead of executable file:
|
||||
compilations.main.outputKinds('EXECUTABLE')
|
||||
compilations.main.outputKinds 'EXECUTABLE'
|
||||
// Change to specify fully qualified name of your application's entry point:
|
||||
compilations.main.entryPoint = 'sample.main'
|
||||
compilations.main.entryPoint 'sample.main'
|
||||
}
|
||||
}
|
||||
sourceSets {
|
||||
@@ -91,8 +91,8 @@ class KotlinGradleNativeMultiplatformModuleBuilder : KotlinGradleAbstractMultipl
|
||||
}
|
||||
|
||||
task runProgram {
|
||||
def buildType = 'release' // Change to 'debug' to run application with debug symbols.
|
||||
dependsOn "link${'$'}{buildType.capitalize()}Executable${nativeTargetName.capitalize()}"
|
||||
def buildType = 'RELEASE' // Change to 'DEBUG' to run application with debug symbols.
|
||||
dependsOn kotlin.targets.$nativeTargetName.compilations.main.linkTaskName('EXECUTABLE', buildType)
|
||||
doLast {
|
||||
def programFile = kotlin.targets.$nativeTargetName.compilations.main.getBinary('EXECUTABLE', buildType)
|
||||
exec {
|
||||
|
||||
+9
-9
@@ -285,12 +285,12 @@ sdk.dir=PleaseSpecifyAndroidSdkPathHere
|
||||
android {
|
||||
compileSdkVersion 28
|
||||
defaultConfig {
|
||||
applicationId "org.jetbrains.kotlin.mpp_app_android"
|
||||
applicationId 'org.jetbrains.kotlin.mpp_app_android'
|
||||
minSdkVersion 15
|
||||
targetSdkVersion 28
|
||||
versionCode 1
|
||||
versionName "1.0"
|
||||
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
||||
versionName '1.0'
|
||||
testInstrumentationRunner 'android.support.test.runner.AndroidJUnitRunner'
|
||||
}
|
||||
buildTypes {
|
||||
release {
|
||||
@@ -312,7 +312,7 @@ sdk.dir=PleaseSpecifyAndroidSdkPathHere
|
||||
// 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')
|
||||
compilations.main.outputKinds 'FRAMEWORK'
|
||||
}
|
||||
}
|
||||
sourceSets {
|
||||
@@ -351,13 +351,13 @@ sdk.dir=PleaseSpecifyAndroidSdkPathHere
|
||||
// Before opening the project from iosApp directory in Xcode,
|
||||
// make sure all Gradle infrastructure exists (gradle.wrapper, gradlew).
|
||||
task copyFramework {
|
||||
def buildType = project.findProperty("kotlin.build.type") ?: "DEBUG"
|
||||
def target = project.findProperty("kotlin.target") ?: "ios"
|
||||
dependsOn "link${"$"}{buildType.toLowerCase().capitalize()}Framework${"$"}{target.capitalize()}"
|
||||
def buildType = project.findProperty('kotlin.build.type') ?: 'DEBUG'
|
||||
def target = project.findProperty('kotlin.target') ?: 'ios'
|
||||
dependsOn kotlin.targets."${"$"}target".compilations.main.linkTaskName('FRAMEWORK', buildType)
|
||||
|
||||
doLast {
|
||||
def srcFile = kotlin.targets."${"$"}target".compilations.main.getBinary("FRAMEWORK", buildType)
|
||||
def targetDir = getProperty("configuration.build.dir")
|
||||
def srcFile = kotlin.targets."${"$"}target".compilations.main.getBinary('FRAMEWORK', buildType)
|
||||
def targetDir = getProperty('configuration.build.dir')
|
||||
copy {
|
||||
from srcFile.parent
|
||||
into targetDir
|
||||
|
||||
+1
-1
@@ -151,7 +151,7 @@ class KotlinGradleMobileSharedMultiplatformModuleBuilder : KotlinGradleAbstractM
|
||||
// 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')
|
||||
compilations.main.outputKinds 'FRAMEWORK'
|
||||
}
|
||||
}
|
||||
sourceSets {
|
||||
|
||||
Reference in New Issue
Block a user