aspect-build / aspect-cli

correct, fast, usable: choose three
https://aspect.build/cli
Apache License 2.0
84 stars 19 forks source link

[FR]: Support test and src directories with the Kotlin Gazelle plugin #702

Open MorganRoff-UnlikelyAI opened 3 months ago

MorganRoff-UnlikelyAI commented 3 months ago

What is the current behavior?

So let's caveat this right away that I may well have something misconfigured, but here is what I'm seeing:

I have some Kotlin code that I'm migrating to Bazel. This is still in a Maven-style set up right now, with code under both regular code under src/main/java, and tests under src/test/java.

I'm trying to run Aspect's Kotlin Gazelle plugin to set up BUILD files for this project, but I'm getting an error like this:

gazelle: Resolution Error: Import "my.package.here" from "SomeClass.kt" resolved to multiple targets (//my/lib/src/main/java/my/package/here, //my/lib/src/test/java/my/package/here) - this must be fixed using the "gazelle:resolve" directive

Describe the feature

Ideally I would want this to resolve in the same way that the Java extension handles it from bazel-contrib/rules_jvm. This allows for a test package to overlap with the main package, and automatically imports the main package where necessary.

Please let me know if this is actually supported, and I have just configured something incorrectly/am missing a Gazelle directive.