bazelbuild / intellij

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

Using plugin with bazel wrapper under tools/bazel (Android Studio) #6313

Closed AnDevi closed 1 month ago

AnDevi commented 8 months ago

Description of the bug:

I'm using this plugin with Android Studio 2023.3. (I also tried 2022.3 version) It works fine when I don't have a wrapper for bazel placed under path {workspace}/tools/bazel, but when I put wrapper under tools/bazel plugin fails during syncing the project. I got an error: Error:ERROR: Skipping 'Support/Google/AndroidStudio2023.2/plugins/aswb/aspect'

This wrapper is something that I really need in my setup of bazel. Is it possible to use wrapper to bazel alongside with this plugin ? Or I need to do something else to setup this correctly ?

Which category does this issue belong to?

No response

What's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.

Run simplest bazel project for android with wrapper under the path {workspace}/tools/bazel bazel is an bash script with content:

#!/usr/bin/env bash
$BAZEL_REAL $@

Which Intellij IDE are you using? Please provide the specific version.

Android Studio 2023.3

What programming languages and tools are you using? Please provide specific versions.

Bazel: 7.1.0, sdk: android-33, java, cpp

What Bazel plugin version are you using?

Bazel for Android Studio plugin: 2024.02.27-aswb.0.1-api-version-232

Have you found anything relevant by searching the web?

No response

Any other information, logs, or outputs that you want to share?

No response

mai93 commented 7 months ago

I was not able to reproduce the issue with the simple wrapper provided, did you specify the path to this wrapper in Settings -> Bazel Settings -> Bazel Binary Location?

AnDevi commented 7 months ago

Under the Settings -> Bazel Settings -> Bazel Binary Location I got set just bazel. When I set there path to this wrapper I tools/bazel I got different error:

Command: tools/bazel info --tool_tag=ijwb:AndroidStudio --curses=no --color=yes --progress_in_terminal_title=no --config=android --
tools/bazel: line 2: info: command not found

I think that is cuz when I run ./tools/bazel bazelisk is not setuping BAZEL_REAL variable, you need to use bazel binary to run that wrapper with BAZEL_REAL see I think.

I tried to change wrapper code to avoid lack of BAZEL_REAL:

#!/usr/bin/env bash
bazelisk $@ // can't use `bazel` in here cuz it'll cause infinite loop of recursive callings

but even with that I still got an error Error:Could not run Bazel info during syncing

mai93 commented 7 months ago

can you try running the wrapper from command line to make sure it is working?

Also you may need to specify the absolute path of the wrapper in the Bazel Binary Location setting.

AnDevi commented 7 months ago

When I use in my wrapper bazelisk $@ instead of $BAZEL_REAL $@ I can run it from cmd line :) Specifying absolute path gives me the same error in result : Error:Could not run Bazel info

github-actions[bot] commented 1 month 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. If you think this issue is still relevant and should stay open, please post any comment here and the issue will no longer be marked as stale.

github-actions[bot] commented 1 month ago

This issue has been automatically closed due to inactivity. If you're still interested in pursuing this, please post @bazelbuild/triage in a comment here and we'll take a look. Thanks!