summaryrefslogtreecommitdiffhomepage
path: root/tools/bazeldefs/defs.bzl
diff options
context:
space:
mode:
Diffstat (limited to 'tools/bazeldefs/defs.bzl')
-rw-r--r--tools/bazeldefs/defs.bzl9
1 files changed, 8 insertions, 1 deletions
diff --git a/tools/bazeldefs/defs.bzl b/tools/bazeldefs/defs.bzl
index db7f379b8..4bbcda054 100644
--- a/tools/bazeldefs/defs.bzl
+++ b/tools/bazeldefs/defs.bzl
@@ -87,13 +87,14 @@ def cc_binary(name, static = False, **kwargs):
**kwargs
)
-def go_binary(name, static = False, pure = False, **kwargs):
+def go_binary(name, static = False, pure = False, x_defs = None, **kwargs):
"""Build a go binary.
Args:
name: name of the target.
static: build a static binary.
pure: build without cgo.
+ x_defs: additional definitions.
**kwargs: rest of the arguments are passed to _go_binary.
"""
if static:
@@ -102,6 +103,7 @@ def go_binary(name, static = False, pure = False, **kwargs):
kwargs["pure"] = "on"
_go_binary(
name = name,
+ x_defs = x_defs,
**kwargs
)
@@ -151,6 +153,11 @@ def go_rule(rule, implementation, **kwargs):
toolchains = kwargs.get("toolchains", []) + ["@io_bazel_rules_go//go:toolchain"]
return rule(implementation, attrs = attrs, toolchains = toolchains, **kwargs)
+def go_test_library(target):
+ if hasattr(target.attr, "embed") and len(target.attr.embed) > 0:
+ return target.attr.embed[0]
+ return None
+
def go_context(ctx):
go_ctx = _go_context(ctx)
return struct(