intellij
intellij copied to clipboard
Auto Import Feature might cause conflicts with other build tools
Description of the bug:
Recently, we've introduced Auto Import feature in #3601. It works correctly but seems to be conflicting with other build tools. If you have more than one plugin that is able to import a project, bazel will always take precedence.
The root cause is that, the AutoImportProjectOpenProcessor's canOpenProject field is doing only a very brief check - only if there is a WORKSPACE file in the directory. On the other hand, it is marked as isStrongProjectInfoHolder, which means it will run even if there's an already existing .idea file. (according to docs https://github.com/JetBrains/intellij-community/blob/9e68e0f60c4e58083a7ca7cfc35514f5da8fb4e0/platform/platform-api/src/com/intellij/projectImport/ProjectOpenProcessor.kt#L40)
What's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
No response
Which Intellij IDE are you using? Please provide the specific version.
No response
What programming languages and tools are you using? Please provide specific versions.
No response
What Bazel plugin version are you using?
No response
Have you found anything relevant by searching the web?
No response
Any other information, logs, or outputs that you want to share?
No response
cc @liucijus @jastice
IMO it would be reasonable to create a settings checkbox that could set isStrongProjectInfoHolder then
I think isStrongProjectInfoHolder override should be removed as it does no make much sense in auto import, which should run last. I'll send a PR with the change.
Sorry, @liucijus, I haven't noticed your comment. How about keeping possibility to make it enforced via a checkbox? #3902
For me it is more pain than gain. I have a large monorepo with just one part of it migrated to bazel and I cannot open my .idea project because of bazel auto import. If I want to open the project as bazel project, I can open the .ijwb, right? And with WSL I am getting plugin error java.util.concurrent.ExecutionException: com.google.idea.blaze.base.command.info.BlazeInfoException: blaze info failed with exit code: 36 so for me it is a dead end and I have to disable the plugin to proceed with my development.
For me it is more pain than gain. I have a large monorepo with just one part of it migrated to bazel and I cannot open my .idea project because of bazel auto import. If I want to open the project as bazel project, I can open the .ijwb, right? And with WSL I am getting plugin error
java.util.concurrent.ExecutionException: com.google.idea.blaze.base.command.info.BlazeInfoException: blaze info failed with exit code: 36so for me it is a dead end and I have to disable the plugin to proceed with my development.
@tpasternak shall we merge #3900?
Hey @saxicek the auto import feature can be disabled by changing the bazel.auto.import.disabled registry key
https://github.com/bazelbuild/intellij/pull/3885/files
Closing the issue for now, please feel free to reopen