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/defs.bzl b/metropolis/cli/metroctl/defs.bzl
new file mode 100644
index 0000000..ce75195
--- /dev/null
+++ b/metropolis/cli/metroctl/defs.bzl
@@ -0,0 +1,19 @@
+BuildKindProvider = provider(fields = ['type'])
+
+def _impl(ctx):
+    values = ['full', 'lite'] 
+    value = ctx.build_setting_value
+    if value not in values:
+        fail(str(ctx.label) + " build setting allowed to take values {full, lite} but was set to " + value)
+
+    return BuildKindProvider(type = value)
+
+buildkind = rule(
+    implementation = _impl,
+    build_setting = config.string(flag = True),
+    doc = """
+        Build kind for userspace tools, either full (will have a direct
+        dependency on data files) or lite (will not have a direct dependency on
+        data files and will not attempt to load them).
+    """,
+)