Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
756842a2
Commit
756842a2
authored
Feb 24, 2017
by
Michael Goderbauer
Committed by
GitHub
Feb 24, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Don't delete old Dart SDK if it is in use (#8385)
parent
eb839755
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
6 deletions
+17
-6
update_dart_sdk.ps1
bin/internal/update_dart_sdk.ps1
+17
-6
No files found.
bin/internal/update_dart_sdk.ps1
View file @
756842a2
...
...
@@ -14,12 +14,15 @@
$ErrorActionPreference
=
"Stop"
$progName
=
Split-Path
-parent
$MyInvocation
.MyCommand.Definition
$flutterRoot
=
(
Get-Item
$progName
)
.parent.parent.FullName
$flutterRoot
=
(
Get-Item
$progName
)
.parent.parent.FullName
$dartSdkPath
=
"
$flutterRoot
\bin\cache\dart-sdk"
$dartSdkStampPath
=
"
$flutterRoot
\bin\cache\dart-sdk.stamp"
$cachePath
=
"
$flutterRoot
\bin\cache"
$dartSdkPath
=
"
$cachePath
\dart-sdk"
$dartSdkStampPath
=
"
$cachePath
\dart-sdk.stamp"
$dartSdkVersion
=
(
Get-Content
"
$flutterRoot
\bin\internal\dart-sdk.version"
)
$oldDartSdkPrefix
=
"dart-sdk.old"
if
((
Test-Path
$dartSdkStampPath
)
-and
(
$dartSdkVersion
-eq
(
Get-Content
$dartSdkStampPath
)))
{
return
}
...
...
@@ -29,12 +32,20 @@ $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
}
if
(
Test-Path
$dartSdkPath
)
{
# Move old SDK to a new location instead of deleting it in case it is still in use (e.g. by IntelliJ).
$oldDartSdkSuffix
=
1
while
(
Test-Path
"
$cachePath
\
$oldDartSdkPrefix$oldDartSdkSuffix
"
)
{
$oldDartSdkSuffix
++
}
Rename-Item
$dartSdkPath
"
$oldDartSdkPrefix$oldDartSdkSuffix
"
}
New-Item
$dartSdkPath
-force -type directory | Out-Null
$dartSdkZip
=
"
$
flutterRoot
\bin\cache
\dart-sdk.zip"
$dartSdkZip
=
"
$
cachePath
\dart-sdk.zip"
Start-BitsTransfer
-Source
$dartSdkUrl
-Destination
$dartSdkZip
Add-Type
-assembly
"system.io.compression.filesystem"
[
io.compression.zipfile]::ExtractToDirectory
(
$dartSdkZip
,
"
$flutterRoot
\bin\cache"
)
[
io.compression.zipfile]::ExtractToDirectory
(
$dartSdkZip
,
$cachePath
)
Remove-Item
$dartSdkZip
$dartSdkVersion
|
Out-File
$dartSdkStampPath
-Encoding ASCII
# Try to delete all old SDKs.
Get-ChildItem
-Path
$cachePath
|
Where
{
$_
.BaseName.StartsWith
(
$oldDartSdkPrefix
)}
|
Remove-Item
-Recurse -ErrorAction SilentlyContinue
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment