Internalize our dependency on the Dart SDK

This patch teaches the flutter command to download the Dart SDK into
cache, removing another step from the Getting Started workflow. The
version of the Dart SDK is controlled by the "dart-sdk.version" file in
the bin/cache directory.

Fixes #54
This commit is contained in:
Adam Barth
2016-02-15 00:07:42 -08:00
parent cdc4055444
commit 94c5949c12
4 changed files with 61 additions and 11 deletions

View File

@@ -1,3 +1,4 @@
*.snapshot
*.stamp
artifacts
dart-sdk

1
bin/cache/dart-sdk.version vendored Normal file
View File

@@ -0,0 +1 @@
1.14.1

36
bin/cache/update_dart_sdk.sh vendored Executable file
View File

@@ -0,0 +1,36 @@
#!/bin/bash
# Copyright 2016 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
DART_SDK_PATH="$FLUTTER_ROOT/bin/cache/dart-sdk"
DART_SDK_STAMP_PATH="$FLUTTER_ROOT/bin/cache/dart-sdk.stamp"
DART_SDK_VERSION=`cat "$FLUTTER_ROOT/bin/cache/dart-sdk.version"`
if [ ! -f "$DART_SDK_STAMP_PATH" ] || [ "$DART_SDK_VERSION" != `cat "$DART_SDK_STAMP_PATH"` ]; then
echo Downloading Dart SDK $DART_SDK_VERSION...
case "$(uname -s)" in
Darwin)
DART_ZIP_NAME="dartsdk-macos-x64-release.zip"
;;
Linux)
DART_ZIP_NAME="dartsdk-linux-x64-release.zip"
;;
*)
echo "Unknown operating system. Cannot install Dart SDK."
exit 1
;;
esac
DART_SDK_URL="http://gsdview.appspot.com/dart-archive/channels/stable/raw/$DART_SDK_VERSION/sdk/$DART_ZIP_NAME"
rm -rf "$DART_SDK_PATH"
mkdir -p "$DART_SDK_PATH"
DART_SDK_ZIP="$FLUTTER_ROOT/bin/cache/dart-sdk.zip"
curl -C - --location -o "$DART_SDK_ZIP" "$DART_SDK_URL"
unzip -o -q "$DART_SDK_ZIP" -d "$FLUTTER_ROOT/bin/cache"
rm "$DART_SDK_ZIP"
echo $DART_SDK_VERSION > "$DART_SDK_STAMP_PATH"
fi