remove rules/rules_go
1. Go needed quite a few hacks to be made work with Go. From https://github.com/ziglang/zig/pull/15060 less hacks are needed (but still not zero, though now documented). 2. This file was never meant to be exposed as part of `hermetic_cc_toolchain`. I probably broke someone. Sorry.
This commit is contained in:
parent
cb46744cb8
commit
491144c721
2
BUILD
2
BUILD
@ -3,8 +3,6 @@
|
|||||||
|
|
||||||
load("@bazel_gazelle//:def.bzl", "gazelle")
|
load("@bazel_gazelle//:def.bzl", "gazelle")
|
||||||
|
|
||||||
# gazelle:map_kind go_binary go_binary //rules:rules_go.bzl
|
|
||||||
|
|
||||||
# gazelle:build_file_name BUILD
|
# gazelle:build_file_name BUILD
|
||||||
# gazelle:prefix github.com/uber/hermetic_cc_toolchain
|
# gazelle:prefix github.com/uber/hermetic_cc_toolchain
|
||||||
# gazelle:exclude tools.go
|
# gazelle:exclude tools.go
|
||||||
|
@ -30,7 +30,7 @@ go_rules_dependencies()
|
|||||||
# use latest stable.
|
# use latest stable.
|
||||||
go_download_sdk(
|
go_download_sdk(
|
||||||
name = "go_sdk",
|
name = "go_sdk",
|
||||||
version = "1.20",
|
version = "1.20.3",
|
||||||
)
|
)
|
||||||
|
|
||||||
go_register_toolchains()
|
go_register_toolchains()
|
||||||
|
@ -1,24 +0,0 @@
|
|||||||
# Copyright 2023 Uber Technologies, Inc.
|
|
||||||
# Licensed under the MIT License
|
|
||||||
|
|
||||||
load("@io_bazel_rules_go//go:def.bzl", go_binary_rule = "go_binary")
|
|
||||||
|
|
||||||
"""
|
|
||||||
go_binary overrides go_binary from rules_go and provides default
|
|
||||||
gc_linkopts values that are needed to compile for macos target.
|
|
||||||
To use it, add this map_kind gazelle directive to your BUILD.bazel files
|
|
||||||
where target binary needs to be compiled with zig toolchain.
|
|
||||||
|
|
||||||
Example: if this toolchain is registered as hermetic_cc_toolchain in your WORKSPACE, add this to
|
|
||||||
your root BUILD file
|
|
||||||
# gazelle:map_kind go_binary go_binary @hermetic_cc_toolchain//rules:rules_go.bzl
|
|
||||||
"""
|
|
||||||
|
|
||||||
_MACOS_GC_LINKOPTS = ["-s", "-w", "-buildmode=pie"]
|
|
||||||
|
|
||||||
def go_binary(**kwargs):
|
|
||||||
kwargs["gc_linkopts"] = select({
|
|
||||||
"@platforms//os:macos": _MACOS_GC_LINKOPTS,
|
|
||||||
"//conditions:default": [],
|
|
||||||
}) + kwargs.pop("gc_linkopts", [])
|
|
||||||
go_binary_rule(**kwargs)
|
|
@ -1,8 +1,7 @@
|
|||||||
# Copyright 2023 Uber Technologies, Inc.
|
# Copyright 2023 Uber Technologies, Inc.
|
||||||
# Licensed under the MIT License
|
# Licensed under the MIT License
|
||||||
|
|
||||||
load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
|
load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library", "go_test")
|
||||||
load("//rules:rules_go.bzl", "go_binary")
|
|
||||||
load("@hermetic_cc_toolchain//rules:platform.bzl", "platform_binary", "platform_test")
|
load("@hermetic_cc_toolchain//rules:platform.bzl", "platform_binary", "platform_test")
|
||||||
|
|
||||||
go_library(
|
go_library(
|
||||||
@ -22,6 +21,13 @@ go_test(
|
|||||||
go_binary(
|
go_binary(
|
||||||
name = "cgo",
|
name = "cgo",
|
||||||
embed = [":cgo_lib"],
|
embed = [":cgo_lib"],
|
||||||
|
gc_linkopts = select({
|
||||||
|
"@platforms//os:macos": [
|
||||||
|
"-w", # https://github.com/ziglang/zig/issues/15439
|
||||||
|
"-buildmode=pie", # https://github.com/ziglang/zig/issues/15438
|
||||||
|
],
|
||||||
|
"//conditions:default": [],
|
||||||
|
}),
|
||||||
visibility = ["//visibility:public"],
|
visibility = ["//visibility:public"],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -1,8 +1,7 @@
|
|||||||
# Copyright 2023 Uber Technologies, Inc.
|
# Copyright 2023 Uber Technologies, Inc.
|
||||||
# Licensed under the MIT License
|
# Licensed under the MIT License
|
||||||
|
|
||||||
load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
|
load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library", "go_test")
|
||||||
load("//rules:rules_go.bzl", "go_binary")
|
|
||||||
|
|
||||||
go_library(
|
go_library(
|
||||||
name = "gorace_lib",
|
name = "gorace_lib",
|
||||||
|
@ -1,8 +1,7 @@
|
|||||||
# Copyright 2023 Uber Technologies, Inc.
|
# Copyright 2023 Uber Technologies, Inc.
|
||||||
# Licensed under the MIT License
|
# Licensed under the MIT License
|
||||||
|
|
||||||
load("//rules:rules_go.bzl", "go_binary")
|
load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library", "go_test")
|
||||||
load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
|
|
||||||
|
|
||||||
go_library(
|
go_library(
|
||||||
name = "releaser_lib",
|
name = "releaser_lib",
|
||||||
|
Loading…
Reference in New Issue
Block a user