mbonnin
09/12/2023, 1:37 PM1.9.20-Beta
, I'm hit with:
w: Kotlin Source Set 'jvmJavaCodegen' can't depend on 'commonTest' as they are from different Source Set Trees.
Please remove this dependency edge.
Is there somewhere I can learn about Source Set Trees? What constitutes a Tree?tapchicoma
09/12/2023, 1:42 PMmbonnin
09/12/2023, 1:45 PMcommonMain
and commonTest
are disjoint, interesting!mbonnin
09/12/2023, 1:47 PMcommonTest
to depend on commonMain
to get the dependencies but we don't want to compile commonMain
sources together with commonTest
ones (since they are already compiled)mbonnin
09/12/2023, 1:48 PMjavaCodegen
was created as a separate compilation. And looks like it's put in the commonMain
tree by default? Can I create a compilation whose defaultSourceSet depends on commonTest
instead? Not sure if that makes any sense... 😅tapchicoma
09/12/2023, 1:49 PMmbonnin
09/12/2023, 1:50 PMAnton Lakotka [JB]
09/12/2023, 2:01 PMWhat constitutes a Tree?We will publish some documentation explaining that upon 1.9.20 release. Practically it is about Source Sets that compile together. for example commonMain, nativeMain linuxX64Main and etc expect to compile together. And "Main" suffix is that Source Set Tree. there are by default two Source Set Trees: main and test. As you noticed already test and main should be disjoint. Yet test still depends on main, but not via KotlinSourceSet.dependsOn mechanism but as regular dependency. It is done through
KotlinCompilation.associateWith(KotlinCompilation)
So if you want to see declarations from javaCodegen in main and test source sets. Then you need to use associateWith API.
Maybe you can drop branch with your changes and where you need to fix this. Then I'll try to help you.mbonnin
09/12/2023, 2:04 PMmbonnin
09/12/2023, 3:21 PMexpect/actual
without actually having to write all the expect/actual
.
I have a lot of generated code in both Java and Kotlin. These are the same classes, same APIs, same behaviour, same everything, just the implementation language changes. I'd like write all my tests only once (in Kotlin) and run them twice, once with the Java generated code and another time with the Kotlin one. I've become quite convinced doing so without breaking IDE support is not possible (because there is no way to have both Java and Kotlin dependencies at the same time).
All in all sounds like this is more a problem of missing a custom commonizer or something like so, not 100% sure. In all cases, I'm quite confident I can get rid of the warning now. I'll post the link to the commit when I get to itmbonnin
09/13/2023, 11:02 AMmbonnin
09/13/2023, 11:02 AM