Merge "Add -quiet option in soong_zip" into main am: 132fd39897

Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2749440

Change-Id: Idd8c1590d83fa9877e01cda4da9afa7f6ac979d7
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Treehugger Robot 2023-09-13 02:59:50 +00:00 committed by Automerger Merge Worker
commit 0fa39b7c73
2 changed files with 12 additions and 3 deletions

View file

@ -174,6 +174,7 @@ func main() {
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")
quiet := flags.Bool("quiet", false, "do not print warnings to console")
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")
@ -238,6 +239,7 @@ func main() {
IgnoreMissingFiles: *ignoreMissingFiles,
Sha256Checksum: *sha256Checksum,
DoNotWrite: *doNotWrite,
Quiet: *quiet,
})
if err != nil {
fmt.Fprintln(os.Stderr, "error:", err.Error())

View file

@ -283,6 +283,7 @@ type ZipArgs struct {
IgnoreMissingFiles bool
Sha256Checksum bool
DoNotWrite bool
Quiet bool
Stderr io.Writer
Filesystem pathtools.FileSystem
@ -340,7 +341,9 @@ func zipTo(args ZipArgs, w io.Writer) error {
Err: os.ErrNotExist,
}
if args.IgnoreMissingFiles {
fmt.Fprintln(z.stderr, "warning:", err)
if !args.Quiet {
fmt.Fprintln(z.stderr, "warning:", err)
}
} else {
return err
}
@ -357,7 +360,9 @@ func zipTo(args ZipArgs, w io.Writer) error {
Err: os.ErrNotExist,
}
if args.IgnoreMissingFiles {
fmt.Fprintln(z.stderr, "warning:", err)
if !args.Quiet {
fmt.Fprintln(z.stderr, "warning:", err)
}
} else {
return err
}
@ -368,7 +373,9 @@ func zipTo(args ZipArgs, w io.Writer) error {
Err: syscall.ENOTDIR,
}
if args.IgnoreMissingFiles {
fmt.Fprintln(z.stderr, "warning:", err)
if !args.Quiet {
fmt.Fprintln(z.stderr, "warning:", err)
}
} else {
return err
}