From 17cecd7b17fdc403f7d73c4935e6f7945b418c16 Mon Sep 17 00:00:00 2001 From: Cole Faust Date: Mon, 25 Oct 2021 16:02:37 -0700 Subject: [PATCH] Enable mk2rbc warnings/errors by default Since we are going to be asking partners to start ensuring that their makefiles work with mk2rbc, enable warnings by default so they're more visible. Otherwise, the conversion could appear to succeed but have some subtle failures. Bug: 204062171 Test: Manually Change-Id: I38189031d7357bb3f2c811de90f2821cde10cbcd --- mk2rbc/cmd/mk2rbc.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/mk2rbc/cmd/mk2rbc.go b/mk2rbc/cmd/mk2rbc.go index 25507d2d6..0f030d3ea 100644 --- a/mk2rbc/cmd/mk2rbc.go +++ b/mk2rbc/cmd/mk2rbc.go @@ -46,7 +46,7 @@ var ( dryRun = flag.Bool("dry_run", false, "dry run") recurse = flag.Bool("convert_dependents", false, "convert all dependent files") mode = flag.String("mode", "", `"backup" to back up existing files, "write" to overwrite them`) - warn = flag.Bool("warnings", false, "warn about partially failed conversions") + noWarn = flag.Bool("no_warnings", false, "don't warn about partially failed conversions") verbose = flag.Bool("v", false, "print summary") errstat = flag.Bool("error_stat", false, "print error statistics") traceVar = flag.String("trace", "", "comma-separated list of variables to trace") @@ -75,7 +75,7 @@ func init() { flagAlias("root", "d") flagAlias("dry_run", "n") flagAlias("convert_dependents", "r") - flagAlias("warnings", "w") + flagAlias("no_warnings", "w") flagAlias("error_stat", "e") } @@ -336,7 +336,7 @@ func convertOne(mkFile string) (ok bool) { OutputSuffix: *suffix, TracedVariables: tracedVariables, TraceCalls: *traceCalls, - WarnPartialSuccess: *warn, + WarnPartialSuccess: !*noWarn, SourceFS: os.DirFS(*rootDir), MakefileFinder: makefileFinder, } @@ -419,7 +419,7 @@ func writeGenerated(path string, contents string) error { func printStats() { var sortedFiles []string - if !*warn && !*verbose { + if *noWarn && !*verbose { return } for p := range converted { @@ -437,7 +437,7 @@ func printStats() { nOk++ } } - if *warn { + if !*noWarn { if nPartial > 0 { fmt.Fprintf(os.Stderr, "Conversion was partially successful for:\n") for _, f := range sortedFiles {