diff --git a/.bazelci/presubmit.yml b/.bazelci/presubmit.yml index b980ec5285..127b4d6959 100644 --- a/.bazelci/presubmit.yml +++ b/.bazelci/presubmit.yml @@ -7,6 +7,10 @@ tasks: - tests/core/cgo/generate_imported_dylib.sh build_targets: - "//..." + - "--" + - "-//tests/core/cross:darwin_go_cross_cgo" # Doesn't work before bazel 6 + - "-//tests/core/cross:linux_go_cross_cgo" # Doesn't work before bazel 6 + - "-//tests/core/cross:windows_go_cross_cgo" # Doesn't work before bazel 6 test_targets: - "//..." ubuntu2004: @@ -19,6 +23,10 @@ tasks: - "--config=incompatible" build_targets: - "//..." + - "--" + - "-//tests/core/cross:darwin_go_cross_cgo" # Doesn't work before bazel 6 + - "-//tests/core/cross:linux_go_cross_cgo" # Doesn't work before bazel 6 + - "-//tests/core/cross:windows_go_cross_cgo" # Doesn't work before bazel 6 test_targets: - "//..." ubuntu2004_bcr_tests: @@ -42,6 +50,10 @@ tasks: - tests/core/cgo/generate_imported_dylib.sh build_targets: - "//..." + - "--" + - "-//tests/core/cross:darwin_go_cross_cgo" # Doesn't work before bazel 6 + - "-//tests/core/cross:linux_go_cross_cgo" # Doesn't work before bazel 6 + - "-//tests/core/cross:windows_go_cross_cgo" # Doesn't work before bazel 6 test_targets: - "//..." rbe_ubuntu1604: @@ -49,6 +61,10 @@ tasks: - tests/core/cgo/generate_imported_dylib.sh build_targets: - "//..." + - "--" + - "-//tests/core/cross:darwin_go_cross_cgo" # Doesn't work before bazel 6 + - "-//tests/core/cross:linux_go_cross_cgo" # Doesn't work before bazel 6 + - "-//tests/core/cross:windows_go_cross_cgo" # Doesn't work before bazel 6 test_flags: # Some tests depend on this feature being disabled. However, because it's # enabled by default in the rbe_ubuntu1604 platform, we cannot simply remove @@ -249,6 +265,9 @@ tasks: - "-//tests/legacy/test_chdir:go_default_test" - "-//tests/legacy/test_rundir:go_default_test" - "-//tests/legacy/transitive_data:go_default_test" + - "-//tests/core/cross:darwin_go_cross_cgo" # Doesn't work before bazel 6 + - "-//tests/core/cross:linux_go_cross_cgo" # Doesn't work before bazel 6 + - "-//tests/core/cross:windows_go_cross_cgo" # Doesn't work before bazel 6 test_flags: # Go requires a C toolchain that accepts options and emits errors like # gcc or clang. The Go SDK does not support MSVC. diff --git a/tests/core/cross/BUILD.bazel b/tests/core/cross/BUILD.bazel index 04a7ba1338..5e4ddbf4b6 100644 --- a/tests/core/cross/BUILD.bazel +++ b/tests/core/cross/BUILD.bazel @@ -58,6 +58,30 @@ go_cross_binary( target = ":native_bin", ) +# Because pure = "on" on the underlying target, this doesn't actually need cgo (and won't try to use it). +# This target ensures that (from Bazel 6) we don't require a C++ toolchain if we're not actually going to use cgo. +go_cross_binary( + name = "windows_go_cross_cgo", + platform = "@io_bazel_rules_go//go/toolchain:windows_amd64_cgo", + target = ":native_bin", +) + +# Because pure = "on" on the underlying target, this doesn't actually need cgo (and won't try to use it). +# This target ensures that (from Bazel 6) we don't require a C++ toolchain if we're not actually going to use cgo. +go_cross_binary( + name = "linux_go_cross_cgo", + platform = "@io_bazel_rules_go//go/toolchain:linux_amd64_cgo", + target = ":native_bin", +) + +# Because pure = "on" on the underlying target, this doesn't actually need cgo (and won't try to use it). +# This target ensures that (from Bazel 6) we don't require a C++ toolchain if we're not actually going to use cgo. +go_cross_binary( + name = "darwin_go_cross_cgo", + platform = "@io_bazel_rules_go//go/toolchain:darwin_amd64_cgo", + target = ":native_bin", +) + go_library( name = "platform_lib", srcs = select({