diff options
author | gVisor bot <gvisor-bot@google.com> | 2019-12-20 18:07:09 -0800 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2019-12-20 18:07:09 -0800 |
commit | d1528df71502b47bdb949798ce0abad1794b054c (patch) | |
tree | c827ada6ccac7e192bf865e501a162106ef130d2 /tools/go_stateify/defs.bzl | |
parent | 818eb22b11d6e0c056af6d4605e8cd246e622231 (diff) | |
parent | e9d43f9022e014a31d40b7d04c5e7f5b6d3be2b9 (diff) |
Merge pull request #1026 from lubinszARM:pr_savable
PiperOrigin-RevId: 286667216
Diffstat (limited to 'tools/go_stateify/defs.bzl')
-rw-r--r-- | tools/go_stateify/defs.bzl | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/tools/go_stateify/defs.bzl b/tools/go_stateify/defs.bzl index 3ce36c1c8..33267c074 100644 --- a/tools/go_stateify/defs.bzl +++ b/tools/go_stateify/defs.bzl @@ -43,12 +43,13 @@ def _go_stateify_impl(ctx): # Run the stateify command. args = ["-output=%s" % output.path] - args += ["-pkg=%s" % ctx.attr.package] + args.append("-pkg=%s" % ctx.attr.package) + args.append("-arch=%s" % ctx.attr.arch) if ctx.attr._statepkg: - args += ["-statepkg=%s" % ctx.attr._statepkg] + args.append("-statepkg=%s" % ctx.attr._statepkg) if ctx.attr.imports: - args += ["-imports=%s" % ",".join(ctx.attr.imports)] - args += ["--"] + args.append("-imports=%s" % ",".join(ctx.attr.imports)) + args.append("--") for src in ctx.attr.srcs: args += [f.path for f in src.files.to_list()] ctx.actions.run( @@ -83,6 +84,10 @@ for statified types. doc = "The package name for the input sources.", mandatory = True, ), + "arch": attr.string( + doc = "Target platform.", + mandatory = True, + ), "out": attr.output( doc = """ The name of the generated file output. This must not conflict with any other @@ -118,6 +123,10 @@ def go_library(name, srcs, deps = [], imports = [], **kwargs): srcs = [src for src in srcs if src.endswith(".go")], imports = imports, package = name, + arch = select({ + "@bazel_tools//src/conditions:linux_aarch64": "arm64", + "//conditions:default": "amd64", + }), out = name + "_state_autogen.go", ) all_srcs = srcs + [name + "_state_autogen.go"] |