mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
Fix the dry run mode of the GN format checker script (flutter/engine#13406)
This commit is contained in:
parent
2c61d2336b
commit
5b8bb12621
@ -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
|
||||
|
||||
|
||||
@ -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"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user