From 5200a61dbf7f566586b027b7c5cc36a4bced3bfc Mon Sep 17 00:00:00 2001 From: Fabian Meumertzheim Date: Thu, 14 Nov 2024 21:31:18 +0100 Subject: [PATCH] Raise minimum Bazel version to 6.5.0 (#4171) Many other rulesets (such as rules_java and protobuf) have dropped support for Bazel 5. We also drop support for Bzlmod with Bazel 6 due to rules_jvm_external doing so. This should unblock https://github.com/bazel-contrib/rules_go/pull/4141. Also remove unnecessary CI exclusions. --- .bazelci/presubmit.yml | 239 +++++----------------------------------- .bazelversion | 1 + README.rst | 2 +- go/private/common.bzl | 2 +- tests/bcr/.bazelversion | 2 +- 5 files changed, 32 insertions(+), 214 deletions(-) create mode 100644 .bazelversion diff --git a/.bazelci/presubmit.yml b/.bazelci/presubmit.yml index 0bbff25c72..9b6b903df5 100644 --- a/.bazelci/presubmit.yml +++ b/.bazelci/presubmit.yml @@ -7,28 +7,20 @@ matrix: - windows tasks: - ubuntu1804_bazel400: + ubuntu1804_bazel6: platform: ubuntu1804 - bazel: 5.4.0 # test minimum supported version of bazel + bazel: 6.5.0 # test minimum supported version of bazel build_targets: - "//..." - - "--" - - "-//tests/core/cross:darwin_go_cross_cgo" # Doesn't work before bazel 6 - - "-//tests/core/cross:linux_go_cross_cgo" # Doesn't work before bazel 6 - - "-//tests/core/cross:windows_go_cross_cgo" # Doesn't work before bazel 6 - - "-//tests/core/starlark/cgo/..." # Doesn't work before bazel 6 test_targets: - "//..." - - "-//tests/core/cross:darwin_go_cross_cgo" # Doesn't work before bazel 6 - - "-//tests/core/cross:linux_go_cross_cgo" # Doesn't work before bazel 6 - - "-//tests/core/cross:windows_go_cross_cgo" # Doesn't work before bazel 6 - - "-//tests/core/starlark/cgo/..." # Doesn't work before bazel 6 - # Bzlmod tests require Bazel 6+ - - "-//tests/core/nogo/bzlmod/..." - # Nogo includes/excludes doesn't work before bazel 6 + # Nogo includes/excludes doesn't work before bazel 7 - "-//tests/core/nogo/includes_excludes:includes_exclude_test" + - "-//tests/core/nogo/bzlmod:includes_exclude_test" # _repo_mapping is missing - "-//tests/runfiles:runfiles_test" + # TODO: Investigate why this fails. + - "-//tests/core/starlark/cgo:missing_cc_toolchain_explicit_pure_off_test" ubuntu2004: # enable some unflipped incompatible flags on this platform to ensure we don't regress. build_flags: @@ -37,10 +29,6 @@ tasks: - "--config=incompatible" build_targets: - "//..." - - "--" - - "-//tests/core/cross:darwin_go_cross_cgo" # Doesn't work before bazel 6 - - "-//tests/core/cross:linux_go_cross_cgo" # Doesn't work before bazel 6 - - "-//tests/core/cross:windows_go_cross_cgo" # Doesn't work before bazel 6 test_targets: - "//..." debian11_zig_cc: @@ -72,7 +60,6 @@ tasks: bcr_tests_proto: name: BCR test module (--incompatible_enable_proto_toolchain_resolution) platform: ${{ platform }} - bazel: 7.1.1 working_directory: tests/bcr build_flags: - "--allow_yanked_versions=all" @@ -93,9 +80,6 @@ tasks: build_targets: - "//..." - "--" - - "-//tests/core/cross:darwin_go_cross_cgo" # Doesn't work before bazel 6 - - "-//tests/core/cross:linux_go_cross_cgo" # Doesn't work before bazel 6 - - "-//tests/core/cross:windows_go_cross_cgo" # Doesn't work before bazel 6 test_flags: - "--apple_crosstool_top=@local_config_apple_cc//:toolchain" - "--crosstool_top=@local_config_apple_cc//:toolchain" @@ -105,10 +89,6 @@ tasks: rbe_ubuntu1604: build_targets: - "//..." - - "--" - - "-//tests/core/cross:darwin_go_cross_cgo" # Doesn't work before bazel 6 - - "-//tests/core/cross:linux_go_cross_cgo" # Doesn't work before bazel 6 - - "-//tests/core/cross:windows_go_cross_cgo" # Doesn't work before bazel 6 test_flags: # Some tests depend on this feature being disabled. However, because it's # enabled by default in the rbe_ubuntu1604 platform, we cannot simply remove @@ -128,157 +108,22 @@ tasks: build_flags: - '--action_env=PATH=C:\tools\msys64\usr\bin;C:\tools\msys64\bin;C:\tools\msys64\mingw64\bin;C:\python3\Scripts\;C:\python3;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Windows\System32\OpenSSH;C:\ProgramData\GooGet;C:\Program Files\Google\Compute Engine\metadata_scripts;C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\bin;C:\Program Files\Google\Compute Engine\sysprep;C:\ProgramData\chocolatey\bin;C:\Program Files\Git\cmd;C:\tools\msys64\usr\bin;c:\openjdk\bin;C:\Program Files (x86)\Windows Kits\8.1\Windows Performance Toolkit\;C:\Program Files\CMake\bin;c:\ninja;c:\bazel;c:\buildkite' build_targets: - # BUG(bazelbuild/bazel#6485): Bazel 0.18.0 crashes when loading - # @com_google_protobuf//:protobuf. We have to exclude everything that - # transitively depends on it. - # TODO(#1787): There is a cc_import target in //tests/core/cgo that - # doesn't set the interface_library attribute. This causes an - # analysis failure. - # TODO(#1790): Tests that require data should use bazel.Runfile. - # TODO(#2516): Tests that require protoc fail when protoc is built with mingw-gcc. - - "--" - "//..." - - "-@com_github_golang_protobuf//ptypes:go_default_library_gen" - - "-@com_google_protobuf//:any_proto" - - "-@com_google_protobuf//:api_proto" - - "-@com_google_protobuf//:compiler_plugin_proto" - - "-@com_google_protobuf//:descriptor_proto" - - "-@com_google_protobuf//:duration_proto" - - "-@com_google_protobuf//:empty_proto" - - "-@com_google_protobuf//:field_mask_proto" - - "-@com_google_protobuf//:protobuf" - - "-@com_google_protobuf//:protoc" - - "-@com_google_protobuf//:protoc_lib" - - "-@com_google_protobuf//:source_context_proto" - - "-@com_google_protobuf//:struct_proto" - - "-@com_google_protobuf//:timestamp_proto" - - "-@com_google_protobuf//:type_proto" - - "-@com_google_protobuf//:wrappers_proto" - - "-@gogo_special_proto//github.com/gogo/protobuf/gogoproto:gogoproto" - - "-//go/tools/bazel:bazel_test" - - "-@io_bazel_rules_go//proto:gogofaster_proto" - - "-@io_bazel_rules_go//proto:go_grpc" - - "-@io_bazel_rules_go//proto:go_proto" - - "-@io_bazel_rules_go//proto:go_proto_bootstrap" - - "-@org_golang_x_crypto//ed25519:ed25519_test" - - "-@org_golang_x_crypto//sha3:sha3_test" - - "-@org_golang_x_sys//windows/registry:registry_test" - - "-@org_golang_x_sys//windows/svc/eventlog:eventlog_test" - - "-@org_golang_x_sys//windows/svc:svc_test" - - "-@org_golang_x_text//language:language_test" - - "-//proto:combo_grpc" - - "-//proto:combo_proto" - - "-//proto:gofast_grpc" - - "-//proto:gofast_proto" - - "-//proto:gogofaster_grpc" - - "-//proto:gogofaster_proto" - - "-//proto:gogofast_grpc" - - "-//proto:gogofast_proto" - - "-//proto:gogo_grpc" - - "-//proto:gogo_proto" - - "-//proto:gogoslick_grpc" - - "-//proto:gogoslick_proto" - - "-//proto:gogotypes_grpc" - - "-//proto:gogotypes_proto" - - "-//proto:go_grpc" - - "-//proto:go_proto" - - "-//proto:go_proto_bootstrap" - - "-//proto:gostring_grpc" - - "-//proto:gostring_proto" - - "-//proto/wkt:any_go_proto" - - "-//proto/wkt:api_go_proto" - - "-//proto/wkt:compiler_plugin_go_proto" - - "-//proto/wkt:descriptor_go_proto" - - "-//proto/wkt:duration_go_proto" - - "-//proto/wkt:empty_go_proto" - - "-//proto/wkt:field_mask_go_proto" - - "-//proto/wkt:source_context_go_proto" - - "-//proto/wkt:struct_go_proto" - - "-//proto/wkt:timestamp_go_proto" - - "-//proto/wkt:type_go_proto" - - "-//proto/wkt:wrappers_go_proto" - - "-//tests:buildifier_test" # transitively requires proto, doesn't build in CI - - "-@test_chdir_remote//sub:go_default_test" - - "-//tests/core/cgo:dylib_client" - - "-//tests/core/cgo:dylib_test" - "-//tests/core/cgo:generated_dylib_client" - "-//tests/core/cgo:generated_dylib_test" - - "-//tests/core/cgo:versioned_dylib_client" - - "-//tests/core/cgo:versioned_dylib_test" - - "-//tests/core/cgo:generated_versioned_dylib_client" - "-//tests/core/cgo:generated_versioned_dylib_test" - - "-//tests/core/cross:proto_test" - - "-//tests/core/go_path:go_path" - - "-//tests/core/go_path:go_path_test" - - "-//tests/core/go_path:nodata_path" - - "-//tests/core/go_path:copy_path" - - "-//tests/core/go_path:archive_path" - - "-//tests/core/go_path/pkg/lib:vendored" - - "-//tests/core/go_path/pkg/lib:go_default_test" - - "-//tests/core/go_path/pkg/lib:go_default_library" - - "-//tests/core/go_path/pkg/lib:embed_test" - - "-//tests/core/go_path/pkg/lib:embed_lib" - - "-//tests/core/go_path/cmd/bin:cross" - - "-//tests/core/go_path/cmd/bin:bin" - - "-//tests/core/go_plugin:go_plugin" - - "-//tests/core/go_plugin:go_default_test" - - "-//tests/core/go_plugin:plugin" - - "-//tests/core/go_plugin_with_proto_library:go_plugin_with_proto_library" - - "-//tests/core/go_plugin_with_proto_library:go_default_test" - - "-//tests/core/go_plugin_with_proto_library:plugin" - - "-//tests/core/go_proto_library:all" - - "-//tests/core/go_proto_library_importmap:foo_go_proto" - - "-//tests/core/go_proto_library_importmap:foo_proto" - - "-//tests/core/go_proto_library_importmap:importmap_test" - - "-//tests/core/go_test:data_test" - - "-//tests/core/go_test:pwd_test" - - "-//tests/core/race:race_test" - - "-//tests/core/stdlib:buildid_test" - - "-//tests/examples/executable_name:executable_name" - - "-//tests/integration/googleapis:color_service" - - "-//tests/integration/googleapis:color_service_go_proto" - - "-//tests/integration/googleapis:color_service_proto" - - "-//tests/integration/googleapis:color_service_test" - - "-//tests/legacy/examples/cgo/example_command:example_command_test" - - "-//tests/legacy/examples/cgo/example_command:example_command_script" - - "-//tests/legacy/examples/cgo/example_command:example_command" - "-//tests/legacy/examples/cgo:generate_go_src" - "-//tests/legacy/examples/cgo:cgo_lib_test" - "-//tests/legacy/examples/cgo:go_default_library" + - "-//tests/legacy/examples/cgo:sub" - "-//tests/legacy/examples/cgo/cc_dependency:version" - "-//tests/legacy/examples/cgo/cc_dependency:c_version_so" - - "-//tests/legacy/examples/cgo:sub" - - "-//tests/legacy/examples/proto/dep:useful_go_proto" - - "-//tests/legacy/examples/proto/dep:useful_proto" - - "-//tests/legacy/examples/proto/embed:embed_go_proto" - - "-//tests/legacy/examples/proto/embed:embed_proto" - - "-//tests/legacy/examples/proto/embed:go_default_library" - - "-//tests/legacy/examples/proto:go_default_library" - - "-//tests/legacy/examples/proto/gogo:gogo_test" - - "-//tests/legacy/examples/proto/gogo:values_go_proto" - - "-//tests/legacy/examples/proto/gogo:values_proto" - - "-//tests/legacy/examples/proto/gostyle:gostyle_go_proto" - - "-//tests/legacy/examples/proto/gostyle:gostyle_proto" - - "-//tests/legacy/examples/proto/grpc:my_svc_go_proto" - - "-//tests/legacy/examples/proto/grpc:my_svc_proto" - - "-//tests/legacy/examples/proto/grpc:not_grpc" - - "-//tests/legacy/examples/proto/grpc:test_grpc" - - "-//tests/legacy/examples/proto/lib:lib_go_proto" - - "-//tests/legacy/examples/proto/lib:lib_proto" - - "-//tests/legacy/examples/proto:proto_pure_test" - - "-//tests/legacy/examples/proto:proto_test" - - "-//tests/legacy/extldflags_rpath:extldflags_rpath_test" - - "-//tests/legacy/info:info" - - "-//tests/legacy/proto_ignore_go_package_option:a_go_proto" - - "-//tests/legacy/proto_ignore_go_package_option:a_proto" - - "-//tests/legacy/proto_ignore_go_package_option:b_go_proto" - - "-//tests/legacy/proto_ignore_go_package_option:b_proto" - - "-//tests/legacy/test_chdir:go_default_test" - - "-//tests/legacy/test_rundir:go_default_test" - - "-//tests/legacy/transitive_data:go_default_test" - - "-//tests/core/cross:darwin_go_cross_cgo" # Doesn't work before bazel 6 - - "-//tests/core/cross:linux_go_cross_cgo" # Doesn't work before bazel 6 - - "-//tests/core/cross:windows_go_cross_cgo" # Doesn't work before bazel 6 + - "-//tests/legacy/examples/cgo/example_command:example_command" + - "-//tests/legacy/examples/cgo/example_command:example_command_script" + - "-//tests/legacy/examples/cgo/example_command:example_command_test" + # Plugins aren't supported on Windows. + - "-//tests/core/go_plugin/..." + - "-//tests/core/go_plugin_with_proto_library/..." test_flags: - '--action_env=PATH=C:\tools\msys64\usr\bin;C:\tools\msys64\bin;C:\tools\msys64\mingw64\bin;C:\python3\Scripts\;C:\python3;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Windows\System32\OpenSSH;C:\ProgramData\GooGet;C:\Program Files\Google\Compute Engine\metadata_scripts;C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\bin;C:\Program Files\Google\Compute Engine\sysprep;C:\ProgramData\chocolatey\bin;C:\Program Files\Git\cmd;C:\tools\msys64\usr\bin;c:\openjdk\bin;C:\Program Files (x86)\Windows Kits\8.1\Windows Performance Toolkit\;C:\Program Files\CMake\bin;c:\ninja;c:\bazel;c:\buildkite' # On Windows CI, bazel (bazelisk) needs %LocalAppData% to find the cache directory. @@ -288,76 +133,48 @@ tasks: - "--test_env=GO_BAZEL_TEST_BAZELFLAGS=--cpu=x64_windows --compiler=mingw-gcc --extra_toolchains=@local_config_cc//:cc-toolchain-x64_windows_mingw --action_env=PATH --host_platform=@io_bazel_rules_go//go/toolchain:windows_amd64_cgo --incompatible_enable_cc_toolchain_resolution" - "--test_env=PATH" test_targets: - - "--" - "//..." - - "-//go/tools/bazel:bazel_test" - - "-@org_golang_x_crypto//ed25519:ed25519_test" - - "-@org_golang_x_crypto//sha3:sha3_test" - - "-@org_golang_x_net//ipv4:ipv4_test" - - "-@org_golang_x_sys//windows/registry:registry_test" - - "-@org_golang_x_sys//windows/svc/eventlog:eventlog_test" - - "-@org_golang_x_sys//windows/svc:svc_test" - - "-@org_golang_x_text//language:language_test" - - "-@org_golang_x_tools//cmd/splitdwarf/internal/macho:macho_test" - - "-@test_chdir_remote//sub:go_default_test" - - "-//go/tools/builders:stdliblist_test" # fails on Windows due to #2491 - - "-//tests:buildifier_test" # requires bash - - "-//tests/core/cgo:dylib_client" - - "-//tests/core/cgo:dylib_test" + - "-//go/tools/builders:stdliblist_test" + - "-//tests:buildifier_test" - "-//tests/core/cgo:generated_dylib_client" - "-//tests/core/cgo:generated_dylib_test" - - "-//tests/core/cgo:race_test" # fails on Windows due to upstream bug, see issue #2911 - - "-//tests/core/cgo:versioned_dylib_client" - - "-//tests/core/cgo:versioned_dylib_test" - - "-//tests/core/cgo:generated_versioned_dylib_client" - "-//tests/core/cgo:generated_versioned_dylib_test" - "-//tests/core/coverage:coverage_test" - "-//tests/core/coverage:issue3017_test" - - "-//tests/core/cross:proto_test" - "-//tests/core/go_binary:go_default_test" - - "-//tests/core/go_path:go_path" - "-//tests/core/go_path:go_path_test" - - "-//tests/core/go_path/pkg/lib:embed_test" - - "-//tests/core/go_path/pkg/lib:go_default_test" - - "-//tests/core/go_plugin:go_plugin" - - "-//tests/core/go_plugin:go_default_test" - - "-//tests/core/go_plugin:plugin" - - "-//tests/core/go_plugin_with_proto_library:go_plugin_with_proto_library" - - "-//tests/core/go_plugin_with_proto_library:go_default_test" - - "-//tests/core/go_plugin_with_proto_library:plugin" - - "-//tests/core/go_proto_library:all" - - "-//tests/core/go_proto_library_importmap:importmap_test" - "-//tests/core/go_test:data_test" - "-//tests/core/go_test:pwd_test" - "-//tests/core/nogo/coverage:coverage_cgo_test" - "-//tests/core/nogo/coverage:coverage_test" - "-//tests/core/nogo/coverage:gen_code_test" - - "-//tests/core/race:race_test" # fails on Windows due to upstream bug, see issue #2911 - "-//tests/core/stdlib:buildid_test" - "-//tests/examples/executable_name:executable_name" - "-//tests/integration/gazelle:gazelle_test" # exceeds command line length limit - - "-//tests/integration/googleapis:color_service_test" - "-//tests/integration/reproducibility:reproducibility_test" - - "-//tests/legacy/cgo_pthread_flag:go_default_test" # fails without error, passes locally. Problem with CI msys2? - - "-//tests/legacy/examples/cgo/example_command:example_command_test" - - "-//tests/legacy/examples/cgo/example_command:example_command_script" - - "-//tests/legacy/examples/cgo/example_command:example_command" - "-//tests/legacy/examples/cgo:generate_go_src" - "-//tests/legacy/examples/cgo:cgo_lib_test" - "-//tests/legacy/examples/cgo:go_default_library" + - "-//tests/legacy/examples/cgo:sub" - "-//tests/legacy/examples/cgo/cc_dependency:version" - "-//tests/legacy/examples/cgo/cc_dependency:c_version_so" - - "-//tests/legacy/examples/proto/gogo:gogo_test" - - "-//tests/legacy/examples/proto:proto_pure_test" - - "-//tests/legacy/examples/proto:proto_test" + - "-//tests/legacy/examples/cgo/example_command:example_command" + - "-//tests/legacy/examples/cgo/example_command:example_command_script" + - "-//tests/legacy/examples/cgo/example_command:example_command_test" - "-//tests/legacy/extldflags_rpath:extldflags_rpath_test" - "-//tests/legacy/info:info" - "-//tests/legacy/test_chdir:go_default_test" - "-//tests/legacy/test_rundir:go_default_test" - "-//tests/legacy/transitive_data:go_default_test" - # Stardoc produces different line-endings on windows, - # so the documentation it generates doesn't match the checked in files. - # - Tracking issue https://github.com/bazelbuild/stardoc/issues/42. + - "-@org_golang_x_crypto//sha3:sha3_test" + - "-@org_golang_x_sys//windows/svc:svc_test" + - "-@org_golang_x_text//language:language_test" + - "-@org_golang_x_tools//cmd/splitdwarf/internal/macho:macho_test" + - "-@test_chdir_remote//sub:go_default_test" + # Plugins aren't supported on Windows. + - "-//tests/core/go_plugin/..." + - "-//tests/core/go_plugin_with_proto_library/..." + # TODO: Update stardoc for consistent line endings. - "-//docs:all" # The following configurations test a seperate WORKSPACE under the examples folder ubuntu2004_examples: diff --git a/.bazelversion b/.bazelversion new file mode 100644 index 0000000000..815da58b7a --- /dev/null +++ b/.bazelversion @@ -0,0 +1 @@ +7.4.1 diff --git a/README.rst b/README.rst index 3337cb7b21..561c11bafa 100644 --- a/README.rst +++ b/README.rst @@ -282,7 +282,7 @@ The Go rules are tested and supported on the following host platforms: Users have reported success on several other platforms, but the rules are only tested on those listed above. -Note: Since version v0.38.0, rules_go requires Bazel ≥ 5.4.0 to work. +Note: Since version v0.51.0, rules_go requires Bazel ≥ 6.5.0 to work. The ``master`` branch is only guaranteed to work with the latest version of Bazel. diff --git a/go/private/common.bzl b/go/private/common.bzl index 27378b375b..63916db3c4 100644 --- a/go/private/common.bzl +++ b/go/private/common.bzl @@ -140,7 +140,7 @@ def get_versioned_shared_lib_extension(path): # something like 1.2.3, or so.1.2, or dylib.1.2, or foo.1.2 return "" -MINIMUM_BAZEL_VERSION = "5.4.0" +MINIMUM_BAZEL_VERSION = "6.5.0" def as_list(v): """Returns a list, tuple, or depset as a list.""" diff --git a/tests/bcr/.bazelversion b/tests/bcr/.bazelversion index 19b860c187..815da58b7a 100644 --- a/tests/bcr/.bazelversion +++ b/tests/bcr/.bazelversion @@ -1 +1 @@ -6.4.0 +7.4.1