rules_kotlin icon indicating copy to clipboard operation
rules_kotlin copied to clipboard

Transitive dependencies of a `kt_jvm_library` are included on the classpath

Open alexjpwalker opened this issue 4 years ago • 1 comments

When we have 3 packages, :apple, :banana and :cherry, where :banana is in the deps of :apple and :cherry is in the deps of :banana, it's possible to use Kotlin functions defined in the :cherry package inside :apple:

# apple has access to the symbols defined in Cherry.kt, but should not have access
kt_jvm_library(
    name = "apple",
    srcs = "Apple.kt",
    deps = ["//:banana"]
)

kt_jvm_library(
    name = "banana",
    srcs = "Banana.kt",
    deps = ["//:cherry"]
)

kt_jvm_library(
    name = "cherry",
    srcs = "Cherry.kt",
)

This is not in line with how Bazel functions (e.g: this is not the case when using java_library instead of kt_jvm_library)

alexjpwalker avatar Nov 11 '21 17:11 alexjpwalker

We currently only support strict-deps in an experimental mode, and the author of that code is (sadly) passed-on, so we need to do quite a bit of work to make everything with strict deps work out, so we can limit compilation deps to only direct deps.

cgruber avatar Nov 12 '21 20:11 cgruber