diff options
author | 2017-11-10 13:11:02 -0800 | |
---|---|---|
committer | 2017-11-13 15:11:08 -0800 | |
commit | f83c150269c933ab6b384cf5e28cbf021a6ba9e1 (patch) | |
tree | 4dd3bfdc537d90f340badafce5233327ee7480b3 /zip/cmd/main.go | |
parent | 5e6cfbead9f4a24b5807e35a9783a8630ede0d35 (diff) |
Add --write_if_changed argument to soong_zip
Simplify making restat rules by adding a --write_if_changed argument
to soong_zip that generates the output file into memory and then
compares it to the version on disk before writing it out.
Test: builds
Change-Id: I5059a1e3a11e79b0ca538b3b829bc7479c126ce6
Diffstat (limited to 'zip/cmd/main.go')
-rw-r--r-- | zip/cmd/main.go | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/zip/cmd/main.go b/zip/cmd/main.go index 348728c25..c0418f7b5 100644 --- a/zip/cmd/main.go +++ b/zip/cmd/main.go @@ -120,14 +120,15 @@ func (d *dir) Set(s string) error { } var ( - out = flag.String("o", "", "file to write zip file to") - manifest = flag.String("m", "", "input jar manifest file name") - directories = flag.Bool("d", false, "include directories in zip") - rootPrefix = flag.String("P", "", "path prefix within the zip at which to place files") - relativeRoot = flag.String("C", "", "path to use as relative root of files in following -f, -l, or -D arguments") - parallelJobs = flag.Int("j", runtime.NumCPU(), "number of parallel threads to use") - compLevel = flag.Int("L", 5, "deflate compression level (0-9)") - emulateJar = flag.Bool("jar", false, "modify the resultant .zip to emulate the output of 'jar'") + out = flag.String("o", "", "file to write zip file to") + manifest = flag.String("m", "", "input jar manifest file name") + directories = flag.Bool("d", false, "include directories in zip") + rootPrefix = flag.String("P", "", "path prefix within the zip at which to place files") + relativeRoot = flag.String("C", "", "path to use as relative root of files in following -f, -l, or -D arguments") + parallelJobs = flag.Int("j", runtime.NumCPU(), "number of parallel threads to use") + compLevel = flag.Int("L", 5, "deflate compression level (0-9)") + emulateJar = flag.Bool("jar", false, "modify the resultant .zip to emulate the output of 'jar'") + writeIfChanged = flag.Bool("write_if_changed", false, "only update resultant .zip if it has changed") fArgs zip.FileArgs nonDeflatedFiles = make(uniqueSet) @@ -163,6 +164,7 @@ func main() { ManifestSourcePath: *manifest, NumParallelJobs: *parallelJobs, NonDeflatedFiles: nonDeflatedFiles, + WriteIfChanged: *writeIfChanged, }) if err != nil { fmt.Fprintln(os.Stderr, err.Error()) |