Hi I’m getting the following warning after updatin...
# gradle
c
Hi I’m getting the following warning after updating to Kotlin
1.9.20
and the warning becomes an error in Kotlin `2.0.0-Beta2`:
Copy code
w: Kotlin Source Set 'androidInstrumentedTest' can't depend on 'commonTest' as they are from different Source Set Trees.
Please remove this dependency edge.
Has anyone else run into this and knows how to fix? Here’s the surrounding code.
m
I have the same and I'm hoping this restriction can be relaxed. I lost some of the context around this but I think there are legit use cases out there
v
As far as I have seen the comments on that issue contain how to change configuration that it works.
m
Sometimes you can't though. My use case is I have 2 possible HTTP clients: Ktor & OkHttp. I want to share the tests between both so I have a
commonTest
sourceSet that is included from 2 compilations. I think this is what triggers the warning
I haven't found a solution that works without the warning and still allows to use
expect
/`actual` (the tests rely on a
expect fun httpClient(): HttpClient
function)
There's more context in https://youtrack.jetbrains.com/issue/KT-59316 (it's not directly about this issue but having multiple targets of the same "type", which I think is tangential to this issue)
the warning becomes an error in Kotlin
Interestingly, we're still able to compile with the warning in latest Apollo Kotlin 🤔
Copy code
> Configure project :engine
w: Kotlin Source Set 'ktorTest' can't depend on 'commonTest' as they are from different Source Set Trees.
c
the warning becomes an error in Kotlin
@mbonnin I ran into this as part of updating Zipline for K2. We’re currently ignoring it on
1.9.22
, but the Android build fails on
2.0.0-Beta2
with this, which seems related:
Copy code
e: Files '/Users/runner/work/zipline/zipline/zipline/src/hostTest/kotlin/app/cash/zipline/testUtilEngine.kt', '/Users/runner/work/zipline/zipline/zipline/src/hostTest/kotlin/app/cash/zipline/ZiplineServiceTypeTest.kt', '/Users/runner/work/zipline/zipline/zipline/src/hostTest/kotlin/app/cash/zipline/FlowTest.kt', '/Users/runner/work/zipline/zipline/zipline/src/hostTest/kotlin/app/cash/zipline/EncodingTest.kt', '/Users/runner/work/zipline/zipline/zipline/src/hostTest/kotlin/app/cash/zipline/SampleService.kt', '/Users/runner/work/zipline/zipline/zipline/src/hostTest/kotlin/app/cash/zipline/ZiplineServiceTest.kt', '/Users/runner/work/zipline/zipline/zipline/src/hostTest/kotlin/app/cash/zipline/internal/SignaturePayloadTest.kt', '/Users/runner/work/zipline/zipline/zipline/src/hostTest/kotlin/app/cash/zipline/internal/bridge/SerialNameTest.kt', '/Users/runner/work/zipline/zipline/zipline/src/hostTest/kotlin/app/cash/zipline/internal/TopologicalSortTest.kt', '/Users/runner/work/zipline/zipline/zipline/src/hostTest/kotlin/app/cash/zipline/EventListenerEndpointTest.kt', '/Users/runner/work/zipline/zipline/zipline/src/hostTest/kotlin/app/cash/zipline/ServiceMemberTest.kt', '/Users/runner/work/zipline/zipline/zipline/src/hostTest/kotlin/app/cash/zipline/QuickJsCompileTest.kt', '/Users/runner/work/zipline/zipline/zipline/src/hostTest/kotlin/app/cash/zipline/QuickJsOutboundChannelTest.kt', '/Users/runner/work/zipline/zipline/zipline/src/hostTest/kotlin/app/cash/zipline/QuickJsInboundChannelTest.kt', '/Users/runner/work/zipline/zipline/zipline/src/hostTest/kotlin/app/cash/zipline/ZiplineManifestTest.kt', '/Users/runner/work/zipline/zipline/zipline/src/hostTest/kotlin/app/cash/zipline/EndpointPropertiesTest.kt', '/Users/runner/work/zipline/zipline/zipline/src/hostTest/kotlin/app/cash/zipline/LoggingCallChannel.kt', '/Users/runner/work/zipline/zipline/zipline/src/hostTest/kotlin/app/cash/zipline/SetTimeoutTest.kt', '/Users/runner/work/zipline/zipline/zipline/src/hostTest/kotlin/app/cash/zipline/EndpointTest.kt', '/Users/runner/work/zipline/zipline/zipline/src/hostTest/kotlin/app/cash/zipline/QuickJsTest.kt', '/Users/runner/work/zipline/zipline/zipline/src/hostTest/kotlin/app/cash/zipline/TuningApisTest.kt', '/Users/runner/work/zipline/zipline/zipline/src/hostTest/kotlin/app/cash/zipline/Utf8Test.kt', '/Users/runner/work/zipline/zipline/zipline/src/hostTest/kotlin/app/cash/zipline/NoEvalTest.kt', '/Users/runner/work/zipline/zipline/zipline/src/hostTest/kotlin/app/cash/zipline/ManualCallEncodingTest.kt', '/Users/runner/work/zipline/zipline/zipline/src/hostTest/kotlin/app/cash/zipline/ExceptionsTest.kt', '/Users/runner/work/zipline/zipline/zipline/src/hostTest/kotlin/app/cash/zipline/SerializersTest.kt', '/Users/runner/work/zipline/zipline/zipline/src/hostTest/kotlin/app/cash/zipline/FinalizationRegistryTest.kt', '/Users/runner/work/zipline/zipline/zipline/src/hostTest/kotlin/app/cash/zipline/StateFlowTest.kt', '/Users/runner/work/zipline/zipline/zipline/src/hostTest/kotlin/app/cash/zipline/QuickJsInterruptTest.kt', '/Users/runner/work/zipline/zipline/zipline/src/hostTest/kotlin/app/cash/zipline/ZiplineScopedEndpointTest.kt', '/Users/runner/work/zipline/zipline/zipline/src/hostTest/kotlin/app/cash/zipline/StrictModeTest.kt' can be a part of only one module, but is listed as a source for both `androidInstrumentedTest` and `hostTest`, please check you -Xfragment-sources options.
👀 1
m
Copy code
-Xfragment-sources
Is there any doc about this?
I knew about sourceSets & compilations but now looks like there fragments & modules too 👀
e
(Digressing) Yeah there will be a new kotlin “project model” in the future. Would be build system agnostic and promises to support stuff like compiling independent modules that all have shared internal visibility among themselves, so you can develop modularized kotlin libs but still have internal members that are only seen by modules compiled in the same project…