bazelbuild / intellij

IntelliJ plugin for Bazel projects
https://ij.bazel.build/
Apache License 2.0
760 stars 303 forks source link

Latest bazel plugin breaks on any C++ project that uses old (prior 6.4.0) bazel #6474

Closed erinacio closed 3 months ago

erinacio commented 3 months ago

Description of the bug:

Syncing any project with bazel <=6.3.2 will fail with:

ERROR: Traceback (most recent call last):
    File "<redacted>/external/intellij_aspect/intellij_info_impl_bundled.bzl", line 3, column 37, in <toplevel>
        load("@rules_java//java:defs.bzl", "JavaInfo", "java_common")
Error: file '@rules_java//java:defs.bzl' does not contain symbol 'JavaInfo'
ERROR: at <redacted>/external/intellij_aspect/intellij_info_bundled.bzl:4:5: initialization of module 'intellij_info_impl_bundled.bzl' failed

Which category does this issue belong to?

CLion

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

Just create a minimal Bazel C++ project and sync, using bazel 6.3.2 or earlier version.

# WORKSPACE
workspace(name = "bzlexp")
# BUILD.bazel
cc_binary(
    name = "main",
    srcs = ["main.cc"],
)
// main.cc
int main() { return 0; }

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

CLion 2024.1.2

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

Not related

What Bazel plugin version are you using?

2024.05.21.0.1-api-version-241

Have you found anything relevant by searching the web?

https://github.com/bazelbuild/intellij/issues/6430 is closed because claimed that the bug is fixed, which is not.

Someone noticed about upgrading rules_java in that issue, but how can one upgrade rules_java that is just not imported?

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

No.

lumpidu commented 3 months ago

This also happens on my Mac with bazel 7.1.2

tpasternak commented 3 months ago

Thank you for reporting this, we are aware of the problem, work in progress

LeFrosch commented 3 months ago

In the meantime you can try adding this to your WORKSPACE file as a workaround:

http_archive(
    name = "rules_java",
    urls = [
        "https://github.com/bazelbuild/rules_java/releases/download/7.6.1/rules_java-7.6.1.tar.gz",
    ],
    sha256 = "f8ae9ed3887df02f40de9f4f7ac3873e6dd7a471f9cddf63952538b94b59aeb3",
)
tpasternak commented 3 months ago

Yeah so the current way to fix this is either to upgrade bazel or directly reference new rules_java. Bazel 6.3.2 contains rules_java v5.5.0 which we don't support now

tpasternak commented 3 months ago

We should of course drop obligatory dependency on rules_java at all, but this is not going to happen in a few days

LeFrosch commented 3 months ago

Should be fixed by #6476