Lukasz Kalnik
12/28/2021, 10:21 PMarrow-core-retrofit module. I added a dependency on io.kotest.extensions:kotest-assertions-arrow but when I try to use the shouldBeRight assertion the test doesn't compile with the error "Cannot access class 'arrow.core.Either'. Check your module classpath for missing or conflicting dependencies"simon.vergauwen
01/03/2022, 8:27 AMapi("arrow-core") but on implementation("arrow-core") which results in the dependency not being available in the resulting jar.simon.vergauwen
01/03/2022, 10:53 AMcompileOnly is even more restrictive compared to implementation. So itās missing the jar at runtime.
We should put more love in the kotest arrow integrations though. Iād love to move everything we have in the Arrow repo in the test modules to be moved to Kotest Extensions.
cc\\ @Imran/Malicsimon.vergauwen
01/03/2022, 10:55 AMImran/Malic
01/03/2022, 11:00 AMimplementation("arrow-core") , bc they end up having it in the classpath anyways. Unless api("arrow-core") prevents those dependency conflicts I havenāt tested itsimon.vergauwen
01/03/2022, 11:03 AMImran/Malic
01/03/2022, 11:04 AMsimon.vergauwen
01/03/2022, 11:16 AMLukasz Kalnik
01/03/2022, 1:44 PMarrow-core-retrofit has a dependency compileOnly(projects.arrowCore).
Would the best solution be to add testImplementation(projects.arrowCore)?
I assume we should not just change compileOnly to implementation as then the implementers could have the same problem with different arrow-core versions in their projects?Lukasz Kalnik
01/03/2022, 1:46 PMarrow-core-retrofit you need a dependency on arrow-core as well". Is there no better solution in Gradle for this?simon.vergauwen
01/03/2022, 1:56 PMapi(projects.arrowCore) instead of compileOnly(projects.arrowCore).
That should fix the issue I believe, and will instruct Gradle/Maven to download arrow-core as a transitive dependency from arrow-core-retrofit.
Itās a great PR! Thanks a lot @Lukasz Kalnik. This was a much needed improvement. I will try to make some time asap to review properlyLukasz Kalnik
01/03/2022, 1:57 PMLukasz Kalnik
01/03/2022, 2:03 PMcompileOnly should actually not be used apart from some very rare cases:
https://discuss.gradle.org/t/is-it-recommended-to-use-compileonly-over-implementation-if-another-module-use-implementation-already/26699Imran/Malic
01/03/2022, 2:10 PMLukasz Kalnik
01/03/2022, 3:00 PMarrow-retrofit-core the following dependencies:
testImplementation(projects.arrowCore)
testImplementation("io.kotest.extensions:kotest-assertions-arrow:1.2.1")
and the tests pass, the build also passes, but there is still the same error shown in the IDE...Lukasz Kalnik
01/03/2022, 3:00 PMCannot access class 'arrow.core.Either'. Check your module classpath for missing or conflicting dependencies
Lukasz Kalnik
01/03/2022, 3:04 PMprojects.arrowCore to implementation (instead of compileOnly and testImplementation)simon.vergauwen
01/03/2022, 3:05 PMdependencies {
api(libs.kotlin.stdlibJDK8)
api(projects.arrowCore)
api(libs.squareup.retrofit)
testCompileOnly(libs.kotlin.reflect)
testRuntimeOnly(libs.kotest.runnerJUnit5)
testImplementation(projects.arrowCoreTest)
testImplementation(libs.squareup.retrofitConverterGson)
testImplementation(libs.squareup.okhttpMockWebServer)
}
cc\\ @Imran/Malic on KMM is should actually be more strict than on the JVM. Thatās probably also the reason you still see the error in IDEA, because IDEA might be detecting āsomething weirdā in terms of the dependency configuration. We should probably do a sweep over all the libraries though.
I removed most compileOnly for KMM already, but since this is a JVM module I mightāve missed it.
For example, here we donāt have to expose Kotlin Std as API since itās already exposed through arrow-core as api.
So relying on arrow-core as api makes Kotlin Std a transitive api dependency.
But since we expose here JDK8 as api, we should still expose it as api I think since std-common is s subset of std-JDK8.Lukasz Kalnik
01/03/2022, 3:57 PMLukasz Kalnik
01/03/2022, 3:58 PMsimon.vergauwen
01/03/2022, 4:01 PMLukasz Kalnik
01/03/2022, 4:03 PMLukasz Kalnik
01/03/2022, 4:05 PMsimon.vergauwen
01/03/2022, 4:08 PMsimon.vergauwen
01/03/2022, 4:08 PM