|
| 1 | +@ECHO off |
| 2 | +REM Copyright 2014 The Flutter Authors. All rights reserved. |
| 3 | +REM Use of this source code is governed by a BSD-style license that can be |
| 4 | +REM found in the LICENSE file. |
| 5 | + |
| 6 | +REM ---------------------------------- NOTE ---------------------------------- |
| 7 | +REM |
| 8 | +REM Please keep the logic in this file consistent with the logic in the |
| 9 | +REM `flutter-dev` script in the same directory to ensure that Flutter & Dart |
| 10 | +REM continue to work across all platforms! |
| 11 | +REM |
| 12 | +REM -------------------------------------------------------------------------- |
| 13 | + |
| 14 | +SETLOCAL |
| 15 | + |
| 16 | +REM This is a helper script for development purposes. It runs the Flutter tool |
| 17 | +REM from source code directly, without using the prebuilt snapshot. This is |
| 18 | +REM useful for development, as it allows you to make changes to the tool and see |
| 19 | +REM the effects immediately, but is much slower than using the prebuilt snapshot. |
| 20 | + |
| 21 | +REM To debug the tool, you can uncomment the following line to enable debug mode: |
| 22 | +REM SET FLUTTER_TOOL_ARGS="--enable-asserts %FLUTTER_TOOL_ARGS%" |
| 23 | + |
| 24 | +FOR %%i IN ("%~dp0..") DO SET FLUTTER_ROOT=%%~fi |
| 25 | + |
| 26 | +REM If available, add location of bundled mingit to PATH |
| 27 | +SET mingit_path=%FLUTTER_ROOT%\bin\mingit\cmd |
| 28 | +IF EXIST "%mingit_path%" SET PATH=%PATH%;%mingit_path% |
| 29 | + |
| 30 | +REM We test if Git is available on the Host as we run git in shared.bat |
| 31 | +REM Test if the flutter directory is a git clone, otherwise git rev-parse HEAD would fail |
| 32 | +IF NOT EXIST "%flutter_root%\.git" ( |
| 33 | + ECHO Error: The Flutter directory is not a clone of the GitHub project. |
| 34 | + ECHO The flutter tool requires Git in order to operate properly; |
| 35 | + ECHO to set up Flutter, run the following command: |
| 36 | + ECHO git clone -b stable https://github.com/flutter/flutter.git |
| 37 | + EXIT 1 |
| 38 | +) |
| 39 | + |
| 40 | +REM Include shared scripts in shared.bat |
| 41 | +SET shared_bin=%FLUTTER_ROOT%\bin\internal\shared.bat |
| 42 | +CALL "%shared_bin%" |
| 43 | + |
| 44 | +SET flutter_tools_dir=%FLUTTER_ROOT%\packages\flutter_tools |
| 45 | +SET cache_dir=%FLUTTER_ROOT%\bin\cache |
| 46 | +SET script_path=%flutter_tools_dir%\bin\flutter_tools.dart |
| 47 | +SET dart_sdk_path=%cache_dir%\dart-sdk |
| 48 | +SET dart=%dart_sdk_path%\bin\dart.exe |
| 49 | + |
| 50 | +SET exit_with_errorlevel=%FLUTTER_ROOT%/bin/internal/exit_with_errorlevel.bat |
| 51 | + |
| 52 | +REM Chaining the call to 'dart' and 'exit' with an ampersand ensures that |
| 53 | +REM Windows reads both commands into memory once before executing them. This |
| 54 | +REM avoids nasty errors that may otherwise occur when the dart command (e.g. as |
| 55 | +REM part of 'flutter upgrade') modifies this batch script while it is executing. |
| 56 | +REM |
| 57 | +REM Do not use the CALL command in the next line to execute Dart. CALL causes |
| 58 | +REM Windows to re-read the line from disk after the CALL command has finished |
| 59 | +REM regardless of the ampersand chain. |
| 60 | +"%dart%" run --resident --packages="%flutter_tools_dir%\.dart_tool\package_config.json" %FLUTTER_TOOL_ARGS% "%script_path%" %* & "%exit_with_errorlevel%" |
0 commit comments