From 53ca5083a912e20358f5e1f1c995d347c8526c65 Mon Sep 17 00:00:00 2001 From: Cornelius Riemenschneider Date: Tue, 10 Dec 2024 11:47:45 +0100 Subject: [PATCH] Upgrade bazel to 8.0.0. Previously, we were using 8.0.0rc1. In particular, this upgrade means we need to explicitly import more rules, as they've been moved out of the core bazel repo. --- .bazelrc | 8 ++++++++ .bazelversion | 2 +- MODULE.bazel | 9 +++++---- csharp/scripts/BUILD.bazel | 2 ++ go/BUILD.bazel | 1 + java/kotlin-extractor/BUILD.bazel | 1 + misc/bazel/BUILD.bazel | 2 ++ misc/codegen/BUILD.bazel | 2 ++ misc/codegen/generators/BUILD.bazel | 2 ++ misc/codegen/lib/BUILD.bazel | 1 + misc/codegen/loaders/BUILD.bazel | 1 + misc/codegen/test/BUILD.bazel | 1 + misc/ripunzip/BUILD.bazel | 2 ++ python/extractor/BUILD.bazel | 1 + rust/codegen/BUILD.bazel | 1 + swift/extractor/BUILD.bazel | 1 + swift/logging/tests/assertion-diagnostics/BUILD.bazel | 1 + swift/ql/integration-tests/BUILD.bazel | 2 ++ swift/swift-autobuilder/tests/BUILD.bazel | 2 ++ swift/third_party/resource-dir/BUILD.bazel | 2 ++ swift/tools/BUILD.bazel | 1 + swift/tools/test/qltest/BUILD.bazel | 2 ++ 22 files changed, 42 insertions(+), 5 deletions(-) diff --git a/.bazelrc b/.bazelrc index 60455dd72c60..40beef6eecce 100644 --- a/.bazelrc +++ b/.bazelrc @@ -24,4 +24,12 @@ common --registry=https://bcr.bazel.build common --@rules_dotnet//dotnet/settings:strict_deps=false +# Reduce this eventually to empty, once we've fixed all our usages of java, and https://github.com/bazel-contrib/rules_go/issues/4193 is fixed +common --incompatible_autoload_externally="+@rules_java,+@rules_shell" + +build --java_language_version=17 +build --tool_java_language_version=17 +build --tool_java_runtime_version=remotejdk_17 +build --java_runtime_version=remotejdk_17 + try-import %workspace%/local.bazelrc diff --git a/.bazelversion b/.bazelversion index 5ce91d4d61c9..ae9a76b9249a 100644 --- a/.bazelversion +++ b/.bazelversion @@ -1 +1 @@ -8.0.0rc1 +8.0.0 diff --git a/MODULE.bazel b/MODULE.bazel index 08a4aaa78af9..d2ae279af602 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -15,16 +15,17 @@ local_path_override( # see https://registry.bazel.build/ for a list of available packages bazel_dep(name = "platforms", version = "0.0.10") -bazel_dep(name = "rules_go", version = "0.50.0") +bazel_dep(name = "rules_go", version = "0.50.1") bazel_dep(name = "rules_pkg", version = "1.0.1") bazel_dep(name = "rules_nodejs", version = "6.2.0-codeql.1") -bazel_dep(name = "rules_python", version = "0.36.0") +bazel_dep(name = "rules_python", version = "0.40.0") +bazel_dep(name = "rules_shell", version = "0.3.0") bazel_dep(name = "bazel_skylib", version = "1.7.1") -bazel_dep(name = "abseil-cpp", version = "20240116.0", repo_name = "absl") +bazel_dep(name = "abseil-cpp", version = "20240116.1", repo_name = "absl") bazel_dep(name = "nlohmann_json", version = "3.11.3", repo_name = "json") bazel_dep(name = "fmt", version = "10.0.0") bazel_dep(name = "rules_kotlin", version = "2.0.0-codeql.1") -bazel_dep(name = "gazelle", version = "0.38.0") +bazel_dep(name = "gazelle", version = "0.40.0") bazel_dep(name = "rules_dotnet", version = "0.17.4") bazel_dep(name = "googletest", version = "1.14.0.bcr.1") bazel_dep(name = "rules_rust", version = "0.52.2") diff --git a/csharp/scripts/BUILD.bazel b/csharp/scripts/BUILD.bazel index c4b44ac28ac4..8f4f239104e0 100644 --- a/csharp/scripts/BUILD.bazel +++ b/csharp/scripts/BUILD.bazel @@ -1,3 +1,5 @@ +load("@rules_python//python:defs.bzl", "py_binary") + py_binary( name = "gen-git-assembly-info", srcs = ["gen-git-assembly-info.py"], diff --git a/go/BUILD.bazel b/go/BUILD.bazel index 931f061da9ef..d73e7ba1a6fa 100644 --- a/go/BUILD.bazel +++ b/go/BUILD.bazel @@ -1,5 +1,6 @@ load("@gazelle//:def.bzl", "gazelle") load("@rules_pkg//pkg:mappings.bzl", "pkg_files") +load("@rules_python//python:defs.bzl", "py_binary") load("//misc/bazel:pkg.bzl", "codeql_pack", "codeql_pkg_files") gazelle( diff --git a/java/kotlin-extractor/BUILD.bazel b/java/kotlin-extractor/BUILD.bazel index f95661f8128c..575b9788e8c5 100644 --- a/java/kotlin-extractor/BUILD.bazel +++ b/java/kotlin-extractor/BUILD.bazel @@ -40,6 +40,7 @@ load( ) load("@rules_kotlin//kotlin:core.bzl", "kt_javac_options", "kt_kotlinc_options") load("@rules_kotlin//kotlin:jvm.bzl", "kt_jvm_library") +load("@rules_python//python:defs.bzl", "py_binary") package(default_visibility = ["//java/kotlin-extractor:__subpackages__"]) diff --git a/misc/bazel/BUILD.bazel b/misc/bazel/BUILD.bazel index c3670b75c94a..e00a6f7a64c7 100644 --- a/misc/bazel/BUILD.bazel +++ b/misc/bazel/BUILD.bazel @@ -1,3 +1,5 @@ +load("@rules_shell//shell:sh_library.bzl", "sh_library") + sh_library( name = "sh_runfiles", srcs = ["runfiles.sh"], diff --git a/misc/codegen/BUILD.bazel b/misc/codegen/BUILD.bazel index 52a5c0011345..c7b88de96b7d 100644 --- a/misc/codegen/BUILD.bazel +++ b/misc/codegen/BUILD.bazel @@ -1,3 +1,5 @@ +load("@rules_python//python:defs.bzl", "py_binary") + py_binary( name = "codegen", srcs = ["codegen.py"], diff --git a/misc/codegen/generators/BUILD.bazel b/misc/codegen/generators/BUILD.bazel index f731c42ce23a..df89a2ac507f 100644 --- a/misc/codegen/generators/BUILD.bazel +++ b/misc/codegen/generators/BUILD.bazel @@ -1,3 +1,5 @@ +load("@rules_python//python:defs.bzl", "py_library") + py_library( name = "generators", srcs = glob(["*.py"]), diff --git a/misc/codegen/lib/BUILD.bazel b/misc/codegen/lib/BUILD.bazel index 482d1ac178fa..a68840beca34 100644 --- a/misc/codegen/lib/BUILD.bazel +++ b/misc/codegen/lib/BUILD.bazel @@ -1,4 +1,5 @@ load("@codegen_deps//:requirements.bzl", "requirement") +load("@rules_python//python:defs.bzl", "py_library") py_library( name = "lib", diff --git a/misc/codegen/loaders/BUILD.bazel b/misc/codegen/loaders/BUILD.bazel index be07c6d884bc..7e7a5ec8acc4 100644 --- a/misc/codegen/loaders/BUILD.bazel +++ b/misc/codegen/loaders/BUILD.bazel @@ -1,4 +1,5 @@ load("@codegen_deps//:requirements.bzl", "requirement") +load("@rules_python//python:defs.bzl", "py_library") py_library( name = "loaders", diff --git a/misc/codegen/test/BUILD.bazel b/misc/codegen/test/BUILD.bazel index dde67283335d..d8c06175785d 100644 --- a/misc/codegen/test/BUILD.bazel +++ b/misc/codegen/test/BUILD.bazel @@ -1,4 +1,5 @@ load("@codegen_deps//:requirements.bzl", "requirement") +load("@rules_python//python:defs.bzl", "py_library", "py_test") py_library( name = "utils", diff --git a/misc/ripunzip/BUILD.bazel b/misc/ripunzip/BUILD.bazel index ea21e6b1c948..6575b692772b 100644 --- a/misc/ripunzip/BUILD.bazel +++ b/misc/ripunzip/BUILD.bazel @@ -1,3 +1,5 @@ +load("@rules_shell//shell:sh_binary.bzl", "sh_binary") + alias( name = "ripunzip", actual = select({"@platforms//os:" + os: "@ripunzip-" + os for os in ("linux", "windows", "macos")}), diff --git a/python/extractor/BUILD.bazel b/python/extractor/BUILD.bazel index eabaee519ea5..77025503fe65 100644 --- a/python/extractor/BUILD.bazel +++ b/python/extractor/BUILD.bazel @@ -1,3 +1,4 @@ +load("@rules_python//python:defs.bzl", "py_binary") load("//misc/bazel:pkg.bzl", "codeql_pkg_files", "strip_prefix") py_binary( diff --git a/rust/codegen/BUILD.bazel b/rust/codegen/BUILD.bazel index fbac3d04619f..37118ca8777a 100644 --- a/rust/codegen/BUILD.bazel +++ b/rust/codegen/BUILD.bazel @@ -1,4 +1,5 @@ load("@bazel_skylib//rules:native_binary.bzl", "native_binary") +load("@rules_shell//shell:sh_binary.bzl", "sh_binary") _args = [ "//rust/ast-generator", diff --git a/swift/extractor/BUILD.bazel b/swift/extractor/BUILD.bazel index 8290aec41216..342125c9d4fa 100644 --- a/swift/extractor/BUILD.bazel +++ b/swift/extractor/BUILD.bazel @@ -1,3 +1,4 @@ +load("@rules_shell//shell:sh_binary.bzl", "sh_binary") load("//misc/bazel:pkg.bzl", "codeql_pkg_runfiles") load("//swift:rules.bzl", "swift_cc_binary") diff --git a/swift/logging/tests/assertion-diagnostics/BUILD.bazel b/swift/logging/tests/assertion-diagnostics/BUILD.bazel index 86fbbbee7c7f..c01a91fafd49 100644 --- a/swift/logging/tests/assertion-diagnostics/BUILD.bazel +++ b/swift/logging/tests/assertion-diagnostics/BUILD.bazel @@ -1,3 +1,4 @@ +load("@rules_python//python:defs.bzl", "py_test") load("//swift:rules.bzl", "swift_cc_binary") swift_cc_binary( diff --git a/swift/ql/integration-tests/BUILD.bazel b/swift/ql/integration-tests/BUILD.bazel index 3c376593c4ab..352170c4cef4 100644 --- a/swift/ql/integration-tests/BUILD.bazel +++ b/swift/ql/integration-tests/BUILD.bazel @@ -1,3 +1,5 @@ +load("@rules_python//python:defs.bzl", "py_library") + py_library( name = "utils", srcs = [ diff --git a/swift/swift-autobuilder/tests/BUILD.bazel b/swift/swift-autobuilder/tests/BUILD.bazel index f9a2b8eb1781..507899cf445f 100644 --- a/swift/swift-autobuilder/tests/BUILD.bazel +++ b/swift/swift-autobuilder/tests/BUILD.bazel @@ -1,3 +1,5 @@ +load("@rules_python//python:defs.bzl", "py_test") + [ py_test( name = test_dir + "-test", diff --git a/swift/third_party/resource-dir/BUILD.bazel b/swift/third_party/resource-dir/BUILD.bazel index 9cea2efd0293..b48be643b698 100644 --- a/swift/third_party/resource-dir/BUILD.bazel +++ b/swift/third_party/resource-dir/BUILD.bazel @@ -1,3 +1,5 @@ +load("@rules_shell//shell:sh_binary.bzl", "sh_binary") + alias( name = "resource-dir", actual = select({"@platforms//os:" + os: "@swift-resource-dir-" + os for os in ("linux", "macos")}), diff --git a/swift/tools/BUILD.bazel b/swift/tools/BUILD.bazel index 777b96490685..0c59e2571e55 100644 --- a/swift/tools/BUILD.bazel +++ b/swift/tools/BUILD.bazel @@ -1,3 +1,4 @@ +load("@rules_shell//shell:sh_binary.bzl", "sh_binary") load("//misc/bazel:pkg.bzl", "codeql_pkg_files") sh_binary( diff --git a/swift/tools/test/qltest/BUILD.bazel b/swift/tools/test/qltest/BUILD.bazel index f16563eb21df..c8a9b80364d0 100644 --- a/swift/tools/test/qltest/BUILD.bazel +++ b/swift/tools/test/qltest/BUILD.bazel @@ -1,3 +1,5 @@ +load("@rules_python//python:defs.bzl", "py_library", "py_test") + py_library( name = "utils", srcs = ["utils.py"],