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:
committed by
GitHub
parent
6a612caa50
commit
51dc83dd80
40
bin/internal/update_dart_sdk.ps1
Normal file
40
bin/internal/update_dart_sdk.ps1
Normal file
@@ -0,0 +1,40 @@
|
||||
# Copyright 2017 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.
|
||||
|
||||
|
||||
# ---------------------------------- NOTE ---------------------------------- #
|
||||
#
|
||||
# Please keep the logic in this file consistent with the logic in the
|
||||
# `update_dart_sdk.sh` script in the same directory to ensure that Flutter
|
||||
# continues to work across all platforms!
|
||||
#
|
||||
# -------------------------------------------------------------------------- #
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
||||
$progName = split-path -parent $MyInvocation.MyCommand.Definition
|
||||
$flutterRoot = (get-item $progName ).parent.parent.FullName
|
||||
|
||||
$dartSdkPath = "$flutterRoot\bin\cache\dart-sdk"
|
||||
$dartSdkStampPath = "$flutterRoot\bin\cache\dart-sdk.stamp"
|
||||
$dartSdkVersion = (Get-Content "$flutterRoot\bin\internal\dart-sdk.version")
|
||||
|
||||
if ((Test-Path $dartSdkStampPath) -and ($dartSdkVersion -eq (Get-Content $dartSdkStampPath))) {
|
||||
return
|
||||
}
|
||||
|
||||
Write-Host "Downloading Dart SDK $dartSdkVersion..."
|
||||
$dartZipName = "dartsdk-windows-x64-release.zip"
|
||||
$dartChannel = if ($dartSdkVersion.Contains("-dev.")) {"dev"} else {"stable"}
|
||||
$dartSdkUrl = "https://storage.googleapis.com/dart-archive/channels/$dartChannel/raw/$dartSdkVersion/sdk/$dartZipName"
|
||||
|
||||
if (Test-Path $dartSdkPath) { Remove-Item $dartSdkPath -Recurse }
|
||||
New-Item $dartSdkPath -force -type directory | Out-Null
|
||||
$dartSdkZip = "$flutterRoot\bin\cache\dart-sdk.zip"
|
||||
|
||||
Start-BitsTransfer -Source $dartSdkUrl -Destination $dartSdkZip
|
||||
Add-Type -assembly "system.io.compression.filesystem"
|
||||
[io.compression.zipfile]::ExtractToDirectory($dartSdkZip, "$flutterRoot\bin\cache")
|
||||
Remove-Item $dartSdkZip
|
||||
$dartSdkVersion | out-file $dartSdkStampPath
|
||||
@@ -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
|
||||
# `update_dart_sdk.ps1` script in the same directory to ensure that Flutter
|
||||
# continues to work across all platforms!
|
||||
#
|
||||
# -------------------------------------------------------------------------- #
|
||||
|
||||
set -e
|
||||
|
||||
FLUTTER_ROOT="$(dirname "$(dirname "$(dirname "${BASH_SOURCE[0]}")")")"
|
||||
|
||||
Reference in New Issue
Block a user