Validate constants before deploying

This makes our normal generators generate a *_unvalidated.json. The
constants_json rule will take that in and out a *.json file which is
validated and formatted.

Signed-off-by: Maxwell Henderson <mxwhenderson@gmail.com>
Change-Id: Iabd58bb072e0c3d300f8619d436b599d0f27b4b7
diff --git a/y2024/constants/validator.bzl b/y2024/constants/validator.bzl
new file mode 100644
index 0000000..6121f58
--- /dev/null
+++ b/y2024/constants/validator.bzl
@@ -0,0 +1,13 @@
+load("@aspect_bazel_lib//lib:run_binary.bzl", "run_binary")
+
+# Validates the constants.json file and outputs a formatted version.
+# TODO(max): Make this generic/template it out into frc971
+def constants_json(name, src, out):
+    run_binary(
+        name = name,
+        tool = "//y2024/constants:constants_formatter",
+        srcs = [src],
+        outs = [out],
+        args = ["$(location %s)" % (src)] + ["$(location %s)" % (out)],
+        visibility = ["//visibility:public"],
+    )