Open prodoelmit opened 5 months ago
There are numerous issues about adding support for srcjars: https://github.com/bazelbuild/intellij/pull/6261, https://github.com/bazelbuild/intellij/pull/5250, https://github.com/bazelbuild/intellij/pull/6286, https://github.com/bazelbuild/intellij/pull/5776
Well, I'll try to look into that tomorrow or next week. Please note that the PRs above target Query Sync https://github.com/bazelbuild/intellij/blob/master/docs/querysync.md
Reproduced. java_binary case triggers jar filtering and that's why it works
Well, this was one of the most surprising findings in this plugin. It seems that there is a threshold at which the plugins assumes a jar file is empty and therfore removes it from the project structure :O
To sum up - there are two different issues here. Fixes are on their way. In the meantime:
Workarounds:
bazel_binary
problem:
-Dblaze.experiment.blaze.empty.jar.threshold=0
-Dblaze.experiment.blaze.nonempty.jar.threshold=1
kt_jvm_library
issue
kt
and srcjar
sources in a single rule. Create separate kt_jvm_libraries for these
Description of the bug:
There is functionality that finds srcjars generated as part of bazel build and attaches them to project as dependency.
For me this feature does only work when srcjar contains
.java
files and is passed tojava_binary
rule as source Cases where srcjars are not picked up (but should):.java
files in srcjar, but srcjar is passed tojava_lib
.kt
files in srcjar, srcjar is passed tokt_jvm_library
as source, then library is passed tojava_binary
as runtime dep.kt
files in srcjar, srcjar is passed tokt_jvm_binary
as sourceExample where it works:
Example where it doesn't:
Which category does this issue belong to?
Intellij
What's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
Repo with reproduction: https://github.com/prodoelmit/bazel_example_generated_srcjar
Which Intellij IDE are you using? Please provide the specific version.
2023.3.5 Ultimate (#IU-233.14808.21)
What programming languages and tools are you using? Please provide specific versions.
Kotlin
What Bazel plugin version are you using?
7.0.0
Have you found anything relevant by searching the web?
There are numerous issues about adding support for srcjars: #6261, #5250, #6286, #5776
I've tried getting help in slack: https://bazelbuild.slack.com/archives/CHSV3RSR0/p1719696952077309 , also there are several threads about it: https://bazelbuild.slack.com/archives/CHSV3RSR0/p1592928891054900 , https://bazelbuild.slack.com/archives/CHSV3RSR0/p1571351050011200
Any other information, logs, or outputs that you want to share?
Everything's in reproduction repo