Joey
04/26/2020, 5:37 AMplugins {
id 'org.jetbrains.kotlin.multiplatform' version '1.3.71'
id 'org.jetbrains.kotlin.plugin.serialization' version '1.3.71'
}
repositories {
jcenter()
mavenCentral()
}
//apply plugin: 'com.android.library'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlinx-serialization'
//android {
// compileSdkVersion 28
// buildTypes {
// release {
// minifyEnabled false
// }
// }
//}
kotlin {
// This is for iPhone emulator
// Switch here to iosArm64 (or iosArm32) to build library for iPhone device
targets {
final def iOSTarget = System.getenv('SDK_NAME')?.startsWith("iphoneos") \
? presets.iosArm64 : presets.iosX64
fromPreset(iOSTarget, 'ios') {
binaries {
framework("framework")
}
}
fromPreset(presets.jvm, 'android')
}
def ktor_version = "1.3.0-rc"
def serialization_version = "0.14.0"
def coroutines_version = "1.3.5"
def klock_version = "1.7.0"
sourceSets {
commonMain {
dependencies {
implementation kotlin('stdlib-common')
implementation "io.ktor:ktor-client-core:$ktor_version"
implementation "org.jetbrains.kotlinx:kotlinx-serialization-runtime-common:$serialization_version"
implementation "io.ktor:ktor-client-json:$ktor_version"
implementation("io.ktor:ktor-client-okhttp:$ktor_version")
implementation "io.ktor:ktor-client-serialization:$ktor_version"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core-common:$coroutines_version"
implementation "com.soywiz.korlibs.klock:klock:$klock_version"
}
}
commonTest {
dependencies {
implementation kotlin('test-common')
implementation kotlin('test-annotations-common')
}
}
androidMain {
dependencies {
implementation kotlin('stdlib')
implementation "org.jetbrains.kotlinx:kotlinx-serialization-runtime-native:$serialization_version"
implementation "io.ktor:ktor-client-serialization-jvm:$ktor_version"
}
}
androidTest {
dependencies {
implementation kotlin('test')
implementation kotlin('test-junit')
}
}
iosMain {
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core-native:$coroutines_version"
implementation "io.ktor:ktor-client-serialization-native:$ktor_version"
}
iosTest {
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core-native:$coroutines_version"
}
}
}
// This task attaches native framework built from ios module to Xcode project
// (see iosApp directory). Don't run this task directly,
// Xcode runs this task itself during its build process.
// 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 kotlin.targets."$target".binaries.getFramework(buildType).linkTask
doLast {
def srcFile = kotlin.targets."$target".binaries.getFramework(buildType).outputFile
def targetDir = getProperty('configuration.build.dir')
copy {
from srcFile.parent
into targetDir
include 'shared.framework/**'
include 'shared.framework.dSYM'
}
}
}
I also have enableFeaturePreview("GRADLE_METADATA")
but i couldn't resolve dependencies in my iosMain
. What am i missing here? Thanksyshrsmz
04/26/2020, 6:37 AMyshrsmz
04/26/2020, 6:38 AMJoey
04/26/2020, 12:43 PMrusshwolf
04/26/2020, 1:02 PM