dist: allow dist_dir to be specified in BUILD files

... ahead of build time. This is less typing at execution time!

Also update docs for --dist_dir in the script.

Bug: 229268271
Test: run //common:kernel_aarch64_dist
Change-Id: I75a0da35734464a2fb7b0609890e24e83603ed83
diff --git a/dist/dist.bzl b/dist/dist.bzl
index ac21e21..52bc46f 100644
--- a/dist/dist.bzl
+++ b/dist/dist.bzl
@@ -71,7 +71,8 @@
         archives = None,
         flat = None,
         prefix = None,
-        archive_prefix = None):
+        archive_prefix = None,
+        dist_dir = None):
     """A dist rule to copy files out of Bazel's output directory into a custom location.
 
     Example:
@@ -79,6 +80,9 @@
     bazel run //path/to/my:dist_target -- --dist_dir=/tmp/dist
     ```
 
+    Run `bazel run //path/to/my:dist_target -- --help` for explanations of
+    options.
+
     Args:
         name: name of this rule
         data: A list of labels, whose outputs are copied to `--dist_dir`.
@@ -90,6 +94,11 @@
           to apply within dist_dir for copied files.
         archive_prefix: If specified, `--archive_prefix <prefix>` is provided to the script by
           default. Path prefix to apply within dist_dir for extracted archives.
+        dist_dir: If specified, `--dist_dir <dist_dir>` is provided to the script by default.
+
+          In particular, if this is a relative path, it is interpreted as a relative path
+          under workspace root when the target is executed with `bazel run`.
+          See details by running the target with `--help`.
     """
 
     default_args = []
@@ -99,6 +108,8 @@
         default_args += ["--prefix", prefix]
     if archive_prefix != None:
         default_args += ["--archive_prefix", archive_prefix]
+    if dist_dir != None:
+        default_args += ["--dist_dir", dist_dir]
 
     _generate_dist_manifest(
         name = name + "_dist_manifest",
diff --git a/dist/dist.py b/dist/dist.py
index 028105d..586a0df 100644
--- a/dist/dist.py
+++ b/dist/dist.py
@@ -95,7 +95,10 @@
     parser = argparse.ArgumentParser(
         description="Dist Bazel output files into a custom directory.")
     parser.add_argument(
-        "--dist_dir", required=True, help="absolute path to the dist dir")
+        "--dist_dir", required=True, help="""path to the dist dir.
+            If relative, it is interpreted as relative to Bazel workspace root
+            set by the BUILD_WORKSPACE_DIRECTORY environment variable, or
+            PWD if BUILD_WORKSPACE_DIRECTORY is not set.""")
     parser.add_argument(
         "--flat",
         action="store_true",