From 18ebda3476f2e28101656d93a88107d587e0f1ca Mon Sep 17 00:00:00 2001 From: Christopher Koch Date: Thu, 3 May 2018 13:43:20 -0700 Subject: Include Gold linker in requirements. Updates #26. PiperOrigin-RevId: 195303940 Change-Id: I833cee55b5df6196ed90c1f8987c3c9c07204678 --- tools/go_stateify/defs.bzl | 54 ++++++++++++++++++++-------------------------- 1 file changed, 23 insertions(+), 31 deletions(-) (limited to 'tools/go_stateify/defs.bzl') 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, ) -- cgit v1.2.3