Skip to content

Commit

Permalink
Merge pull request #1 from brexhq/smocherla/brex-patches-m1
Browse files Browse the repository at this point in the history
Make rules_docker M1 compatible
  • Loading branch information
smocherla-brex authored Jul 18, 2022
2 parents deb5749 + 384de1b commit 5210653
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 11 deletions.
13 changes: 10 additions & 3 deletions repositories/go_repositories.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,17 @@ def go_deps():
'repositories' in //repositories:repositories.bzl have been imported
already.
"""
go_rules_dependencies()
go_register_toolchains()
gazelle_dependencies()
excludes = native.existing_rules().keys()
# go_register_toolchains can only be called once
# so we check that we only call it if it hasn't been before
sdk_kinds = ("_go_download_sdk", "_go_host_sdk", "_go_local_sdk", "_go_wrap_sdk")
existing_rules = native.existing_rules()
sdk_rules = [r for r in existing_rules.values() if r["kind"] in sdk_kinds]
if len(sdk_rules) == 0:
go_rules_dependencies()
go_register_toolchains(version = "1.17.6")

gazelle_dependencies()
if "com_github_google_go_containerregistry" not in excludes:
go_repository(
name = "com_github_google_go_containerregistry",
Expand Down
13 changes: 8 additions & 5 deletions repositories/repositories.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -111,10 +111,10 @@ def repositories():
if "io_bazel_rules_go" not in excludes:
http_archive(
name = "io_bazel_rules_go",
sha256 = "08c3cd71857d58af3cda759112437d9e63339ac9c6e0042add43f4d94caf632d",
sha256 = "d6b2513456fe2229811da7eb67a444be7785f5323c6708b38d851d2b51e54d83",
urls = [
"https://storage.googleapis.com/bazel-mirror/github.com/bazelbuild/rules_go/releases/download/v0.24.2/rules_go-v0.24.2.tar.gz",
"https://github.com/bazelbuild/rules_go/releases/download/v0.24.2/rules_go-v0.24.2.tar.gz",
"https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.30.0/rules_go-v0.30.0.zip",
"https://github.com/bazelbuild/rules_go/releases/download/v0.30.0/rules_go-v0.30.0.zip",
],
)
if "rules_python" not in excludes:
Expand Down Expand Up @@ -178,8 +178,11 @@ def repositories():
if "bazel_gazelle" not in excludes:
http_archive(
name = "bazel_gazelle",
sha256 = "cdb02a887a7187ea4d5a27452311a75ed8637379a1287d8eeb952138ea485f7d",
urls = ["https://github.com/bazelbuild/bazel-gazelle/releases/download/v0.21.1/bazel-gazelle-v0.21.1.tar.gz"],
sha256 = "de69a09dc70417580aabf20a28619bb3ef60d038470c7cf8442fafcf627c21cb",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/bazel-gazelle/releases/download/v0.24.0/bazel-gazelle-v0.24.0.tar.gz",
"https://github.com/bazelbuild/bazel-gazelle/releases/download/v0.24.0/bazel-gazelle-v0.24.0.tar.gz",
],
)

if "rules_pkg" not in excludes:
Expand Down
6 changes: 3 additions & 3 deletions toolchains/docker/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ docker_toolchain(
toolchain(
name = "default_linux_toolchain",
target_compatible_with = [
"@bazel_tools//platforms:linux",
"@platforms//os:linux",
],
toolchain = "@docker_config//:toolchain",
toolchain_type = ":toolchain_type",
Expand All @@ -51,7 +51,7 @@ toolchain(
toolchain(
name = "default_windows_toolchain",
target_compatible_with = [
"@bazel_tools//platforms:windows",
"@platforms//os:windows",
],
toolchain = "@docker_config//:toolchain",
toolchain_type = ":toolchain_type",
Expand All @@ -60,7 +60,7 @@ toolchain(
toolchain(
name = "default_osx_toolchain",
target_compatible_with = [
"@bazel_tools//platforms:osx",
"@platforms//os:osx",
],
toolchain = "@docker_config//:toolchain",
toolchain_type = ":toolchain_type",
Expand Down

0 comments on commit 5210653

Please sign in to comment.