Hey guys is there any way to pass environment vari...
# gradle
j
Hey guys is there any way to pass environment variables to the process running Kotlin/Native iOS tests? The following works fine for
mingwX64
target:
Copy code
tasks.withType<org.jetbrains.kotlin.gradle.targets.native.tasks.KotlinNativeTest> {
    environment("SOME_VAR", "some value")
}
But for some reason those are not passed when running iOS tests. Does this have to do with the fact that iOS tests run in a simulator and therefore likely start a separate process? Is there any way to pass environment variables to that other process, then? (Note that in reality I'm setting
environment()
in a nested
doFirst { }
block because I need execution time information, but the problem occurs as well even without this peculiarity so I simplified the example)
1
I finally found my answer: the environment variables used by the test process are not passed to the emulator in general. However, there is a convention to pass environment variables: the
SIMCTL_CHILD_
prefix. Name a variable
SIMCTL_CHILD_MYVAR
and its value will be passed by
simctl
to the emulator as the environment variable
MYVAR
.