gmaciel
06/26/2019, 3:36 PMgmaciel
06/26/2019, 3:36 PMapply plugin: "org.jetbrains.kotlin.multiplatform"
kotlin {
targets {
//Xcode sets SDK_NAME environment variable - based on whether the
//target device is a simulator or a real device, the preset should vary
final def iOSTarget = System.getenv('SDK_NAME')?.startsWith("iphoneos") \
? presets.iosArm64 : presets.iosX64
//outputKinds - FRAMEWORK would mean that the shared code would be exported as a FRAMEWORK
// EXECUTABLE - produces a standalone executable that can be used to run as an app
fromPreset(iOSTarget, 'ios') {
binaries {
framework('SharedCode')
}
}
fromPreset(presets.jvm, 'android')
}
sourceSets {
commonMain {
dependencies {
implementation kotlin('stdlib-common')
}
}
commonTest {
dependencies {
implementation kotlin('test-common')
implementation kotlin('test-annotations-common')
}
}
androidMain {
dependencies {
implementation kotlin('stdlib')
}
}
androidTest {
dependencies {
implementation kotlin('test')
implementation kotlin('test-junit')
}
}
iosMain {
}
iosTest {
}
}
}
gmaciel
06/26/2019, 3:38 PMSam
06/26/2019, 3:39 PMiosTest {
dependsOn commonTest
}
Sam
06/26/2019, 3:43 PMfromPreset(presets.android, 'android')
and add in a jvm()
target for fast running of tests from the command line.gmaciel
06/26/2019, 3:48 PMgmaciel
06/26/2019, 3:48 PMorg.junit.ComparisonFailure:
Expected :Platform
Actual :Hello from Android
gmaciel
06/26/2019, 3:48 PMgmaciel
06/26/2019, 3:51 PMfromPreset(presets.android, 'android')
it fails with: Extension with name 'android' does not exist.
gmaciel
06/26/2019, 3:57 PMSam
06/26/2019, 3:59 PMandroid { ... }
block with the standard params (compileSDKVersion, defaultConfig, etc) outside of the kotlin { } block.Sam
06/26/2019, 4:00 PMgmaciel
06/26/2019, 4:01 PMgmaciel
06/26/2019, 4:01 PMgmaciel
06/26/2019, 4:01 PM