Make aos_config rule outputs predeclared

This makes it easy to have rules depend on a specific one of the outputs
(i.e., just one of the .json, .stripped.json, or .bfbs) without having
to write an entire bazel rule yourself.

It also means that we now actually catch it when someone accidentally
names the input config the same as the resulting generated config.

Change-Id: Id36388f52794aeaef4e3b9357cb495f88ac5f313
Signed-off-by: James Kuszmaul <jabukuszmaul+collab@gmail.com>
diff --git a/aos/config.bzl b/aos/config.bzl
index 57d6af3..4aa6b4a 100644
--- a/aos/config.bzl
+++ b/aos/config.bzl
@@ -9,6 +9,9 @@
     _aos_config(
         name = name,
         src = src,
+        config_json = name + ".json",
+        config_stripped = name + ".stripped.json",
+        config_binary = name + ".bfbs",
         deps = deps,
         flatbuffers = [expand_label(flatbuffer) + "_reflection_out" for flatbuffer in flatbuffers],
         visibility = visibility,
@@ -17,9 +20,9 @@
     )
 
 def _aos_config_impl(ctx):
-    config = ctx.actions.declare_file(ctx.label.name + ".json")
-    stripped_config = ctx.actions.declare_file(ctx.label.name + ".stripped.json")
-    binary_config = ctx.actions.declare_file(ctx.label.name + ".bfbs")
+    config = ctx.outputs.config_json
+    stripped_config = ctx.outputs.config_stripped
+    binary_config = ctx.outputs.config_binary
 
     flatbuffers_depset = depset(
         ctx.files.flatbuffers,
@@ -59,6 +62,9 @@
 
 _aos_config = rule(
     attrs = {
+        "config_json": attr.output(mandatory = True),
+        "config_stripped": attr.output(mandatory = True),
+        "config_binary": attr.output(mandatory = True),
         "_config_flattener": attr.label(
             executable = True,
             cfg = "host",
diff --git a/frc971/constants/testdata/BUILD b/frc971/constants/testdata/BUILD
index cdfb0c9..04cf8d3 100644
--- a/frc971/constants/testdata/BUILD
+++ b/frc971/constants/testdata/BUILD
@@ -24,7 +24,7 @@
 
 aos_config(
     name = "aos_config",
-    src = "aos_config.json",
+    src = "test_config.json",
     flatbuffers = [
         "//frc971/constants/testdata:constants_data_fbs",
         "//frc971/constants/testdata:constants_list_fbs",
diff --git a/frc971/constants/testdata/aos_config.json b/frc971/constants/testdata/test_config.json
similarity index 100%
rename from frc971/constants/testdata/aos_config.json
rename to frc971/constants/testdata/test_config.json