metalbear-co / mirrord-intellij

Connect your local process and your cloud environment, and run local code in cloud conditions.
https://mirrord.dev
MIT License
11 stars 10 forks source link

Add IntelliJ plugin support for Bazel for IntelliJ #207

Open wdfinch opened 1 year ago

wdfinch commented 1 year ago

I use Bazel as my build tool, specifically the Bazel for IntelliJ plugin. When I create a run configuration and run my application with bazel run with the mirrord plugin enabled, it runs the application normally and does not connect to my remote pod. Is it possible to use the bazel plugin with the mirrord plugin? If not, could this integration be added?

aviramha commented 1 year ago

Thanks for the suggestion. We can probably look into it in the future, meanwhile I can suggest maybe a good workaround would be to script your Bazel configuration to have a mirrord exec option, which would execute the program with mirrord. I am not knowledgable with Bazel, but I know some users have done that.

wdfinch commented 1 year ago

Thanks for the reply. That's what I currently do. The run configuration is nice since I can run the app directly in debug mode. Right now, I run the script Bazel generates with the debug flag and attach a remote debugger to it, which is some extra work each time I want to debug the app.

aviramha commented 3 months ago

Probably possible via https://github.com/bazelbuild/intellij/blob/f61108579395573187232135d23e20f176fd26b9/base/tests/utils/unit/com/google/idea/blaze/base/run/MockBlazeCommandRunConfigurationHandlerProvider.java#L36

pankaj819kumar commented 3 months ago

Hi @aviramha When are you prioritizing mirrord compatibility for Bazel run configuration?

aviramha commented 2 months ago

We found out that Bazel run + Go binary works, but Java doesn't

aviramha commented 2 months ago

Reproduces with https://github.com/bazelbuild/bazel/blob/master/site/en/start/java.md Seems that the Bazel plugin uses "Go Handler" which just uses the standard "GoRun" configuration of intellij, whereas for "Java Handler" it does its own magic, not calling the thing extended by mirrord. Perhaps #230 is relevant here as well