Closed dkashyn-sfdc closed 3 months ago
I'm not sure honestly. Maybe these targets could be just added to the libraries section in IntelliJ Project Structure? Would it be possible to prepare a minimal reproducible example?
This is part of our large project and generation is happening inside a macro. So I don't even have a good repro to share here :(
I need to introduce some Code generation to greetings_project
to even give you a repro.
Is there a way to do this now, @tpasternak ?
Maybe these targets could be just added to the libraries section in IntelliJ Project Structure
It might but I think it is expected to happen automatically. Are these targets included in your targets
section in the projecview file?
We not using targets and directories
is the only mechanism that we using.
Please note that we have hundreds of such "targets" so if we want to include all of those as part of .bazelproject
we need to use some wildcards, and even this might not be possible. I need to explore our graph more and probably rename some things to make it work.
@tpasternak you can find repro here https://github.com/bazelbuild/intellij/pull/6415/files. It probably not a wrong idea to add some code generation to sample project as well...
With
directories:
# Add the directories you want added as source here
# By default, we've added your entire workspace ('.')
greeting_lib
# Automatically includes all relevant targets under the 'directories' above
derive_targets_from_directories: true
targets:
# If source code isn't resolving, add additional targets that compile it here
additional_languages:
# Uncomment any additional languages you want supported
# android
# dart
# go
# javascript
# kotlin
# python
# scala
# typescript
With
directories:
# Add the directories you want added as source here
# By default, we've added your entire workspace ('.')
.
# Automatically includes all relevant targets under the 'directories' above
derive_targets_from_directories: true
targets:
# If source code isn't resolving, add additional targets that compile it here
additional_languages:
# Uncomment any additional languages you want supported
# android
# dart
# go
# javascript
# kotlin
# python
# scala
# typescript
With a dummy java class
Ok, to me it seems to be unrelated to the JarFilter logic. The generated library is correctly attached with the source jar, but the contents of the source jar doesn't match the contents of the jar. Doesn't it look like a bazel bug?
Reported to bazel https://github.com/bazelbuild/bazel/issues/22254
This issue is more nuanced and not only filtered-gen-src.jar
can be used as lib source.
_lib-src.jar
is used when package with generated module referred from some other module.
Description of the feature request:
We do have "resources"-only packages that generate Java code and then compile it as part of the build. Those packages are consumed by others, and sources/classes are certainly used downstream. Some of such modules have absolutely no
.java
sources present that results in missing-filtered-gen.jar
entries.Since there are no source artifacts generated for such packages, there is nothing in
.intellij-info.txt
after aspects pass, and IDE cannot navigate to legitimate sources.I suspect that https://github.com/bazelbuild/intellij/blame/86e31292434875ca1f86a02230cde5a3de5a70cf/aspect/intellij_info_impl.bzl#L794 should detect such cases to be able to generate required jars anyway here https://github.com/bazelbuild/intellij/blame/86e31292434875ca1f86a02230cde5a3de5a70cf/aspect/intellij_info_impl.bzl#L653
Which category does this issue belong to?
Intellij
What underlying problem are you trying to solve with this feature?
Navigation to the generated source code for non-standard targets without any
.java
sources.What operating system, Intellij IDE and programming languages are you using? Please provide specific versions.
Any
Have you found anything relevant by searching the web?
No response
Any other information, logs, or outputs that you want to share?
Before:
Then I've created a dummy class that was just an empty file
After running
Bazel Sync
next time I see