Skip to content

Commit

Permalink
Bump rules_go & Bazel deps (#1973)
Browse files Browse the repository at this point in the history
**What type of PR is this?**

Deps

**What package or component does this PR mostly affect?**

all

**What does this PR do? Why is it needed?**

Bumping the compatibility SDK is needed due to changes to
`golang.org/x/tools` that require Go 1.19 (`types.Func.Origin()`) and,
temporarily, due to non-hermeticity in rules_go's
`GoToolchainBinaryBuild`.

**Which issues(s) does this PR fix?**

Fixes #

**Other notes for review**
  • Loading branch information
fmeum authored Nov 8, 2024
1 parent 3c129b3 commit bf8c993
Show file tree
Hide file tree
Showing 91 changed files with 2,684 additions and 1,835 deletions.
9 changes: 0 additions & 9 deletions .bazelci/presubmit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ tasks:
ubuntu2204:
name: Ubuntu 22.04 with WORKSPACE
platform: ubuntu2204
bazel: 7.1.1
build_flags:
- "--noexperimental_enable_bzlmod"
test_flags:
Expand All @@ -27,7 +26,6 @@ tasks:
ubuntu2204_bzlmod:
name: Ubuntu 22.04 with Bzlmod
platform: ubuntu2204
bazel: 7.1.1
build_targets:
- "..."
run_targets:
Expand Down Expand Up @@ -88,7 +86,6 @@ tasks:
macos_arm64_bzlmod:
name: Mac OS Arm 64 with Bzlmod
platform: macos_arm64
bazel: 7.1.1
build_targets:
- "..."
test_targets:
Expand All @@ -98,7 +95,6 @@ tasks:
macos_arm64:
name: Mac OS Arm 64 with WORKSPACE
platform: macos_arm64
bazel: 7.1.1
build_flags:
- "--noexperimental_enable_bzlmod"
test_flags:
Expand All @@ -113,7 +109,6 @@ tasks:
macos_bzlmod:
name: Mac OS with Bzlmod
platform: macos
bazel: 7.1.1
build_targets:
- "..."
test_targets:
Expand All @@ -123,7 +118,6 @@ tasks:
macos:
name: Mac OS with WORKSPACE
platform: macos
bazel: 7.1.1
build_flags:
- "--noexperimental_enable_bzlmod"
test_flags:
Expand All @@ -135,7 +129,6 @@ tasks:
windows_bzlmod:
name: Windows with Bzlmod
platform: windows
bazel: 7.1.1
build_targets:
- "--"
- "..."
Expand All @@ -159,7 +152,6 @@ tasks:
windows:
name: Windows with WORKSPACE
platform: windows
bazel: 7.1.1
build_flags:
- "--noexperimental_enable_bzlmod"
test_flags:
Expand All @@ -186,7 +178,6 @@ tasks:
incompatible:
name: Ubuntu 22.04 with WORKSPACE and --config=incompatible
platform: ubuntu2204
bazel: 7.1.1
build_flags:
- "--noexperimental_enable_bzlmod"
- "--config=incompatible"
Expand Down
2 changes: 1 addition & 1 deletion .bazelversion
Original file line number Diff line number Diff line change
@@ -1 +1 @@
7.2.1
7.x
4 changes: 2 additions & 2 deletions BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ gazelle_binary(
)

go_cross_binary(
name = "gazelle_local_go1.18",
sdk_version = "1.18",
name = "gazelle_local_go1.22",
sdk_version = "1.22",
target = ":gazelle_local",
)

Expand Down
4 changes: 2 additions & 2 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,10 @@ bazel_dep(name = "bazel_skylib_gazelle_plugin", version = "1.4.1", dev_dependenc
bazel_dep(name = "stardoc", version = "0.6.2", dev_dependency = True, repo_name = "io_bazel_stardoc")

go_sdk_dev = use_extension("@io_bazel_rules_go//go:extensions.bzl", "go_sdk", dev_dependency = True)
go_sdk_dev.download(version = "1.22.5")
go_sdk_dev.download(version = "1.23.3")

# Used by compatibility tests, keep as low as possible.
go_sdk_dev.download(version = "1.18.10")
go_sdk_dev.download(version = "1.22.9")

# Known to exist since it is instantiated by rules_go itself.
use_repo(
Expand Down
47 changes: 40 additions & 7 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

http_archive(
name = "io_bazel_rules_go",
sha256 = "80a98277ad1311dacd837f9b16db62887702e9f1d1c4c9f796d0121a46c8e184",
sha256 = "f4a9314518ca6acfa16cc4ab43b0b8ce1e4ea64b81c38d8a3772883f153346b8",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.46.0/rules_go-v0.46.0.zip",
"https://github.com/bazelbuild/rules_go/releases/download/v0.46.0/rules_go-v0.46.0.zip",
"https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.50.1/rules_go-v0.50.1.zip",
"https://github.com/bazelbuild/rules_go/releases/download/v0.50.1/rules_go-v0.50.1.zip",
],
)

Expand All @@ -34,24 +34,57 @@ load("@bazel_features//:deps.bzl", "bazel_features_deps")

bazel_features_deps()

load("@io_bazel_rules_go//go:deps.bzl", "go_download_sdk", "go_register_toolchains", "go_rules_dependencies")
load("@io_bazel_rules_go//go:deps.bzl", "go_download_sdk", "go_register_nogo", "go_register_toolchains", "go_rules_dependencies")

go_rules_dependencies()

go_register_toolchains(
go_register_toolchains(version = "1.23.3")

go_register_nogo(
excludes = [
# //cmd/gazelle:gazelle_lib has incomplete deps on purpose, which
# trips up nogo.
"@//cmd/gazelle:__pkg__",
],
nogo = "@bazel_gazelle//:nogo",
version = "1.22.5",
)

# Go 1.22 is needed since the non-hermeticity of GoToolchainBinaryBuild results in it downloading
# Go 1.23 on Windows to build the builder, which then messes up Go version build tag filtering.
# Go 1.21 is needed to support the toolchain directive in go.mod, which is non-hermetically read
# by GoToolchainBinaryBuild on Windows.
# Go 1.20 is needed so support nogo's use of token.File.FileStart.
# Go 1.19 is needed for recent versions of golang.org/x/tools.
# TODO: Fix rules_go and set this back to 1.19.
go_download_sdk(
name = "go_compat_sdk",
version = "1.18.10",
version = "1.22.9",
)

load("//:deps.bzl", "gazelle_dependencies")

gazelle_dependencies(go_sdk = "go_sdk")

# Needed by rules_go when using proto rules, but not provided by its deps macro.
http_archive(
name = "rules_proto",
sha256 = "6fb6767d1bef535310547e03247f7518b03487740c11b6c6adb7952033fe1295",
strip_prefix = "rules_proto-6.0.2",
url = "https://github.com/bazelbuild/rules_proto/releases/download/6.0.2/rules_proto-6.0.2.tar.gz",
)

load("@rules_proto//proto:repositories.bzl", "rules_proto_dependencies")

rules_proto_dependencies()

load("@rules_proto//proto:setup.bzl", "rules_proto_setup")

rules_proto_setup()

load("@rules_proto//proto:toolchains.bzl", "rules_proto_toolchains")

rules_proto_toolchains()

# For API doc generation
# This is a dev dependency, users should not need to install it
# so we declare it in the WORKSPACE
Expand Down
6 changes: 3 additions & 3 deletions cmd/fetch_repo/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ go_binary(
visibility = ["//visibility:public"],
)

# Verify that fetch_repo builds with Go 1.18.
# Verify that fetch_repo builds with Go 1.22.
go_cross_binary(
name = "fetch_repo_go1.18",
sdk_version = "1.18",
name = "fetch_repo_go1.22",
sdk_version = "1.22",
target = ":fetch_repo",
)

Expand Down
20 changes: 10 additions & 10 deletions deps.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -107,15 +107,15 @@ def gazelle_dependencies(
go_repository,
name = "com_github_bazelbuild_buildtools",
importpath = "github.com/bazelbuild/buildtools",
sum = "h1:/wpuwyWvp46gZfQCmbR+4SI5ne7IjRUM5lsXTzpAeWM=",
version = "v0.0.0-20240827154017-dd10159baa91",
sum = "h1:FGzENZi+SX9I7h9xvMtRA3rel8hCEfyzSixteBgn7MU=",
version = "v0.0.0-20240918101019-be1c24cc9a44",
)
_maybe(
go_repository,
name = "com_github_bazelbuild_rules_go",
importpath = "github.com/bazelbuild/rules_go",
sum = "h1:CTefzjN/D3Cdn3rkrM6qMWuQj59OBcuOjyIp3m4hZ7s=",
version = "v0.46.0",
sum = "h1:/BUvuaB8MEiUA2oLPPCGtuw5V+doAYyiGTFyoSWlkrw=",
version = "v0.50.1",
)
_maybe(
go_repository,
Expand All @@ -128,8 +128,8 @@ def gazelle_dependencies(
go_repository,
name = "com_github_fsnotify_fsnotify",
importpath = "github.com/fsnotify/fsnotify",
sum = "h1:8JEhPFa5W2WU7YfeZzPNqzMP6Lwt7L2715Ggo0nosvA=",
version = "v1.7.0",
sum = "h1:dAwr6QBTBZIkG8roQaJjGof0pp0EeF+tNV7YBP3F/8M=",
version = "v1.8.0",
)
_maybe(
go_repository,
Expand Down Expand Up @@ -205,8 +205,8 @@ def gazelle_dependencies(
go_repository,
name = "org_golang_x_mod",
importpath = "golang.org/x/mod",
sum = "h1:utOm6MM3R3dnawAiJgn0y+xvuYRsm1RKM/4giyfDgV0=",
version = "v0.20.0",
sum = "h1:vvrHzRwRfVKSiLrG+d4FMl/Qi4ukBCE6kZlTUkDYRT0=",
version = "v0.21.0",
)
_maybe(
go_repository,
Expand All @@ -226,8 +226,8 @@ def gazelle_dependencies(
go_repository,
name = "org_golang_x_sys",
importpath = "golang.org/x/sys",
sum = "h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34=",
version = "v0.25.0",
sum = "h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo=",
version = "v0.26.0",
)
_maybe(
go_repository,
Expand Down
12 changes: 6 additions & 6 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
module github.com/bazelbuild/bazel-gazelle

go 1.21.1
go 1.22

toolchain go1.22.7
toolchain go1.23.3

require (
github.com/bazelbuild/buildtools v0.0.0-20240827154017-dd10159baa91
github.com/bazelbuild/buildtools v0.0.0-20240918101019-be1c24cc9a44
github.com/bazelbuild/rules_go v0.50.1
github.com/bmatcuk/doublestar/v4 v4.7.1
github.com/fsnotify/fsnotify v1.7.0
github.com/fsnotify/fsnotify v1.8.0
github.com/google/go-cmp v0.6.0
github.com/pmezard/go-difflib v1.0.0
golang.org/x/mod v0.20.0
golang.org/x/mod v0.21.0
golang.org/x/sync v0.8.0
golang.org/x/tools/go/vcs v0.1.0-deprecated
)

require golang.org/x/sys v0.25.0 // indirect
require golang.org/x/sys v0.26.0 // indirect
16 changes: 8 additions & 8 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
github.com/bazelbuild/buildtools v0.0.0-20240827154017-dd10159baa91 h1:/wpuwyWvp46gZfQCmbR+4SI5ne7IjRUM5lsXTzpAeWM=
github.com/bazelbuild/buildtools v0.0.0-20240827154017-dd10159baa91/go.mod h1:PLNUetjLa77TCCziPsz0EI8a6CUxgC+1jgmWv0H25tg=
github.com/bazelbuild/buildtools v0.0.0-20240918101019-be1c24cc9a44 h1:FGzENZi+SX9I7h9xvMtRA3rel8hCEfyzSixteBgn7MU=
github.com/bazelbuild/buildtools v0.0.0-20240918101019-be1c24cc9a44/go.mod h1:PLNUetjLa77TCCziPsz0EI8a6CUxgC+1jgmWv0H25tg=
github.com/bazelbuild/rules_go v0.50.1 h1:/BUvuaB8MEiUA2oLPPCGtuw5V+doAYyiGTFyoSWlkrw=
github.com/bazelbuild/rules_go v0.50.1/go.mod h1:Dhcz716Kqg1RHNWos+N6MlXNkjNP2EwZQ0LukRKJfMs=
github.com/bmatcuk/doublestar/v4 v4.7.1 h1:fdDeAqgT47acgwd9bd9HxJRDmc9UAmPpc+2m0CXv75Q=
github.com/bmatcuk/doublestar/v4 v4.7.1/go.mod h1:xBQ8jztBU6kakFMg+8WGxn0c6z1fTSPVIjEY1Wr7jzc=
github.com/fsnotify/fsnotify v1.7.0 h1:8JEhPFa5W2WU7YfeZzPNqzMP6Lwt7L2715Ggo0nosvA=
github.com/fsnotify/fsnotify v1.7.0/go.mod h1:40Bi/Hjc2AVfZrqy+aj+yEI+/bRxZnMJyTJwOpGvigM=
github.com/fsnotify/fsnotify v1.8.0 h1:dAwr6QBTBZIkG8roQaJjGof0pp0EeF+tNV7YBP3F/8M=
github.com/fsnotify/fsnotify v1.8.0/go.mod h1:8jBTzvmWwFyi3Pb8djgCCO5IBqzKJ/Jwo8TRcHyHii0=
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
golang.org/x/mod v0.20.0 h1:utOm6MM3R3dnawAiJgn0y+xvuYRsm1RKM/4giyfDgV0=
golang.org/x/mod v0.20.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
golang.org/x/mod v0.21.0 h1:vvrHzRwRfVKSiLrG+d4FMl/Qi4ukBCE6kZlTUkDYRT0=
golang.org/x/mod v0.21.0/go.mod h1:6SkKJ3Xj0I0BrPOZoBy3bdMptDDU9oJrpohJ3eWZ1fY=
golang.org/x/sync v0.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ=
golang.org/x/sync v0.8.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34=
golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo=
golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/tools/go/vcs v0.1.0-deprecated h1:cOIJqWBl99H1dH5LWizPa+0ImeeJq3t3cJjaeOWUAL4=
golang.org/x/tools/go/vcs v0.1.0-deprecated/go.mod h1:zUrvATBAvEI9535oC0yWYsLsHIV4Z7g63sNPVMtuBy8=
Loading

0 comments on commit bf8c993

Please sign in to comment.