mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
This converts the ci/format.sh script to a Dart script that uses process_runner and isolates to multi-process the clang-format, diffs, and grepping needed to do the formatting changes. It also will (by default) only check the formatting of changed files. The user can optionally check all files (--all-files) or do only some types of checks with --check. --verbose prints the versions of the tools used for Clang format and Java format. Specifying --fix will cause any formatting errors that would have been detected to be fixed.
33 lines
1.2 KiB
Batchfile
33 lines
1.2 KiB
Batchfile
@ECHO off
|
|
REM Copyright 2013 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.
|
|
|
|
REM ---------------------------------- NOTE ----------------------------------
|
|
REM
|
|
REM Please keep the logic in this file consistent with the logic in the
|
|
REM `format.sh` script in the same directory to ensure that it continues to
|
|
REM work across all platforms!
|
|
REM
|
|
REM --------------------------------------------------------------------------
|
|
|
|
SETLOCAL ENABLEDELAYEDEXPANSION
|
|
|
|
FOR %%i IN ("%~dp0..\..") DO SET SRC_DIR=%%~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 repo_dir=%SRC_DIR%\flutter
|
|
SET ci_dir=%repo_dir%\flutter\ci
|
|
SET dart_sdk_path=%SRC_DIR%\third_party\dart\tools\sdks\dart-sdk
|
|
SET dart=%dart_sdk_path%\bin\dart.exe
|
|
SET pub=%dart_sdk_path%\bin\pub.bat
|
|
|
|
cd "%ci_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.
|
|
"%pub%" get & "%dart%" --disable-dart-dev bin\format.dart %* & exit /B !ERRORLEVEL!
|