Add script to check format of changed dart files (#160007)
The script is modeled after a similar script in the engine (see engine's [format.dart](https://github.com/flutter/engine/blob/main/ci/bin/format.dart)). It identifies the files that have been changed and checks if their formatting is correct. It also offers an option to correct formatting (`--fix`) and an option to check the formatting of all files in the repro (not just changed ones, `--all-files`). When we are enforcing dart format this script will be called as part of presubmit.
This commit is contained in:
committed by
GitHub
parent
2f9e2d9bc9
commit
c4dc2c9890
22
dev/tools/format.bat
Normal file
22
dev/tools/format.bat
Normal file
@@ -0,0 +1,22 @@
|
||||
@ECHO off
|
||||
REM Copyright 2014 The Flutter Authors. All rights reserved.
|
||||
REM Use of this source code is governed by a BSD-style license that can be
|
||||
REM found in the LICENSE file.
|
||||
|
||||
SETLOCAL ENABLEDELAYEDEXPANSION
|
||||
|
||||
FOR %%i IN ("%~dp0..\..") DO SET FLUTTER_ROOT=%%~fi
|
||||
|
||||
REM Test if Git is available on the Host
|
||||
where /q git || ECHO Error: Unable to find git in your PATH. && EXIT /B 1
|
||||
|
||||
SET tools_dir=%FLUTTER_ROOT%\dev\tools
|
||||
|
||||
SET dart=%FLUTTER_ROOT%\bin\dart.bat
|
||||
|
||||
cd "%tools_dir%"
|
||||
|
||||
REM Do not use the CALL command in the next line to execute Dart. CALL causes
|
||||
REM Windows to re-read the line from disk after the CALL command has finished
|
||||
REM regardless of the ampersand chain.
|
||||
"%dart%" pub get > NUL && "%dart%" "%tools_dir%\bin\format.dart" %* & exit /B !ERRORLEVEL!
|
||||
Reference in New Issue
Block a user