Import rules_go
The motivation here is to use Go for the scouting web server. It
sounds like we have enough knowledge in the team to at least give it a
try.
$ bazel run //build_tests:hello_go
WARNING: Option 'ui' is deprecated
INFO: Invocation ID: d227f296-c249-44d3-88c0-42c2aee1bde2
INFO: SHA256 (https://golang.org/dl/?mode=json&include=all) = dd71d0c702dbeb9a765da037c9792250fb9e440fa3bd5dbdca91db34f0265446
INFO: Analyzed target //build_tests:hello_go (45 packages loaded, 47836 targets configured).
INFO: Found 1 target...
INFO: Writing explanation of rebuilds to '/tmp/bazel_explain.log'
Target //build_tests:hello_go up-to-date:
bazel-bin/build_tests/hello_go_/hello_go
INFO: Elapsed time: 99.935s, Critical Path: 1.57s
INFO: 8 processes: 4 internal, 4 linux-sandbox.
INFO: Build completed successfully, 8 total actions
INFO: Build completed successfully, 8 total actions
hello world
In order to work around a bazel issue, I created a dummy NOOP Go
toolchain. That toolchain will be used on all platforms where we don't
explicitly support Go. The key is to also mark all `go_*` target as
only being compatible with x86 Linux.
Change-Id: I0a9be3748c59998f5d2dea8d6a162779a0f31af1
Signed-off-by: Philipp Schrader <philipp.schrader@gmail.com>
diff --git a/tools/platforms/BUILD b/tools/platforms/BUILD
index 65563bf..4aa3db3 100644
--- a/tools/platforms/BUILD
+++ b/tools/platforms/BUILD
@@ -5,6 +5,7 @@
constraint_values = [
"@platforms//os:linux",
"@platforms//cpu:x86_64",
+ "//tools/platforms/go:has_support",
],
)
@@ -14,6 +15,7 @@
"@platforms//os:linux",
"@platforms//cpu:armv7",
"//tools/platforms/hardware:raspberry_pi",
+ "//tools/platforms/go:lacks_support",
],
)
@@ -22,6 +24,7 @@
constraint_values = [
"@platforms//os:linux",
"@platforms//cpu:arm64",
+ "//tools/platforms/go:lacks_support",
],
)
@@ -31,6 +34,7 @@
"@platforms//os:linux",
"@platforms//cpu:armv7",
"//tools/platforms/hardware:roborio",
+ "//tools/platforms/go:lacks_support",
],
)
@@ -39,6 +43,7 @@
constraint_values = [
"@platforms//os:none",
"//tools/platforms/hardware:cortex_m4f",
+ "//tools/platforms/go:lacks_support",
],
)
diff --git a/tools/platforms/go/BUILD b/tools/platforms/go/BUILD
new file mode 100644
index 0000000..5936287
--- /dev/null
+++ b/tools/platforms/go/BUILD
@@ -0,0 +1,13 @@
+package(default_visibility = ["//visibility:public"])
+
+constraint_setting(name = "go_support")
+
+constraint_value(
+ name = "has_support",
+ constraint_setting = ":go_support",
+)
+
+constraint_value(
+ name = "lacks_support",
+ constraint_setting = ":go_support",
+)