I'm in a KMP project, and I'd like to run the JVM ...
# gradle
c
I'm in a KMP project, and I'd like to run the JVM test suite (specifically) twice, with two different classpaths. Other platforms should behave as usual. For context: I'm writing a library that depends on another one, which uses service-loading to choose which implementation it uses. I want to ensure my library works the same way no matter which service implementation is loaded. Is this possible without hacking too many internals?
👀 1
h
Do you use the Gradle jvm-test-suite plugin?
c
I do not. AFAIK it's not compatible with
kotlin("multiplatform")
, but maybe it is now?
h
Hm, good question.
o
It's unlikely that anything of the above is going to work. 1. KMP does not support multiple JVM targets (I had used those successfully a long time ago, but it was not sustainable). 2. The incubating Gradle JVM Test Suite Plugin is designed to create arbitrary source sets for tests, which collides with KMP's opinions on source sets. What would work is to create the JVM test suite as a Gradle module (in its main source set), and either • create two other Gradle modules importing the JVM test suite module, or • create another Gradle module with an
org.jetbrains.kotlin.jvm
plus Gradle JVM Test Suite Plugin and configure two test suites there (a TestBalloon example is here, but remember to set
testBalloon.gradleTestSuiteNamesRegex
).
👀 1