nestserau
12/17/2018, 8:59 AMHttpClient
and runBlocking
, while the code itself compiles perfectly fine. What could be a reason for that?gildor
12/17/2018, 9:02 AMmsink
12/17/2018, 9:18 AMbuild.gradle
nestserau
12/17/2018, 9:27 AMplugins {
id 'com.android.library'
id 'kotlin-multiplatform'
id 'maven-publish'
}
repositories {
google()
jcenter()
mavenCentral()
maven { url '<http://archiva.example.com:9080/repository/internal>' }
}
group 'com.example.multiplatform'
version '0.4.1'
android {
compileSdkVersion 28
defaultConfig {
minSdkVersion 21
}
buildTypes {
release {
minifyEnabled true
}
}
}
ext.ktor_version = '1.0.+'
kotlin {
targets {
final def iosTarget = System.getenv('SDK_NAME')?.startsWith("iphoneos") ? presets.iosArm64 : presets.iosX64
fromPreset(iosTarget, 'ios') {
compilations.main.outputKinds('FRAMEWORK')
}
fromPreset(presets.android, 'android')
}
sourceSets {
all {
languageSettings {
languageVersion = '1.3'
useExperimentalAnnotation 'kotlin.ExperimentalUnsignedTypes'
}
}
commonMain {
dependencies {
implementation 'org.jetbrains.kotlin:kotlin-stdlib-common'
implementation "io.ktor:ktor-client:$ktor_version"
}
}
commonTest {
dependencies {
implementation 'org.jetbrains.kotlin:kotlin-test-common'
implementation 'org.jetbrains.kotlin:kotlin-test-annotations-common'
}
}
iosMain
iosTest
}
}
dependencies {
androidMainImplementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk8'
androidMainImplementation "io.ktor:ktor-client-android:$ktor_version"
androidTestImplementation 'junit:junit:4.12'
androidTestImplementation 'org.jetbrains.kotlin:kotlin-test'
androidTestImplementation 'org.jetbrains.kotlin:kotlin-test-junit'
androidTestImplementation "io.ktor:ktor-client-android:$ktor_version"
iosMainImplementation "io.ktor:ktor-client-ios:$ktor_version"
}
configurations {
compileClasspath
}
task packForXCode(type: Sync) {
final File frameworkDir = new File(buildDir, "xcode-frameworks")
final String mode = project.findProperty("XCODE_CONFIGURATION")?.toUpperCase() ?: 'DEBUG'
inputs.property "mode", mode
dependsOn kotlin.targets.ios.compilations.main.linkTaskName("FRAMEWORK", mode)
from { kotlin.targets.ios.compilations.main.getBinary("FRAMEWORK", mode).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)
}
}
}
tasks.build.dependsOn packForXCode
task iosTest {
def device = project.findProperty("iosDevice")?.toString() ?: "iPhone 8"
dependsOn 'linkTestDebugExecutableIos'
group = JavaBasePlugin.VERIFICATION_GROUP
description = "Runs tests for target 'ios' on an iOS simulator"
doLast {
def binary = kotlin.targets.ios.compilations.test.getBinary('EXECUTABLE', 'DEBUG')
exec {
commandLine 'xcrun', 'simctl', 'spawn', device, binary.absolutePath
}
}
}
tasks.check.dependsOn iosTest
msink
12/17/2018, 9:33 AMext.ktor_version = '1.0.+'
- better use exact version.nestserau
12/17/2018, 9:36 AMgildor
12/17/2018, 9:36 AMnestserau
12/17/2018, 9:37 AMgildor
12/17/2018, 9:37 AMio.ktor:ktor-client-jvm
nestserau
12/17/2018, 9:42 AMmsink
12/17/2018, 9:46 AMgildor
12/17/2018, 9:49 AMmsink
12/17/2018, 9:52 AMnestserau
12/17/2018, 10:05 AMandroid
target, invalidated cache and restarted. No change.