diff --git a/.bazelci/presubmit.yml b/.bazelci/presubmit.yml index c89129d696..87aa7ff9e1 100644 --- a/.bazelci/presubmit.yml +++ b/.bazelci/presubmit.yml @@ -2,7 +2,7 @@ tasks: ubuntu1804_bazel400: platform: ubuntu1804 - bazel: 5.1.0 # test minimum supported version of bazel + bazel: 5.2.0 # test minimum supported version of bazel shell_commands: - tests/core/cgo/generate_imported_dylib.sh build_targets: diff --git a/README.rst b/README.rst index 954cc2d9ed..f32d2c67c8 100644 --- a/README.rst +++ b/README.rst @@ -193,7 +193,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.35.0, rules_go requires Bazel ≥ 5.1.0 to work. +Note: Since version v0.38.0, rules_go requires Bazel ≥ 5.2.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 7a1c4135ee..d0efaaf951 100644 --- a/go/private/common.bzl +++ b/go/private/common.bzl @@ -169,7 +169,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.1.0" +MINIMUM_BAZEL_VERSION = "5.2.0" def as_list(v): """Returns a list, tuple, or depset as a list.""" diff --git a/go/private/repositories.bzl b/go/private/repositories.bzl index 99170742c4..4dc669cee3 100644 --- a/go/private/repositories.bzl +++ b/go/private/repositories.bzl @@ -20,18 +20,6 @@ load("//go/private:nogo.bzl", "DEFAULT_NOGO", "go_register_nogo") load("//proto:gogo.bzl", "gogo_special_proto") load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") -# native.bazel_version is only available in WORKSPACE macros -# https://github.com/bazelbuild/bazel/issues/8305 -# Needed for guarding env_inherit support https://github.com/bazelbuild/rules_go/pull/3256 which requires 5.2.0+ -def _bazel_version_repository_impl(repository_ctx): - repository_ctx.file("bazel_version.bzl", "bazel_version = \"{}\"".format(native.bazel_version)) - repository_ctx.file("BUILD", "exports_files([\"bazel_version.bzl\"])") - -_bazel_version_repository = repository_rule( - implementation = _bazel_version_repository_impl, - local = True, -) - def go_rules_dependencies(force = False): """Declares workspaces the Go rules depend on. Workspaces that use rules_go should call this. @@ -50,8 +38,6 @@ def go_rules_dependencies(force = False): if getattr(native, "bazel_version", None): versions.check(MINIMUM_BAZEL_VERSION, bazel_version = native.bazel_version) - _bazel_version_repository(name = "rules_go_bazel_version") - if force: wrapper = _always else: diff --git a/go/private/rules/BUILD.bazel b/go/private/rules/BUILD.bazel index 13127b67ac..2de381d597 100644 --- a/go/private/rules/BUILD.bazel +++ b/go/private/rules/BUILD.bazel @@ -132,9 +132,7 @@ bzl_library( "//go/private:providers", "//go/private/rules:binary", "//go/private/rules:transition", - "//go/private/skylib/lib:versions", "@bazel_skylib//lib:structs", - "@rules_go_bazel_version//:bazel_version.bzl", ], ) diff --git a/go/private/rules/test.bzl b/go/private/rules/test.bzl index 76716ed7a5..d30704d006 100644 --- a/go/private/rules/test.bzl +++ b/go/private/rules/test.bzl @@ -52,11 +52,6 @@ load( "@bazel_skylib//lib:structs.bzl", "structs", ) -load("@rules_go_bazel_version//:bazel_version.bzl", "bazel_version") -load( - "//go/private/skylib/lib:versions.bzl", - "versions", -) def _go_test_impl(ctx): """go_test_impl implements go testing. @@ -168,12 +163,7 @@ def _go_test_impl(ctx): for k, v in ctx.attr.env.items(): env[k] = ctx.expand_location(v, ctx.attr.data) - test_environment = testing.TestEnvironment(env) - if ctx.attr.env_inherit: - # inherited_environment is only available in Bazel 5.2.0+ - # https://github.com/bazelbuild/rules_go/pull/3256 - versions.check("5.2.0", bazel_version = bazel_version) - test_environment = testing.TestEnvironment(env, ctx.attr.env_inherit) + test_environment = testing.TestEnvironment(env, ctx.attr.env_inherit) # Bazel only looks for coverage data if the test target has an # InstrumentedFilesProvider. If the provider is found and at least one