diff --git a/MODULE.bazel b/MODULE.bazel index f6cf2da..90cf609 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -7,11 +7,16 @@ bazel_dep(name = "gazelle", version = "0.32.0") bazel_dep(name = "rules_go", version = "0.41.0") bazel_dep(name = "rules_oci", version = "1.3.0") bazel_dep(name = "rules_pkg", version = "0.9.1") +bazel_dep(name = "platforms", version = "0.0.7") go_deps = use_extension("@gazelle//:extensions.bzl", "go_deps") go_deps.from_file(go_mod = "//:go.mod") use_repo(go_deps, "com_github_stretchr_testify", "org_uber_go_zap") + +toolchains = use_extension("@rules_go//go/toolchain:toolchains.bzl", "declare_constraints") +toolchains.declare_constraints() + oci = use_extension("@rules_oci//oci:extensions.bzl", "oci") oci.pull( platforms = ["linux/amd64"], diff --git a/cmd/demo/BUILD.bazel b/cmd/demo/BUILD.bazel index 245bdaf..19652d5 100644 --- a/cmd/demo/BUILD.bazel +++ b/cmd/demo/BUILD.bazel @@ -1,4 +1,4 @@ -load("@rules_go//go:def.bzl", "go_binary", "go_library") +load("@rules_go//go:def.bzl", "go_binary", "go_library", "go_cross_binary") go_library( name = "demo_lib", @@ -12,11 +12,26 @@ go_library( ) go_binary( - name = "demo", + name = "base", embed = [":demo_lib"], visibility = ["//visibility:public"], ) +platform( + name = "darwin/amd64", + constraint_values = [ + "@platforms//os:darwin", + "@platforms//cpu:amd64", + ], +) + +go_cross_binary( + name = "macOS", + platform = "@bazel_tools//platforms:osx", + sdk_version = "1.21.0", + target = "base", +) + load("@rules_pkg//:pkg.bzl", "pkg_tar") pkg_tar(