trying to cross compile

bazel
Nick Dumas 1 year ago
parent 57390bdb0a
commit df242e038b

@ -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_go", version = "0.41.0")
bazel_dep(name = "rules_oci", version = "1.3.0") bazel_dep(name = "rules_oci", version = "1.3.0")
bazel_dep(name = "rules_pkg", version = "0.9.1") 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 = use_extension("@gazelle//:extensions.bzl", "go_deps")
go_deps.from_file(go_mod = "//:go.mod") go_deps.from_file(go_mod = "//:go.mod")
use_repo(go_deps, "com_github_stretchr_testify", "org_uber_go_zap") 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 = use_extension("@rules_oci//oci:extensions.bzl", "oci")
oci.pull( oci.pull(
platforms = ["linux/amd64"], platforms = ["linux/amd64"],

@ -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( go_library(
name = "demo_lib", name = "demo_lib",
@ -12,11 +12,26 @@ go_library(
) )
go_binary( go_binary(
name = "demo", name = "base",
embed = [":demo_lib"], embed = [":demo_lib"],
visibility = ["//visibility:public"], 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") load("@rules_pkg//:pkg.bzl", "pkg_tar")
pkg_tar( pkg_tar(

Loading…
Cancel
Save