dist: embed args and env

Make the top target for copy_to_dist_dir to be
an embedded_exec rule, so it doesn't have args
and env.

Test: TH
Bug: 228560650

Change-Id: Ic6a1937e7eff68383a581b063c26bfb8bb556605
diff --git a/dist/BUILD b/dist/BUILD
index d275dec..e956a31 100644
--- a/dist/BUILD
+++ b/dist/BUILD
@@ -5,17 +5,19 @@
 
 bzl_library(
     name = "dist",
-    srcs = ["dist.bzl"] + [
+    srcs = ["dist.bzl"],
+    visibility = ["//visibility:public"],
+    deps = [
+        "//build/bazel_common_rules/exec:embedded_exec",
         "@bazel_skylib//rules:copy_file",
     ],
-    visibility = ["//visibility:public"],
 )
 
 # bazel run --package_path=out/soong/workspace //build/bazel_common_rules/dist:dist_bionic_example -- --dist_dir=/tmp/dist
 copy_to_dist_dir(
     name = "dist_bionic_example",
     data = [
-        "//bionic/libc:libc",
-        "//bionic/libdl:libdl",
+        "//bionic/libc",
+        "//bionic/libdl",
     ],
 )
diff --git a/dist/dist.bzl b/dist/dist.bzl
index 2b11f81..53a98a0 100644
--- a/dist/dist.bzl
+++ b/dist/dist.bzl
@@ -2,6 +2,7 @@
 # the standard Bazel output user root.
 
 load("@bazel_skylib//rules:copy_file.bzl", "copy_file")
+load("//build/bazel_common_rules/exec:embedded_exec.bzl", "embedded_exec")
 
 def _label_list_to_manifest(lst):
     """Convert the outputs of a label list to manifest content."""
@@ -117,7 +118,7 @@
     # dist_manifest so that the runfiles directory is the same, and that the
     # dist_manifest is in the data runfiles of the dist tool.
     native.py_binary(
-        name = name,
+        name = name + "_internal",
         main = name + "_dist.py",
         srcs = [name + "_dist.py"],
         python_version = "PY3",
@@ -125,3 +126,8 @@
         data = [name + "_dist_manifest"],
         args = default_args,
     )
+
+    embedded_exec(
+        name = name,
+        actual = name + "_internal",
+    )