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 60455dd72c6..40beef6eecc 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 5ce91d4d61c..ae9a76b9249 100644 --- a/.bazelversion +++ b/.bazelversion @@ -1 +1 @@ -8.0.0rc1 +8.0.0 diff --git a/MODULE.bazel b/MODULE.bazel index 08a4aaa78af..d2ae279af60 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 c4b44ac28ac..8f4f239104e 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 931f061da9e..d73e7ba1a6f 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 f95661f8128..575b9788e8c 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 c3670b75c94..e00a6f7a64c 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 52a5c001134..c7b88de96b7 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 f731c42ce23..df89a2ac507 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 482d1ac178f..a68840beca3 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 be07c6d884b..7e7a5ec8acc 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 dde67283335..d8c06175785 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 ea21e6b1c94..6575b692772 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 eabaee519ea..77025503fe6 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 fbac3d04619..37118ca8777 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 8290aec4121..342125c9d4f 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 86fbbbee7c7..c01a91fafd4 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 3c376593c4a..352170c4cef 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 f9a2b8eb178..507899cf445 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 9cea2efd029..b48be643b69 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 777b9649068..0c59e2571e5 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 f16563eb21d..c8a9b80364d 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"],