Skip to content

Commit

Permalink
Pin the gazelle version
Browse files Browse the repository at this point in the history
rules_docker depends on an old gazelle, which depends on an old
rules_go, which is not bazel 7 compatible

bazel-contrib/rules_go#3361 (comment)

So we make the gazelle dependency explicit on a newer version
  • Loading branch information
HoloRin committed Mar 21, 2024
1 parent 668c5c4 commit b56b190
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 28 deletions.
20 changes: 0 additions & 20 deletions BAZEL.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,26 +71,6 @@ Note: This takes quite some time on a single machine.

`bazel test //deps/rabbit:lazy_queue_SUITE`

## Add/update an external dependency

### from hex.pm

1. `bazel run gazelle-update-repos -- hex.pm/[email protected]` to generate/update `bazel/BUILD.accept`
1. Add/update the entry in MODULE.bazel

### from github

1. `bazel run gazelle-update-repos -- --testonly github.com/extend/ct_helper@master`
1. Add/update the entry in MODULE.bazel

## Update BUILD files

`bazel run gazelle`

## Regenerate moduleindex.yaml

`bazel run :moduleindex > moduleindex.yaml`

## Additional Useful Commands

- Format all bazel files consistently (requires [buildifier](https://github.com/bazelbuild/buildtools/blob/master/buildifier/README.md)):
Expand Down
10 changes: 10 additions & 0 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,16 @@ bazel_dep(
name = "rules_cc",
version = "0.0.9",
)
bazel_dep(
name = "rules_go",
version = "0.44.2",
repo_name = "io_bazel_rules_go",
)
bazel_dep(
name = "gazelle",
version = "0.35.0",
repo_name = "bazel_gazelle",
)
bazel_dep(
name = "rules_erlang",
version = "3.15.0",
Expand Down
50 changes: 42 additions & 8 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,39 @@ load("@rules_pkg//:deps.bzl", "rules_pkg_dependencies")

rules_pkg_dependencies()

git_repository(
name = "rules_erlang",
remote = "https://github.com/rabbitmq/rules_erlang.git",
tag = "3.15.0",
http_archive(
name = "io_bazel_rules_go",
integrity = "sha256-fHbWI2so/2laoozzX5XeMXqUcv0fsUrHl8m/aE8Js3w=",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.44.2/rules_go-v0.44.2.zip",
"https://github.com/bazelbuild/rules_go/releases/download/v0.44.2/rules_go-v0.44.2.zip",
],
)

load("@rules_erlang//:internal_deps.bzl", "rules_erlang_internal_deps")
http_archive(
name = "bazel_gazelle",
integrity = "sha256-MpOL2hbmcABjA1R5Bj2dJMYO2o15/Uc5Vj9Q0zHLMgk=",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/bazel-gazelle/releases/download/v0.35.0/bazel-gazelle-v0.35.0.tar.gz",
"https://github.com/bazelbuild/bazel-gazelle/releases/download/v0.35.0/bazel-gazelle-v0.35.0.tar.gz",
],
)

rules_erlang_internal_deps()

load("@rules_erlang//:internal_setup.bzl", "rules_erlang_internal_setup")
load("@io_bazel_rules_go//go:deps.bzl", "go_register_toolchains", "go_rules_dependencies")
load("@bazel_gazelle//:deps.bzl", "gazelle_dependencies", "go_repository")

rules_erlang_internal_setup()
############################################################
# Define your own dependencies here using go_repository.
# Else, dependencies declared by rules_go/gazelle will be used.
# The first declaration of an external repository "wins".
############################################################

go_rules_dependencies()

go_register_toolchains(version = "1.20.5")

gazelle_dependencies()

http_archive(
name = "io_bazel_rules_docker",
Expand Down Expand Up @@ -59,6 +79,20 @@ container_pull(
tag = "20.04",
)

git_repository(
name = "rules_erlang",
remote = "https://github.com/rabbitmq/rules_erlang.git",
tag = "3.15.0",
)

load("@rules_erlang//:internal_deps.bzl", "rules_erlang_internal_deps")

rules_erlang_internal_deps()

load("@rules_erlang//:internal_setup.bzl", "rules_erlang_internal_setup")

rules_erlang_internal_setup()

http_file(
name = "openssl-3.1.4",
downloaded_file_path = "openssl-3.1.4.tar.gz",
Expand Down

0 comments on commit b56b190

Please sign in to comment.