https://kotlinlang.org logo
Title
g

Grégory Lureau

08/25/2022, 10:00 AM
When I enable KSP on a KMP project (Android/JS/...) and I run only
compileTestKotlinJs
it somehow triggers the task
kspReleaseUnitTestKotlinAndroid
. Any idea why it's linked? Is it an expected behavior?
t

Ting-Yuan Huang

08/25/2022, 8:04 PM
Can you run a build scan to see how the dependency is introduced? https://scans.gradle.com/
g

Grégory Lureau

08/26/2022, 6:51 AM
I finally understood the problem, MocKMP is forced to use Android JVM and creates a weird dependency, requiring JS to depends on Android to build mocks, initially coming from https://github.com/google/ksp/issues/567
I think I can't reorder gradle targets so I may have to fork MocKMP and change a bit the patch so that I prefer JVM to Android (maybe a PR if it's accepted).
m

Matthias Geisler

08/26/2022, 7:42 AM
That sounds more like something misfires...the compiler for Js and Jvm are separated...
KMock for example is totally fine to generate things for arbitrary SourceSets (with a bit of additional Gradle Magic)
g

Grégory Lureau

08/26/2022, 8:01 AM
Interesting, thanks! May it be an old requirement? IIRC Mockmp has been written on KSP 1.0, almost the same time you started kmock right?
Also I'm seeing this trick here, may it be related?
m

Matthias Geisler

08/26/2022, 8:25 AM
TBH, I started KMock after MocKMP because I was a bit disappointed
And the trick is not related directly...it is only about order of execution...here is the counterpart.