Launch Flutter Tools on Windows. (#7613)

This brings the Windows script up to par with the Linux/Mac script.

`flutter doctor` works.

There are two scripts (`bin/flutter` and `bin/internal/update_dart-sdk`), which are platform dependent (bash script on Linux/Max, PowerShell script on Windows) and we need to keep an eye on making sure that their logic stays in sync. Both scripts are rather simple and I am not expecting many changes to them. I also made sure that both versions follow the same structure to make it easier to keep them consistent.

Required for https://github.com/flutter/flutter/issues/138
This commit is contained in:
Michael Goderbauer
2017-01-24 10:58:11 -08:00
committed by GitHub
parent 6a612caa50
commit 51dc83dd80
5 changed files with 140 additions and 154 deletions

View File

@@ -3,6 +3,15 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# ---------------------------------- NOTE ---------------------------------- #
#
# Please keep the logic in this file consistent with the logic in the
# `flutter.ps1` script in the same directory to ensure that Flutter continues
# to work across all platforms!
#
# -------------------------------------------------------------------------- #
set -e
function follow_links() {
@@ -35,6 +44,18 @@ SCRIPT_PATH="$FLUTTER_TOOLS_DIR/bin/flutter_tools.dart"
DART_SDK_PATH="$FLUTTER_ROOT/bin/cache/dart-sdk"
DART="$DART_SDK_PATH/bin/dart"
PUB="$DART_SDK_PATH/bin/pub"
# Test if Git is available on the Host
if ! hash git 2>/dev/null; then
echo "Error: Unable to find git in your PATH."
exit 1
fi
# Test if the flutter directory is a git clone (otherwise git rev-parse HEAD would fail)
if [ ! -d "$FLUTTER_ROOT/.git" ]; then
echo "Error: The Flutter directory is not a clone of the GitHub project."
exit 1
fi
# To debug the tool, you can uncomment the following line to enable checked mode and set an observatory port:
# FLUTTER_TOOL_ARGS="--observe=65432 --checked"
@@ -51,8 +72,7 @@ DART="$DART_SDK_PATH/bin/dart"
"$FLUTTER_ROOT/bin/internal/update_dart_sdk.sh"
echo Building flutter tool...
FLUTTER_DIR="$FLUTTER_ROOT/packages/flutter"
(cd "$FLUTTER_TOOLS_DIR"; rm -f pubspec.lock; "../../bin/cache/dart-sdk/bin/pub" get --verbosity=error --no-packages-dir)
(cd "$FLUTTER_TOOLS_DIR"; rm -f pubspec.lock; "$PUB" get --verbosity=error --no-packages-dir)
"$DART" --snapshot="$SNAPSHOT_PATH" --packages="$FLUTTER_TOOLS_DIR/.packages" "$SCRIPT_PATH"
echo $REVISION > "$STAMP_PATH"
fi