Fix the dry run mode of the GN format checker script (flutter/engine#13406)

This commit is contained in:
Jason Simmons 2019-10-29 10:53:52 -07:00 committed by GitHub
parent 2c61d2336b
commit 5b8bb12621
2 changed files with 4 additions and 5 deletions

View File

@ -25,7 +25,7 @@ def main():
parser = argparse.ArgumentParser();
parser.add_argument('--gn-binary', dest='gn_binary', required=True, type=str)
parser.add_argument('--dry-run', dest='dry_run', default=True, type=str)
parser.add_argument('--dry-run', dest='dry_run', default=False, action='store_true')
parser.add_argument('--root-directory', dest='root_directory', required=True, type=str)
args = parser.parse_args()
@ -35,16 +35,15 @@ def main():
gn_command = [ gn_binary, 'format']
if args.dry_run == 'false':
if args.dry_run:
gn_command.append('--dry-run')
for gn_file in GetGNFiles(args.root_directory):
if subprocess.call(gn_command + [ gn_file ]) != 0:
print "ERROR: '%s' is incorrectly formatted." % os.path.relpath(gn_file, args.root_directory)
print "Format the same with 'gn format' using the 'gn' binary in //buildtools."
print "Or, run ./ci/check_gn_format.py with '--dry-run false'"
return -1
return 1
return 0

View File

@ -75,4 +75,4 @@ if [[ ! -z "$TRAILING_SPACES" ]]; then
fi
# Check GN format consistency
./ci/check_gn_format.py --dry-run true --root-directory . --gn-binary "third_party/gn/gn"
./ci/check_gn_format.py --dry-run --root-directory . --gn-binary "third_party/gn/gn"