diff --git a/rust/private/rustdoc.bzl b/rust/private/rustdoc.bzl
index 3213e20f04..54b024505b 100644
--- a/rust/private/rustdoc.bzl
+++ b/rust/private/rustdoc.bzl
@@ -119,15 +119,16 @@ def _zip_action(ctx, input_dir, output_zip):
output_zip (File): The location of the output archive containing generated documentation
"""
args = ctx.actions.args()
-
- # Create but not compress.
- args.add("c", output_zip)
+ args.add(ctx.executable._zipper)
+ args.add(output_zip)
+ args.add(ctx.bin_dir.path)
args.add_all([input_dir], expand_directories = True)
ctx.actions.run(
- executable = ctx.executable._zipper,
+ executable = ctx.executable._dir_zipper,
inputs = [input_dir],
outputs = [output_zip],
arguments = [args],
+ tools = [ctx.executable._zipper],
)
rust_doc = rule(
@@ -159,6 +160,11 @@ rust_doc = rule(
doc = "File to add in `
`, after content.",
allow_single_file = [".html", ".md"],
),
+ "_dir_zipper": attr.label(
+ default = Label("//util/dir_zipper"),
+ cfg = "exec",
+ executable = True,
+ ),
"_zipper": attr.label(
default = Label("@bazel_tools//tools/zip:zipper"),
cfg = "exec",
diff --git a/util/dir_zipper/BUILD b/util/dir_zipper/BUILD
new file mode 100644
index 0000000000..f8d7eb2f64
--- /dev/null
+++ b/util/dir_zipper/BUILD
@@ -0,0 +1,8 @@
+load("//rust:rust.bzl", "rust_binary")
+
+rust_binary(
+ name = "dir_zipper",
+ srcs = ["dir_zipper.rs"],
+ edition = "2018",
+ visibility = ["//visibility:public"],
+)
diff --git a/util/dir_zipper/dir_zipper.rs b/util/dir_zipper/dir_zipper.rs
new file mode 100644
index 0000000000..fbc4938e2a
--- /dev/null
+++ b/util/dir_zipper/dir_zipper.rs
@@ -0,0 +1,77 @@
+use std::ffi::OsString;
+use std::path::PathBuf;
+use std::process::Command;
+
+const USAGE: &str = r#"usage: dir_zipper