Switch everything to platforms

This patch switches the codebase over from using the "cpu"
mechanism to using bazel platforms. See
https://docs.bazel.build/versions/master/platforms.html for some more
information.

Most of the substantial changes are in //tools. Instead of using
`cc_toolchain_suite` rules, we now use regular `toolchain` rules that
are registered in the WORKSPACE. That also means that bazel now uses
the target platform to select the compiler.

All --cpu=* arguments should now be --config=* arguments. For example,
`--cpu=roborio` should now be `--config=roborio`. The CI script and
all documentation has been updated to reflect that.

The remainder of the changes revolve around tagging all targets with
`target_compatible_with`.  The old mechanism allowed us to specify
repo-wide defaults. The new mechanism does not. That means every
target that didn't have any compatibility specified, now requires
compatibility with `@platforms//os:linux`.

I used buildozer for the vast majority of `target_compatible_with`
changes. buildozer automatically buildifies any BUILD files it
touches. That means this patch also contains a few non-functional
changes that I was too lazy to remove.

Change-Id: I66d6e6ad9161520ee397597cdb492585820a3acd
diff --git a/y2020/vision/sift/BUILD b/y2020/vision/sift/BUILD
index 158aa94..4a0dcfb 100644
--- a/y2020/vision/sift/BUILD
+++ b/y2020/vision/sift/BUILD
@@ -6,10 +6,7 @@
     srcs = [
         "fast_gaussian_generator.cc",
     ],
-    restricted_to = [
-        "//tools:k8",
-        "//tools:armhf-debian",
-    ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         "//third_party:halide",
         "//third_party:halide_gengen",
@@ -25,18 +22,15 @@
     ],
     data = [
         ":fast_gaussian_generator",
-        # TODO(Brian): Replace this with something more fine-grained from the
-        # configuration fragment or something.
-        "//tools/cpp:toolchain",
         "@amd64_debian_sysroot//:sysroot_files",
     ],
-    python_version = "PY3",
-    main = "fast_gaussian_runner.py",
-    restricted_to = [
-        "//tools:k8",
-        "//tools:armhf-debian",
+    toolchains = [
+        "@bazel_tools//tools/cpp:current_cc_toolchain",
     ],
+    main = "fast_gaussian_runner.py",
+    python_version = "PY3",
     srcs_version = "PY2AND3",
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         "@bazel_tools//tools/python/runfiles",
     ],
@@ -121,10 +115,7 @@
     hdrs = [
         "sift971.h",
     ],
-    restricted_to = [
-        "//tools:k8",
-        "//tools:armhf-debian",
-    ],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
     deps = [
         ":fast_gaussian",
@@ -141,10 +132,7 @@
     hdrs = [
         "fast_gaussian.h",
     ],
-    restricted_to = [
-        "//tools:k8",
-        "//tools:armhf-debian",
-    ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":fast_gaussian_all",
         "//third_party:halide_runtime",
@@ -158,10 +146,7 @@
     srcs = [
         "fast_gaussian_test.cc",
     ],
-    restricted_to = [
-        "//tools:k8",
-        "//tools:armhf-debian",
-    ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":fast_gaussian",
         "//aos/testing:googletest",
@@ -174,10 +159,7 @@
     srcs = [
         "testing_sift.cc",
     ],
-    restricted_to = [
-        "//tools:k8",
-        "//tools:armhf-debian",
-    ],
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":fast_gaussian",
         "//aos:init",
@@ -207,6 +189,7 @@
         "TrainingImage",
         "TrainingData",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
 )
 
@@ -214,12 +197,14 @@
     name = "sift_fbs",
     srcs = ["sift.fbs"],
     gen_reflections = True,
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
 )
 
 flatbuffer_ts_library(
     name = "sift_ts_fbs",
     srcs = ["sift.fbs"],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//y2020:__subpackages__"],
 )
 
@@ -228,6 +213,7 @@
     srcs = ["sift_training.fbs"],
     gen_reflections = True,
     includes = [":sift_fbs_includes"],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
 )
 
@@ -236,6 +222,7 @@
     srcs = ["demo_sift_training.py"],
     python_version = "PY3",
     srcs_version = "PY2AND3",
+    target_compatible_with = ["@platforms//os:linux"],
     deps = [
         ":sift_fbs_python",
         "@opencv_contrib_nonfree_amd64//:python_opencv",
@@ -255,6 +242,7 @@
         "$(location images/demo/FRC-Image4-cleaned.png)",
         "$(location demo_sift.h)",
     ]),
+    target_compatible_with = ["@platforms//os:linux"],
     tools = [
         ":demo_sift_training",
     ],
@@ -265,5 +253,6 @@
     hdrs = [
         "demo_sift.h",
     ],
+    target_compatible_with = ["@platforms//os:linux"],
     visibility = ["//visibility:public"],
 )