Skip to content

Commit

Permalink
Fix iOS cross compilation and enable test (#2099)
Browse files Browse the repository at this point in the history
Updates #2079
  • Loading branch information
Jay Conrod authored Jun 18, 2019
1 parent f2373c9 commit a1f357e
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 32 deletions.
4 changes: 2 additions & 2 deletions go/private/platforms.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -168,15 +168,15 @@ def _generate_platforms():
platforms.append(struct(
name = "ios_" + goarch,
goos = "darwin",
goarch = "goarch",
goarch = goarch,
constraints = constraints,
cgo = False,
))
constraints[-1] = "@io_bazel_rules_go//go/toolchain:cgo_on"
platforms.append(struct(
name = "ios_" + goarch + "_cgo",
goos = "darwin",
goarch = "goarch",
goarch = goarch,
constraints = constraints,
cgo = True,
))
Expand Down
57 changes: 27 additions & 30 deletions tests/core/cross/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -50,36 +50,33 @@ go_test(
deps = ["//go/tools/bazel:go_default_library"],
)

# TODO(#2090): enable test when cgo toolchains are sorted out. This won't
# build on non-darwin platforms if we need a C/C++ toolchain.

# bazel_test(
# name = "ios_select_test",
# args = ["--platforms=@io_bazel_rules_go//go/toolchain:ios_amd64"],
# command = "build",
# targets = [":ios_lib"],
# )
bazel_test(
name = "ios_select_test",
args = ["--platforms=@io_bazel_rules_go//go/toolchain:ios_amd64"],
command = "build",
targets = [":ios_lib"],
)

# go_library(
# name = "use_ios_lib",
# importpath = "github.com/bazelbuild/rules_go/tests/core/cross/use_ios_lib",
# deps = select({
# ":is_osx": [":ios_lib"],
# "//conditions:default": [],
# }),
# )
go_library(
name = "use_ios_lib",
importpath = "github.com/bazelbuild/rules_go/tests/core/cross/use_ios_lib",
deps = select({
":is_osx": [":ios_lib"],
"//conditions:default": [],
}),
)

# config_setting(
# name = "is_osx",
# constraint_values = ["@bazel_tools//platforms:osx"],
# )
config_setting(
name = "is_osx",
constraint_values = ["@bazel_tools//platforms:osx"],
)

# go_library(
# name = "ios_lib",
# srcs = select({
# "@io_bazel_rules_go//go/platform:darwin": ["ios_good.go"],
# "//conditions:default": ["ios_bad.go"],
# }),
# importpath = "github.com/bazelbuild/rules_go/tests/core/cross/ios_lib",
# tags = ["manual"],
# )
go_library(
name = "ios_lib",
srcs = select({
"@io_bazel_rules_go//go/platform:darwin": ["ios_good.go"],
"//conditions:default": ["ios_bad.go"],
}),
importpath = "github.com/bazelbuild/rules_go/tests/core/cross/ios_lib",
tags = ["manual"],
)

0 comments on commit a1f357e

Please sign in to comment.