Daniel Weidensdörfer
06/24/2023, 8:29 AMJeff Lockhart
06/24/2023, 3:38 PMDaniel Weidensdörfer
06/24/2023, 7:12 PMval commonClientMain by creating {
dependsOn(commonMain)
}
val commonTest by getting {
dependsOn(commonClientMain)
}
and now making commonTest only depend uppon commonMain indirectly. The use case is that I'm working around not successully being able to mock in commonClientTest (a custom source set, see https://kotlinlang.slack.com/archives/C0BLU9K96/p1687546043593929). It works with commonTest, so I decided to test commonClientMain there as well. It doesnt work when executing the common tests when selecting js as target, showing an error that indicates that it sees a duplicate of sources. It works when running with jvm though.Jeff Lockhart
06/24/2023, 7:27 PMdependsOn
relationship with commonMain, so connecting them in this way would be problematic. They are separate source set trees that have a friend relationship that allows tests to access internal
visibility APIs. See this thread for more explanation.Daniel Weidensdörfer
06/24/2023, 7:33 PMcommonTest doesn't have a dependsOn relationship with commonMainWell, there must certainly be a dependency. When opening the module settings (right click on module -> open module settings). I can clearly see that commonTest depends upon commonMain without a dependsOn in the gradle script.
Jeff Lockhart
06/24/2023, 8:38 PMdependsOn
relationships between source sets is not the equivalent of a module's dependency relationships. The source set tree hierarchy allows for the `expect`/`actual` mechanism. commonTest doesn't have any tie into *commonMain*'s expect
declarations.
The relationship between commonTest and commonMain is closer to a module dependency, but has a special friend status such that commonTest can call internal
APIs within commonMain.