bazelbuild / intellij

IntelliJ plugin for Bazel projects
https://github.com/bazelbuild/intellij/blob/master/docs/index.md
Apache License 2.0
764 stars 308 forks source link

Bazel sync changing the handler for RunConfiguration #2258

Open willingham opened 3 years ago

willingham commented 3 years ago

Description of the issue. Please be specific.

Hi, I've got a RunConfiguration set with a blaze handler of BlazeJavaRunConfigurationHandlerProvider however, each time the bazel plugin syncs, it changes that to BlazeCommandGenericRunConfigurationHandlerProvider. Why is this happening, and what can I do to prevent it?

What's the simplest set of steps to reproduce this issue? Please provide an example project, if possible.

Create a RunConfiguration with BlazeJavaRunConfigurationHandlerProvider set as the handler then make sure intellij sees the RunConfiguration, then run a bazel sync.

Version information

IdeaUltimate: 2020.2.4 Platform: Mac OS X 10.15.7 Bazel plugin: 2020.12.01.0.1 Bazel: 3.7.0

marcelluiz96 commented 2 years ago

Bumping. This is still an issue on the latest beta channel of Bazel + latest version of IntelliJ

BlazeJavaRunConfigurationHandlerProvider becomes BlazeCommandGenericRunConfigurationHandlerProvider on sync

github-actions[bot] commented 1 year ago

Thank you for contributing to the IntelliJ repository! This issue has been marked as stale since it has not had any activity in the last 6 months. It will be closed in the next 14 days unless any other activity occurs or one of the following labels is added: "not stale", "awaiting-maintainer". Please reach out to the triage team (@bazelbuild/triage) if you think this issue is still relevant or you are interested in getting the issue resolved.

github-actions[bot] commented 1 year ago

This issue has been automatically closed due to inactivity. If you're still interested in pursuing this, please reach out to the triage team (@bazelbuild/triage). Thanks!

kusaeva commented 5 months ago

This issue is still actual:

Version information

IdeaCommunity: 2024.1.1 Platform: Mac OS X 12.7.3 Bazel for IntelliJ plugin: 2024.06.04.0.2-api-version-241 Bazel: 7.2.0

jrobotham-square commented 2 weeks ago

I've got a bit more specifics around this one that may help. (I'm hoping this is the same problem that we are seeing) The problem appears to be the related to the tags = ["manual"] against a java binary, eg:

java_binary(
    name = "HelloWorld",
    srcs = ["HelloWorld.java"],
    tags = ["manual"],
    main_class = "com.example.HelloWorld",
)

When the launch target is committed into a repository, this is problematic because as the .bazelproject is user-specific, any user that does not have allow_manual_targets_sync: true in their .bazelproject is at risk of a sync changing the launch target silently and then them accidentally committing it.

I'm actually struggling to see a scenario where you would not want allow_manual_targets_sync: true, is one possible fix to make that the default behaviour instead of a configurable option?

mwilsonb2c2 commented 1 week ago

This is definitely still an issue for us. At least I think it is the same issue, because for us, it happens in both ways. We have some run configs that switch from BlazeJavaRunConfigurationHandlerProvider to BlazeCommandGenericRunConfigurationHandlerProvider

but we also have some run configs switch the other way, from BlazeCommandGenericRunConfigurationHandlerProvider to BlazeJavaRunConfigurationHandlerProvider.

And it completely depends on the state of the project. I can accept the changes and commit them to the repo, and it'll remain unchanged as long as no-one touches anything. But as soon as something changes (haven't worked out if there is a pattern here, perhaps it is someone adding a new run config) we get different run configs randomly changing.

I don't think it matters what version you're on that this point, the problem is obviously a long running systemic issue.

IntelliJ IDEA 2024.2.4 (Ultimate Edition) Platform: Mac OS Version 14.5 (23F79) Bazel for IntelliJ plugin: 2024.07.16.0.1-api-version-242 Bazel: 7.4.1