m/cli/metroctl: implement buildkind=lite
Users can now build metroctl with:
bazel build //metropolis/cli/metroctl --//metropolis/cli/metrocli:buildkind=lite
To request a metroctl built without a direct dependency on the rest of
Metropolis. Such a metroctl tool will not be able to run `genusb`
without manually specifying a metropolis bundle and metropolis installer
kernel.
Change-Id: Ic8c135392a7d0ec3120e5dbed8fd6636de578633
Reviewed-on: https://review.monogon.dev/c/monogon/+/1947
Tested-by: Jenkins CI
Reviewed-by: Lorenz Brun <lorenz@monogon.tech>
diff --git a/metropolis/cli/metroctl/BUILD.bazel b/metropolis/cli/metroctl/BUILD.bazel
index 960c220..f013c42 100644
--- a/metropolis/cli/metroctl/BUILD.bazel
+++ b/metropolis/cli/metroctl/BUILD.bazel
@@ -1,4 +1,18 @@
load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library", "go_test")
+load(":defs.bzl", "buildkind")
+
+buildkind(
+ name = "buildkind",
+ build_setting_default = "full",
+)
+
+# True if user requested a lite build via --//metropolis/cli/metroctl:buildkind=lite .
+config_setting(
+ name = "buildkind_lite",
+ flag_values = {
+ ":buildkind": "lite",
+ },
+)
go_library(
name = "metroctl_lib",
@@ -17,10 +31,13 @@
"table.go",
"table_node.go",
],
- data = [
- "//metropolis/installer:kernel", #keep
- "//metropolis/node:bundle",
- ],
+ data = select({
+ ":buildkind_lite": [],
+ "//conditions:default": [
+ "//metropolis/installer:kernel",
+ "//metropolis/node:bundle",
+ ],
+ }),
importpath = "source.monogon.dev/metropolis/cli/metroctl",
visibility = ["//visibility:private"],
deps = [