spierce7
09/29/2018, 3:14 PMspierce7
09/29/2018, 3:14 PMapply plugin: 'com.android.library'
apply plugin: 'kotlin-multiplatform'
android {
compileSdkVersion androidConfig.compileSdkVersion
defaultConfig {
minSdkVersion androidConfig.minSdkVersion
targetSdkVersion androidConfig.targetSdkVersion
}
}
dependencies {
testImplementation deps.kotlin.test.jvm
testImplementation deps.kotlin.test.jvm_annotations
}
kotlin {
targets {
fromPreset(presets.android, 'android')
fromPreset(presets.iosX64, 'ios') {
compilations.main.outputKinds('FRAMEWORK')
}
}
sourceSets {
commonMain {
dependencies {
implementation deps.kotlin.stdlib
api project(':store')
}
}
iosMain {
}
commonTest {
dependencies {
implementation deps.kotlin.test.common
implementation deps.kotlin.test.common_annotations
implementation project(':store-test')
}
}
}
}
thevery
09/29/2018, 3:18 PMspierce7
09/29/2018, 3:35 PMspierce7
09/29/2018, 3:37 PMclass IosTest {
@Test fun iosTest() {
assertTrue { false }
}
}
./gradlew test
and the build passes. If I do that with a common or an Android test, the build fails because the jvm targets are working properly it seemsspierce7
09/29/2018, 3:51 PM./gradlew macosX64Test
spierce7
09/29/2018, 3:55 PMthevery
09/29/2018, 4:28 PMrusshwolf
09/29/2018, 4:32 PMthevery
09/29/2018, 4:34 PMthevery
09/29/2018, 4:36 PMthevery
09/29/2018, 4:37 PMspierce7
09/29/2018, 4:52 PMkotlin-platform-ios
plugin did something like this though:
afterEvaluate { project ->
project.task('test', dependsOn: 'compileTestDebugKotlinNative', type: Exec, overwrite: true) {
def testExecutable = tasks["compileTestDebugKotlinNative"].outputFile
commandLine("xcrun", "simctl", "spawn", "iPhone 8", testExecutable)
}
}
russhwolf
09/29/2018, 5:09 PMtest
task for the native build with a command to run the ios_x64 test binary on the simulator. On the new plugin though I’ve had two issues: I haven’t been able to figure out the equivalent way to grab the test binary (tasks["compileTestKotlinIosSim"].outputFile
doesn’t seem to work) and I don’t know how to hook into the correct test step because there isn’t a separate native/ios test task to overwrite.thevery
09/29/2018, 6:14 PMspierce7
09/29/2018, 7:39 PMthevery
09/29/2018, 7:40 PMspierce7
09/29/2018, 7:53 PMspierce7
09/29/2018, 7:53 PMcommandLine("xcrun", "simctl", "spawn", "iPhone 8", textExecutable)
doesn't work for me. Why would that be?
$ xcrun simctl spawn iPhone 8
Invalid device: iPhone
thevery
09/29/2018, 9:27 PMLiliia
10/01/2018, 10:00 AMthevery
10/01/2018, 10:05 AMLiliia
10/01/2018, 10:11 AM