flutter.bat 1.78 KB
Newer Older
1
@ECHO off
Ian Hickson's avatar
Ian Hickson committed
2
REM Copyright 2014 The Flutter Authors. All rights reserved.
3 4 5
REM Use of this source code is governed by a BSD-style license that can be
REM found in the LICENSE file.

6 7 8
REM ---------------------------------- NOTE ----------------------------------
REM
REM Please keep the logic in this file consistent with the logic in the
9
REM `flutter` script in the same directory to ensure that Flutter & Dart continue to
10 11 12
REM work across all platforms!
REM
REM --------------------------------------------------------------------------
13 14 15 16

SETLOCAL ENABLEDELAYEDEXPANSION

FOR %%i IN ("%~dp0..") DO SET FLUTTER_ROOT=%%~fi
17

18 19 20 21
REM Include shared scripts in shared.bat
SET shared_bin=%FLUTTER_ROOT%/bin/internal/shared.bat
CALL "%shared_bin%"

22
SET flutter_tools_dir=%FLUTTER_ROOT%\packages\flutter_tools
23
SET cache_dir=%FLUTTER_ROOT%\bin\cache
24 25 26 27 28
SET snapshot_path=%cache_dir%\flutter_tools.snapshot
SET dart_sdk_path=%cache_dir%\dart-sdk
SET dart=%dart_sdk_path%\bin\dart.exe

REM To debug the tool, you can uncomment the following lines to enable checked mode and set an observatory port:
29
REM SET FLUTTER_TOOL_ARGS="--enable-asserts %FLUTTER_TOOL_ARGS%"
30

31 32
REM Chaining the call to 'dart' and 'exit' with an ampersand ensures that
REM Windows reads both commands into memory once before executing them. This
33
REM avoids nasty errors that may otherwise occur when the dart command (e.g. as
34 35 36 37 38
REM part of 'flutter upgrade') modifies this batch script while it is executing.
REM
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.
39
"%dart%" --disable-dart-dev --packages="%flutter_tools_dir%\.packages" %FLUTTER_TOOL_ARGS% "%snapshot_path%" %* & exit /B !ERRORLEVEL!
40 41 42

:final_exit
EXIT /B %exit_code%