Merge "dist: revise how default args works." am: c1bfbb77e1 am: 058e15ae3b am: 15e8e4c210 am: c9932de32f

Original change: https://android-review.googlesource.com/c/platform/build/bazel_common_rules/+/2064608

Change-Id: Iab2e8621bdc4b8a38d7f7d3bdd7121ffb2d88ddc
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
diff --git a/dist/dist.bzl b/dist/dist.bzl
index 52bc46f..2b11f81 100644
--- a/dist/dist.bzl
+++ b/dist/dist.bzl
@@ -26,17 +26,10 @@
         content = dist_archives_manifest_content,
     )
 
-    default_args_manifest = ctx.actions.declare_file(ctx.attr.name + "_default_args.txt")
-    ctx.actions.write(
-        output = default_args_manifest,
-        content = "\n".join(ctx.attr.default_args),
-    )
-
     # Create the runfiles object.
     runfiles = ctx.runfiles(files = all_dist_files + all_dist_archives + [
         dist_manifest,
         dist_archives_manifest,
-        default_args_manifest,
     ])
 
     return [DefaultInfo(runfiles = runfiles)]
@@ -59,9 +52,6 @@
 In the case of targets, the rule copies the list of `files` from the target's DefaultInfo provider.
 """,
         ),
-        "default_args": attr.string_list(
-            doc = "Default arguments provided to the script.",
-        ),
     },
 )
 
@@ -115,7 +105,6 @@
         name = name + "_dist_manifest",
         data = data,
         archives = archives,
-        default_args = default_args,
     )
 
     copy_file(
@@ -134,4 +123,5 @@
         python_version = "PY3",
         visibility = ["//visibility:public"],
         data = [name + "_dist_manifest"],
+        args = default_args,
     )
diff --git a/dist/dist.py b/dist/dist.py
index 586a0df..c6d3f13 100644
--- a/dist/dist.py
+++ b/dist/dist.py
@@ -111,11 +111,7 @@
         help="Path prefix to apply within dist_dir for extracted archives. " +
              "Supported archives: tar.")
 
-    default_args = files_to_dist("*_default_args.txt")
-    argv = default_args + sys.argv[1:]
-    if default_args:
-        print("[dist] args: {}".format(" ".join(argv)))
-    args = parser.parse_args(argv)
+    args = parser.parse_args(sys.argv[1:])
 
     if not os.path.isabs(args.dist_dir):
         # BUILD_WORKSPACE_DIRECTORY is the root of the Bazel workspace containing