Simplify scouting bundle
The `babel()` rule dumps its outputs into a directory without telling
bazel about what files are in that directory. That means other rules
are forced to interact with the directory instead of the actual file
we're interested in.
This patch adds a `genrule()` to copy the one file we care about out
of that problematic directory. This lets other rules easily interact
with that one file.
Signed-off-by: Philipp Schrader <philipp.schrader@gmail.com>
Change-Id: I46233dd47f4bfdc77dfe562e95a0adab20aa20c5
diff --git a/scouting/www/BUILD b/scouting/www/BUILD
index e33416b..aba70bf 100644
--- a/scouting/www/BUILD
+++ b/scouting/www/BUILD
@@ -53,7 +53,17 @@
"@npm//@angular/compiler-cli",
],
output_dir = True,
- visibility = ["//visibility:public"],
+)
+
+# The babel() rule above puts everything into a directory without telling bazel
+# what's in the directory. That makes it annoying to work with from other
+# rules. This genrule() here copies the one file in the directory we care about
+# so that other rules have an easier time using the file.
+genrule(
+ name = "main_bundle_file",
+ srcs = [":main_bundle_compiled"],
+ outs = ["main_bundle_file.js"],
+ cmd = "cp $(location :main_bundle_compiled)/main_bundle.js $(OUTS)",
)
# Create a copy of zone.js here so that we can have a predictable path to
@@ -84,6 +94,7 @@
srcs = [
"index.html",
":field_pictures_copy",
+ ":main_bundle_file.js",
":zonejs_copy",
],
visibility = ["//visibility:public"],