Skip to content

Commit

Permalink
Bazel updates (kubernetes-sigs#1043)
Browse files Browse the repository at this point in the history
- Remove use of deprecated bazel attribute label single_file
- Add bazel version checking
- Include go_rules fix for cross-compiling darwin binaries
  • Loading branch information
detiber authored and k8s-ci-robot committed Jun 19, 2019
1 parent 1fca3ca commit 2123eed
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 12 deletions.
32 changes: 26 additions & 6 deletions WORKSPACE
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository")

http_archive(
# Use the git repository for bazel rules until a released version contains https://github.com/bazelbuild/rules_go/pull/2090
# http_archive(
# name = "io_bazel_rules_go",
# urls = [
# "https://storage.googleapis.com/bazel-mirror/github.com/bazelbuild/rules_go/releases/download/0.18.6/rules_go-0.18.6.tar.gz",
# "https://github.com/bazelbuild/rules_go/releases/download/0.18.6/rules_go-0.18.6.tar.gz",
# ],
# sha256 = "f04d2373bcaf8aa09bccb08a98a57e721306c8f6043a2a0ee610fd6853dcde3d",
# )
git_repository(
name = "io_bazel_rules_go",
urls = [
"https://storage.googleapis.com/bazel-mirror/github.com/bazelbuild/rules_go/releases/download/0.18.6/rules_go-0.18.6.tar.gz",
"https://github.com/bazelbuild/rules_go/releases/download/0.18.6/rules_go-0.18.6.tar.gz",
],
sha256 = "f04d2373bcaf8aa09bccb08a98a57e721306c8f6043a2a0ee610fd6853dcde3d",
remote = "https://github.com/bazelbuild/rules_go.git",
commit = "f2373c9fbd09586d8e591dda3c43d66445b2d7ca",
)

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

http_archive(
name = "bazel_skylib",
sha256 = "2ef429f5d7ce7111263289644d233707dba35e39696377ebab8b0bc701f7818e",
type = "tar.gz",
url = "https://github.com/bazelbuild/bazel-skylib/releases/download/0.8.0/bazel-skylib.0.8.0.tar.gz",
)

load("@bazel_skylib//lib:versions.bzl", "versions")

versions.check(
minimum_bazel_version = "0.23.0",
maximum_bazel_version = "1.0.0",
) # fails if not within range

load("@io_bazel_rules_go//go:deps.bzl", "go_rules_dependencies", "go_register_toolchains")

go_rules_dependencies()
Expand Down
9 changes: 3 additions & 6 deletions build/run_in_workspace_with_goroot.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -51,18 +51,15 @@ _workspace_binary_script = rule(
attrs = {
"cmd": attr.label(
mandatory = True,
allow_files = True,
single_file = True,
allow_single_file = True,
),
"root_file": attr.label(
mandatory = True,
allow_files = True,
single_file = True,
allow_single_file = True,
),
"go_bin": attr.label(
mandatory = True,
allow_files = True,
single_file = True,
allow_single_file = True,
),
},
executable = True,
Expand Down

0 comments on commit 2123eed

Please sign in to comment.