summaryrefslogtreecommitdiffhomepage
path: root/tools/go_stateify
diff options
context:
space:
mode:
authorChristopher Koch <chrisko@google.com>2018-05-03 13:43:20 -0700
committerShentubot <shentubot@google.com>2018-05-03 13:44:05 -0700
commit18ebda3476f2e28101656d93a88107d587e0f1ca (patch)
tree9849e61f1719b306d1d434eb8d0416ea25536144 /tools/go_stateify
parent9739b8c21cd1716c4c1c81a27121c50e63fcf906 (diff)
Include Gold linker in requirements.
Updates #26. PiperOrigin-RevId: 195303940 Change-Id: I833cee55b5df6196ed90c1f8987c3c9c07204678
Diffstat (limited to 'tools/go_stateify')
-rw-r--r--tools/go_stateify/defs.bzl54
1 files changed, 23 insertions, 31 deletions
diff --git a/tools/go_stateify/defs.bzl b/tools/go_stateify/defs.bzl
index 87fdc0d28..60a9895ff 100644
--- a/tools/go_stateify/defs.bzl
+++ b/tools/go_stateify/defs.bzl
@@ -23,27 +23,27 @@ go_library(
"""
def _go_stateify_impl(ctx):
- """Implementation for the stateify tool."""
- output = ctx.outputs.out
+ """Implementation for the stateify tool."""
+ output = ctx.outputs.out
- # Run the stateify command.
- args = ["-output=%s" % output.path]
- args += ["-pkg=%s" % ctx.attr.package]
- if ctx.attr._statepkg:
- args += ["-statepkg=%s" % ctx.attr._statepkg]
- if ctx.attr.imports:
- args += ["-imports=%s" % ",".join(ctx.attr.imports)]
- args += ["--"]
- for src in ctx.attr.srcs:
- args += [f.path for f in src.files]
- ctx.actions.run(
- inputs = ctx.files.srcs,
- outputs = [output],
- mnemonic = "GoStateify",
- progress_message = "Generating state library %s" % ctx.label,
- arguments = args,
- executable = ctx.executable._tool,
- )
+ # Run the stateify command.
+ args = ["-output=%s" % output.path]
+ args += ["-pkg=%s" % ctx.attr.package]
+ if ctx.attr._statepkg:
+ args += ["-statepkg=%s" % ctx.attr._statepkg]
+ if ctx.attr.imports:
+ args += ["-imports=%s" % ",".join(ctx.attr.imports)]
+ args += ["--"]
+ for src in ctx.attr.srcs:
+ args += [f.path for f in src.files]
+ ctx.actions.run(
+ inputs = ctx.files.srcs,
+ outputs = [output],
+ mnemonic = "GoStateify",
+ progress_message = "Generating state library %s" % ctx.label,
+ arguments = args,
+ executable = ctx.executable._tool,
+ )
"""
Generates save and restore logic from a set of Go files.
@@ -56,22 +56,14 @@ Args:
out: the name of the generated file output. This must not conflict with any other files and must be added to the srcs of the relevant go_library.
package: the package name for the input sources.
"""
-
go_stateify = rule(
+ implementation = _go_stateify_impl,
attrs = {
- "srcs": attr.label_list(
- mandatory = True,
- allow_files = True,
- ),
+ "srcs": attr.label_list(mandatory = True, allow_files = True),
"imports": attr.string_list(mandatory = False),
"package": attr.string(mandatory = True),
"out": attr.output(mandatory = True),
- "_tool": attr.label(
- executable = True,
- cfg = "host",
- default = Label("//tools/go_stateify:stateify"),
- ),
+ "_tool": attr.label(executable = True, cfg = "host", default = Label("//tools/go_stateify:stateify")),
"_statepkg": attr.string(default = "gvisor.googlesource.com/gvisor/pkg/state"),
},
- implementation = _go_stateify_impl,
)