Skip to content

Commit 2123eed

Browse files
detiberk8s-ci-robot
authored andcommitted
Bazel updates (kubernetes-sigs#1043)
- Remove use of deprecated bazel attribute label single_file - Add bazel version checking - Include go_rules fix for cross-compiling darwin binaries
1 parent 1fca3ca commit 2123eed

File tree

2 files changed

+29
-12
lines changed

2 files changed

+29
-12
lines changed

WORKSPACE

+26-6
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,19 @@
11
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
22
load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository")
33

4-
http_archive(
4+
# Use the git repository for bazel rules until a released version contains https://github.com/bazelbuild/rules_go/pull/2090
5+
# http_archive(
6+
# name = "io_bazel_rules_go",
7+
# urls = [
8+
# "https://storage.googleapis.com/bazel-mirror/github.com/bazelbuild/rules_go/releases/download/0.18.6/rules_go-0.18.6.tar.gz",
9+
# "https://github.com/bazelbuild/rules_go/releases/download/0.18.6/rules_go-0.18.6.tar.gz",
10+
# ],
11+
# sha256 = "f04d2373bcaf8aa09bccb08a98a57e721306c8f6043a2a0ee610fd6853dcde3d",
12+
# )
13+
git_repository(
514
name = "io_bazel_rules_go",
6-
urls = [
7-
"https://storage.googleapis.com/bazel-mirror/github.com/bazelbuild/rules_go/releases/download/0.18.6/rules_go-0.18.6.tar.gz",
8-
"https://github.com/bazelbuild/rules_go/releases/download/0.18.6/rules_go-0.18.6.tar.gz",
9-
],
10-
sha256 = "f04d2373bcaf8aa09bccb08a98a57e721306c8f6043a2a0ee610fd6853dcde3d",
15+
remote = "https://github.com/bazelbuild/rules_go.git",
16+
commit = "f2373c9fbd09586d8e591dda3c43d66445b2d7ca",
1117
)
1218

1319
http_archive(
@@ -16,6 +22,20 @@ http_archive(
1622
urls = ["https://github.com/bazelbuild/bazel-gazelle/releases/download/0.17.0/bazel-gazelle-0.17.0.tar.gz"],
1723
)
1824

25+
http_archive(
26+
name = "bazel_skylib",
27+
sha256 = "2ef429f5d7ce7111263289644d233707dba35e39696377ebab8b0bc701f7818e",
28+
type = "tar.gz",
29+
url = "https://github.com/bazelbuild/bazel-skylib/releases/download/0.8.0/bazel-skylib.0.8.0.tar.gz",
30+
)
31+
32+
load("@bazel_skylib//lib:versions.bzl", "versions")
33+
34+
versions.check(
35+
minimum_bazel_version = "0.23.0",
36+
maximum_bazel_version = "1.0.0",
37+
) # fails if not within range
38+
1939
load("@io_bazel_rules_go//go:deps.bzl", "go_rules_dependencies", "go_register_toolchains")
2040

2141
go_rules_dependencies()

build/run_in_workspace_with_goroot.bzl

+3-6
Original file line numberDiff line numberDiff line change
@@ -51,18 +51,15 @@ _workspace_binary_script = rule(
5151
attrs = {
5252
"cmd": attr.label(
5353
mandatory = True,
54-
allow_files = True,
55-
single_file = True,
54+
allow_single_file = True,
5655
),
5756
"root_file": attr.label(
5857
mandatory = True,
59-
allow_files = True,
60-
single_file = True,
58+
allow_single_file = True,
6159
),
6260
"go_bin": attr.label(
6361
mandatory = True,
64-
allow_files = True,
65-
single_file = True,
62+
allow_single_file = True,
6663
),
6764
},
6865
executable = True,

0 commit comments

Comments
 (0)