summaryrefslogtreecommitdiff
path: root/zip/cmd/main.go
diff options
context:
space:
mode:
author Dan Albert <danalbert@google.com> 2023-07-13 17:41:04 +0000
committer Dan Albert <danalbert@google.com> 2023-07-13 18:45:32 +0000
commit1cec6d5000a1640f27eed162d2727bb33290f25c (patch)
tree0ba184f6de06fd3d58de4313f174b6a76e8a505a /zip/cmd/main.go
parent2c59e460348952549d32334b95fc37e42542de7e (diff)
Add flag to skip writing output from soong_zip.
We want to measure how much of build time is spent on writing large zips to disk. We can do this by doing the rest of the work but skipping the write itself. Some local and trivial testing shows this is probably a lot of the cost of these rules: $ python -m timeit -s "import os" -r 10 "os.system('soong_zip -write_if_changed -o foo.zip -D prebuilts/sdk')" 1 loop, best of 10: 8.37 sec per loop $ python -m timeit -s "import os" -r 10 "os.system('soong_zip -o foo.zip -D prebuilts/sdk')" 1 loop, best of 10: 5.39 sec per loop $ python -m timeit -s "import os" -r 10 "os.system('soong_zip -n -o foo.zip -D prebuilts/sdk')" 1 loop, best of 10: 3.66 sec per loop Bug: None Test: treehugger Change-Id: I43acdb08d0e00efaba9e5d7add972a7ec41646d2
Diffstat (limited to 'zip/cmd/main.go')
-rw-r--r--zip/cmd/main.go2
1 files changed, 2 insertions, 0 deletions
diff --git a/zip/cmd/main.go b/zip/cmd/main.go
index a2ccc2011..5231faec9 100644
--- a/zip/cmd/main.go
+++ b/zip/cmd/main.go
@@ -173,6 +173,7 @@ func main() {
cpuProfile := flags.String("cpuprofile", "", "write cpu profile to file")
traceFile := flags.String("trace", "", "write trace to file")
sha256Checksum := flags.Bool("sha256", false, "add a zip header to each file containing its SHA256 digest")
+ doNotWrite := flags.Bool("n", false, "Nothing is written to disk -- all other work happens")
flags.Var(&rootPrefix{}, "P", "path prefix within the zip at which to place files")
flags.Var(&listFiles{}, "l", "file containing list of files to zip")
@@ -236,6 +237,7 @@ func main() {
StoreSymlinks: *symlinks,
IgnoreMissingFiles: *ignoreMissingFiles,
Sha256Checksum: *sha256Checksum,
+ DoNotWrite: *doNotWrite,
})
if err != nil {
fmt.Fprintln(os.Stderr, "error:", err.Error())