summaryrefslogtreecommitdiffhomepage
path: root/tools/go_stateify/defs.bzl
diff options
context:
space:
mode:
authorBin Lu <bin.lu@arm.com>2019-10-17 14:51:01 +0800
committerBin Lu <bin.lu@arm.com>2019-10-28 09:44:19 +0000
commite9d43f9022e014a31d40b7d04c5e7f5b6d3be2b9 (patch)
tree649a6631d1c40ab47679973f9b1ca3cf483fbc3c /tools/go_stateify/defs.bzl
parent06ed9e329d46268cf12fe07bd3974c5d54ae7e0b (diff)
Add tools/go_stateify to support Arm64
2 jobs were finished in this patch: 1, add a new attribute to specify the target platform. 2, check the source files that whether we can build this file for target platform by checking file name and build tags. Signed-off-by: Bin Lu <bin.lu@arm.com>
Diffstat (limited to 'tools/go_stateify/defs.bzl')
-rw-r--r--tools/go_stateify/defs.bzl9
1 files changed, 9 insertions, 0 deletions
diff --git a/tools/go_stateify/defs.bzl b/tools/go_stateify/defs.bzl
index 3ce36c1c8..a7961c2fb 100644
--- a/tools/go_stateify/defs.bzl
+++ b/tools/go_stateify/defs.bzl
@@ -44,6 +44,7 @@ def _go_stateify_impl(ctx):
# Run the stateify command.
args = ["-output=%s" % output.path]
args += ["-pkg=%s" % ctx.attr.package]
+ args += ["-arch=%s" % ctx.attr.arch]
if ctx.attr._statepkg:
args += ["-statepkg=%s" % ctx.attr._statepkg]
if ctx.attr.imports:
@@ -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"]