Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bumping minimal Bazel version to 5.1.0 #3286

Merged
merged 2 commits into from
Sep 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .bazelci/presubmit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
tasks:
ubuntu1804_bazel400:
platform: ubuntu1804
bazel: 4.2.1 # test minimum supported version of bazel
bazel: 5.1.0 # test minimum supported version of bazel
shell_commands:
- tests/core/cgo/generate_imported_dylib.sh
build_targets:
Expand Down
25 changes: 6 additions & 19 deletions go/private/actions/archive.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -66,25 +66,12 @@ def emit_archive(go, source = None, _recompile_suffix = ""):
runfiles = source.runfiles
data_files = runfiles.files

# After bazel version 5.0.0, starlark introduced a new API called merge_all().
# There is a recommendation in the release notes to use merge_all() if we hit
# the depth limit because of using merge() in a loop; we saw some repositories
# hitting this issue after upgrading to 5.0.0. To keep it backward compatible,
# we will fall back to the old logic if the array doesn't have merge_all().
# TODO: remove this check after the MINIMUM_BAZEL_VERSION becomes >= 5.0.0
# https://blog.bazel.build/2022/01/19/bazel-5.0.html#starlark-build-language
if hasattr(runfiles, "merge_all"):
files = []
for a in direct:
files.append(a.runfiles)
if a.source.mode != go.mode:
fail("Archive mode does not match {} is {} expected {}".format(a.data.label, mode_string(a.source.mode), mode_string(go.mode)))
runfiles.merge_all(files)
else:
for a in direct:
runfiles = runfiles.merge(a.runfiles)
if a.source.mode != go.mode:
fail("Archive mode does not match {} is {} expected {}".format(a.data.label, mode_string(a.source.mode), mode_string(go.mode)))
files = []
for a in direct:
files.append(a.runfiles)
if a.source.mode != go.mode:
fail("Archive mode does not match {} is {} expected {}".format(a.data.label, mode_string(a.source.mode), mode_string(go.mode)))
runfiles.merge_all(files)

importmap = "main" if source.library.is_main else source.library.importmap
importpath, _ = effective_importpath_pkgpath(source.library)
Expand Down
2 changes: 1 addition & 1 deletion go/private/common.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,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 = "4.2.1"
MINIMUM_BAZEL_VERSION = "5.1.0"

def as_list(v):
"""Returns a list, tuple, or depset as a list."""
Expand Down