summaryrefslogtreecommitdiffhomepage
path: root/tools/defs.bzl
diff options
context:
space:
mode:
authorgVisor bot <gvisor-bot@google.com>2020-02-20 16:22:45 -0800
committerCopybara-Service <copybara-worker@google.com>2020-02-20 16:23:56 -0800
commitf1b72752e5de2abc3c409a6b7447224620b7c11b (patch)
tree12f20bad0a23969311401ddcf707588c6b048424 /tools/defs.bzl
parent4a73bae269ae9f52a962ae3b08a17ccaacf7ba80 (diff)
Implement automated marshalling for newtypes on primitives.
PiperOrigin-RevId: 296322954
Diffstat (limited to 'tools/defs.bzl')
-rw-r--r--tools/defs.bzl8
1 files changed, 6 insertions, 2 deletions
diff --git a/tools/defs.bzl b/tools/defs.bzl
index ddefb72d0..45c065459 100644
--- a/tools/defs.bzl
+++ b/tools/defs.bzl
@@ -85,7 +85,7 @@ def go_imports(name, src, out):
cmd = ("$(location @org_golang_x_tools//cmd/goimports:goimports) $(SRCS) > $@"),
)
-def go_library(name, srcs, deps = [], imports = [], stateify = True, marshal = False, **kwargs):
+def go_library(name, srcs, deps = [], imports = [], stateify = True, marshal = False, marshal_debug = False, **kwargs):
"""Wraps the standard go_library and does stateification and marshalling.
The recommended way is to use this rule with mostly identical configuration as the native
@@ -108,6 +108,7 @@ def go_library(name, srcs, deps = [], imports = [], stateify = True, marshal = F
imports: imports required for stateify.
stateify: whether statify is enabled (default: true).
marshal: whether marshal is enabled (default: false).
+ marshal_debug: whether the gomarshal tools emits debugging output (default: false).
**kwargs: standard go_library arguments.
"""
all_srcs = srcs
@@ -146,7 +147,10 @@ def go_library(name, srcs, deps = [], imports = [], stateify = True, marshal = F
go_marshal(
name = name + suffix + "_abi_autogen",
srcs = src_subset,
- debug = False,
+ debug = select({
+ "//tools/go_marshal:marshal_config_verbose": True,
+ "//conditions:default": marshal_debug,
+ }),
imports = imports,
package = name,
)