Not sure, that it’s the right channel, but: Is it ...
# gradle
o
Not sure, that it’s the right channel, but: Is it possible to have multiplatform module with JVM/JS/NATIVE targets with expect/actual and tests, and be able to run those tests also on Android emulator? Note:
android
target is not needed in the
main
compilation, and so no need to publish it, but should be only in
test
j
Maybe create a separate Android module with your KMP module as a dependency and create tests there. If you need access to internal APIs, you can use
@file:Suppress("INVISIBLE_REFERENCE", "INVISIBLE_MEMBER", "INVISIBLE_SETTER")
. If you want to run your common tests, you could symlink the source set directory to the Android module tests. IntelliJ doesn't like shared source set roots, but symlinking works around this as it's a different path.
o
Yeah, I thought about this (I even don’t need to suppress anything), though, it’s not really convenient, as there could be multiple such modules. Overall, it’s a library, which doesn’t have any usage of Android API (at least for now, and likely forever in core modules) and so there are multiple modules, which should be tested on Android, so I will need to create an additional module specific for android, for every such main module 🙂
But thanks about pointing to symlinks! I haven’t thought about them…. may be I can think of some solution using them 🙂 Thx!
j
You might be able to use a single Android module to test all the other modules, depending on the package layout, if there are no conflicting classes and tests can merge together ok. It might get tedious though if packages are partially shared.