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
This commit is contained in:
Cole Faust
2021-10-25 16:02:37 -07:00
parent 76b0c499d0
commit 17cecd7b17

View File

@@ -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 {