Skip to content

Can't install gazelle plugin with v0.34.0 #2057

@dougthor42

Description

@dougthor42

🐞 bug report

Affected Rule

  • git_override
  • bazel_dep
  • Gazelle

Is this a regression?

Yes.

0.34.0 has the issue. The previous release, 0.33.2, does not.

Commit a1d2e45 (#1993) is the first commit where the issue is present.

Description

We can't use rules_python_gazelle_plugin v0.34.0 from BCR. It errors with a message about an unknown go repo.

In a1d2e45e8bbc838197b4f1d130d72793a20541a4~1 and earlier, we could use git_override to select a specific commit of rules_python_gazelle_plugin by including the strip_prefix attribute (issue: bazelbuild/bazel#22076, PR: bazelbuild/bazel#22077, and released as part of bazel 7.2.0rc1)

After a1d2e45 (#1993), the git_override for rules_python_gazelle_plugin no longer works, throwing an error about go files missing.

Other note: commit e8dcfef (#1997) changed things slightly: now the pip dependencies are downloaded before the error appears. The error still appears though.

The issue is still present in 03854a2 (2024-07-10 21:28:25-0700).

🔬 Minimal Reproduction

  1. Make a MODULE.bazel file that installs rules_python and rules_python_gazelle_plugin version 0.33.1.
  2. Run `bazel build --nobuild //...
  3. Update the version of rules_python and rules_python_gazelle_plugin to 0.34.0
  4. Run `bazel build --nobuild //...
  5. See error.

You can also see the error with git_override:

Make a MODULE.bazel with the standard stuff and also include:

git_override(
    module_name = "rules_python",
    commit = "a1d2e45e8bbc838197b4f1d130d72793a20541a4~1",
    remote = "https://github.com/bazelbuild/rules_python",
)

git_override(
    module_name = "rules_python_gazelle_plugin",
    commit = "a1d2e45e8bbc838197b4f1d130d72793a20541a4~1",
    remote = "https://github.com/bazelbuild/rules_python",
    strip_prefix = "gazelle",
)

Run bazel build --nobuild //...

See that things work

Edit the git_overrides to remove the ~1:

     module_name = "rules_python",
-    commit = "a1d2e45e8bbc838197b4f1d130d72793a20541a4~1",
+    commit = "a1d2e45e8bbc838197b4f1d130d72793a20541a4",
     remote = "https://github.com/bazelbuild/rules_python",
 )
 
 git_override(
     module_name = "rules_python_gazelle_plugin",
-    commit = "a1d2e45e8bbc838197b4f1d130d72793a20541a4~1",
+    commit = "a1d2e45e8bbc838197b4f1d130d72793a20541a4",
     remote = "https://github.com/bazelbuild/rules_python",

Run bazel build --nobuild //...

See error.

🔥 Exception or Error

ERROR: no such package '@@[unknown repo 'com_github_bazelbuild_rules_go' requested from @@rules_python_gazelle_plugin~]//go/runfiles': The repository '@@[unknown repo 'com_github_bazelbuild_rules_go' requested from @@rules_python_gazelle_plugin~]' could not be resolved: No repository visible as '@com_github_bazelbuild_rules_go' from repository '@@rules_python_gazelle_plugin~'
ERROR: /usr/local/google/home/dthor/dev/pyle/BUILD.bazel:81:24: no such package '@@[unknown repo 'com_github_bazelbuild_rules_go' requested from @@rules_python_gazelle_plugin~]//go/runfiles': The repository '@@[unknown repo 'com_github_bazelbuild_rules_go' requested from @@rules_python_gazelle_plugin~]' could not be resolved: No repository visible as '@com_github_bazelbuild_rules_go' from repository '@@rules_python_gazelle_plugin~' and referenced by '//:gazelle_python_manifest.test'
ERROR: Analysis of target '//:gazelle_python_manifest.test' failed; build aborted: Analysis failed

🌍 Your Environment

Operating System:

gLinux (Debian)

Output of bazel version:

7.2.0rc1

Rules_python version:

Various -

Anything else relevant?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions