Added iOS target
This commit is contained in:
parent
47790b0486
commit
4999404113
|
@ -22,6 +22,21 @@ kotlin {
|
|||
|
||||
android()
|
||||
|
||||
targets {
|
||||
// Select iOS target for real device or emulator.
|
||||
final def iOSIsRealDevice = System.getenv('SDK_NAME')?.startsWith("iphoneos")
|
||||
final def iOSTarget = iOSIsRealDevice ? presets.iosArm64 : presets.iosX64
|
||||
|
||||
// iOS target.
|
||||
fromPreset(iOSTarget, 'ios') {
|
||||
binaries {
|
||||
framework {
|
||||
baseName = "fints4k"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
js() {
|
||||
|
||||
nodejs {
|
||||
|
@ -114,6 +129,16 @@ kotlin {
|
|||
}
|
||||
}
|
||||
|
||||
iosMain {
|
||||
dependencies {
|
||||
implementation "org.jetbrains.kotlin:kotlin-stdlib-common:$kotlinVersion"
|
||||
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core-native:1.3.5-native-mt"
|
||||
|
||||
implementation "io.ktor:ktor-client-ios:$ktorVersion"
|
||||
implementation "io.ktor:ktor-client-core-native:$ktorVersion"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
jsMain {
|
||||
dependsOn commonMain
|
||||
|
@ -142,6 +167,32 @@ kotlin {
|
|||
}
|
||||
|
||||
|
||||
// Task to generate iOS framework for xcode projects.
|
||||
task packForXCode(type: Sync) {
|
||||
|
||||
final File frameworkDir = new File(buildDir, "xcode-frameworks")
|
||||
final String mode = project.findProperty("XCODE_CONFIGURATION")?.toUpperCase() ?: 'DEBUG'
|
||||
|
||||
final def framework = kotlin.targets.ios.binaries.getFramework("", mode)
|
||||
|
||||
inputs.property "mode", mode
|
||||
dependsOn framework.linkTask
|
||||
|
||||
from { framework.outputFile.parentFile }
|
||||
into frameworkDir
|
||||
|
||||
doLast {
|
||||
new File(frameworkDir, 'gradlew').with {
|
||||
text = "#!/bin/bash\nexport 'JAVA_HOME=${System.getProperty("java.home")}'\ncd '${rootProject.rootDir}'\n./gradlew \$@\n"
|
||||
setExecutable(true)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Run packForXCode when building.
|
||||
tasks.build.dependsOn packForXCode
|
||||
|
||||
|
||||
android {
|
||||
compileSdkVersion androidCompileSdkVersion
|
||||
|
||||
|
|
Loading…
Reference in New Issue