Changeset 177741 in webkit
- Timestamp:
- Dec 25, 2014, 2:45:31 PM (11 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified trunk/Source/WebCore/ChangeLog ¶
r177739 r177741 1 2014-12-25 Dan Bernstein <mitz@apple.com> 2 3 Give extract-localizable-strings an option to treat warnings as errors 4 https://bugs.webkit.org/show_bug.cgi?id=139943 5 6 Reviewed by Darin Adler. 7 8 Add a --treat-warnings-as-errors option, which makes the script emit its warnings as errors 9 and exit with a non-0 return code if it emitted any warnings. 10 11 * extract-localizable-strings.pl: 12 Added $treatWarningsAsErrors variable, set to true if the option is passed in. 13 14 (emitWarning): Added. If $treatWarningsAsErrors is true, omits the "warning: " token from 15 the message, which makes it appear as an error in Xcode, and sets $sawError to 1. 16 17 Replaced all print statements that printed warnings with calls to emitWarning. 18 1 19 2014-12-25 Dan Bernstein <mitz@apple.com> 2 20 -
TabularUnified trunk/Source/WebCore/extract-localizable-strings.pl ¶
r165676 r177741 54 54 my $exceptionsFile; 55 55 my @directoriesToSkip = (); 56 my $treatWarningsAsErrors; 56 57 57 58 my %options = ( … … 59 60 'exceptions=s' => \$exceptionsFile, 60 61 'skip=s' => \@directoriesToSkip, 62 'treat-warnings-as-errors' => \$treatWarningsAsErrors, 61 63 ); 62 64 63 65 GetOptions(%options); 64 66 65 @ARGV >= 2 or die "Usage: extract-localizable-strings [--verify] [-- exceptions <exceptions file>] <file to update> [--skip directory | directory]...\nDid you mean to run update-webkit-localizable-strings instead?\n";67 @ARGV >= 2 or die "Usage: extract-localizable-strings [--verify] [--treat-warnings-as-errors] [--exceptions <exceptions file>] <file to update> [--skip directory | directory]...\nDid you mean to run update-webkit-localizable-strings instead?\n"; 66 68 67 69 -f $exceptionsFile or die "Couldn't find exceptions file $exceptionsFile\n" unless !defined $exceptionsFile; … … 91 93 my %usedException; 92 94 95 sub emitWarning($$$) 96 { 97 my ($file, $line, $message) = @_; 98 my $prefix = $treatWarningsAsErrors ? "" : "warning: "; 99 print "$file:$line: $prefix$message\n"; 100 $sawError = 1 if $treatWarningsAsErrors; 101 } 102 93 103 if (defined $exceptionsFile && open EXCEPTIONS, $exceptionsFile) { 94 104 while (<EXCEPTIONS>) { … … 96 106 if (/^"([^\\"]|\\.)*"$/ or /^[-_\/\w\s.]+.(h|m|mm|c|cpp)$/ or /^[-_\/\w\s.]+.(h|m|mm|c|cpp):"([^\\"]|\\.)*"$/) { 97 107 if ($exception{$_}) { 98 print "$exceptionsFile:$.: warning: exception for $_ appears twice\n";99 print "$exceptionsFile:$exception{$_}: warning: first appearance\n";108 emitWarning($exceptionsFile, $., "exception for $_ appears twice"); 109 emitWarning($exceptionsFile, $exception{$_}, "first appearance"); 100 110 } else { 101 111 $exception{$_} = $.; 102 112 } 103 113 } else { 104 print "$exceptionsFile:$.: warning: syntax error\n";114 emitWarning($exceptionsFile, $., "syntax error"); 105 115 } 106 116 } … … 205 215 $usedException{"$file:\"$string\""} = 1; 206 216 } else { 207 print "$file:$stringLine: warning: \"$string\" is not marked for localization\n"if $warnAboutUnlocalizedStrings;217 emitWarning($file, $stringLine, "\"$string\" is not marked for localization") if $warnAboutUnlocalizedStrings; 208 218 $notLocalizedCount++; 209 219 } … … 344 354 345 355 if ($stringByKey{$key} && $stringByKey{$key} ne $string) { 346 print "$file:$line: warning: encountered the same key, \"$key\", twice, with different strings\n";347 print "$fileByKey{$key}:$lineByKey{$key}: warning: previous occurrence\n";356 emitWarning($file, $line, "encountered the same key, \"$key\", twice, with different strings"); 357 emitWarning($fileByKey{$key}, $lineByKey{$key}, "previous occurrence"); 348 358 $keyCollisionCount++; 349 359 return; 350 360 } 351 361 if ($commentByKey{$key} && $commentByKey{$key} ne $comment) { 352 print "$file:$line: warning: encountered the same key, \"$key\", twice, with different comments\n";353 print "$fileByKey{$key}:$lineByKey{$key}: warning: previous occurrence\n";362 emitWarning($file, $line, "encountered the same key, \"$key\", twice, with different comments"); 363 emitWarning($fileByKey{$key}, $lineByKey{$key}, "previous occurrence"); 354 364 $keyCollisionCount++; 355 365 return; … … 367 377 if (@unusedExceptions) { 368 378 for my $unused (@unusedExceptions) { 369 print "$exceptionsFile:$exception{$unused}: warning: exception $unused not used\n";379 emitWarning($exceptionsFile, $exception{$unused}, "exception $unused not used"); 370 380 } 371 381 print "\n";
Note:
See TracChangeset
for help on using the changeset viewer.