diff options
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"] |