summaryrefslogtreecommitdiff
path: root/scripts/get.ps1
diff options
context:
space:
mode:
authorTitanSnow <[email protected]>2017-04-22 11:12:48 +0800
committerTitanSnow <[email protected]>2017-04-22 11:12:48 +0800
commit00701ef312fb4fa2fb6b873fee8e9b4c28a9c8fe (patch)
tree2fdafe8b6674e558bc4abc995019e5576e71e70f /scripts/get.ps1
parent24ef8db3b6cadda0244b284f87fd934e9823e48d (diff)
pull on Windows!
Diffstat (limited to 'scripts/get.ps1')
-rw-r--r--scripts/get.ps127
1 files changed, 26 insertions, 1 deletions
diff --git a/scripts/get.ps1 b/scripts/get.ps1
index aec656a69..298ae479a 100644
--- a/scripts/get.ps1
+++ b/scripts/get.ps1
@@ -2,7 +2,8 @@
# usage: (in powershell)
# Invoke-Expression (Invoke-Webrequest <my location> -UseBasicParsing).Content
-$outfile=($env:TMP,$env:TEMP,'.' -ne $null)[0]+"\$pid-xmake-installer.exe"
+$temppath=($env:TMP,$env:TEMP,'.' -ne $null)[0]
+$outfile=$temppath+"\$pid-xmake-installer.exe"
try{
Write-Output "$pid"|Out-File -FilePath "$outfile"
Remove-Item "$outfile"
@@ -36,3 +37,27 @@ Write-Host 'Adding to PATH... almost done'
$env:Path+=";$installdir"
[Environment]::SetEnvironmentVariable("Path",[Environment]::GetEnvironmentVariable("Path",[System.EnvironmentVariableTarget]::User)+";$installdir",[System.EnvironmentVariableTarget]::User) # this step is optional because installer writes path to regedit
xmake --version
+$branch='master'
+Write-Host "Pulling xmake from branch $branch"
+$outfile=$temppath+"\$pid-xmake-repo.zip"
+try{
+ Invoke-Webrequest "https://github.com/tboox/xmake/archive/$branch.zip" -OutFile "$outfile"
+}catch{
+ Write-Host 'Pull Failed!'
+ Write-Host 'xmake is now available but may not be newest'
+ Exit
+}
+Write-Host 'Expanding archive...'
+New-Item -Path "$temppath" -Name "$pid-xmake-repo" -ItemType "directory" -Force
+$repodir=$temppath+"\$pid-xmake-repo"
+Expand-Archive "$outfile" "$repodir" -Force
+Write-Host 'Self-building...'
+$oldpwd=$pwd
+Set-Location ($repodir+"\xmake-$branch\core")
+xmake
+Write-Host 'Copying new files...'
+Copy-Item 'build\xmake.exe' "$installdir" -Force
+Set-Location '..\xmake'
+Copy-Item * "$installdir" -Recurse -Force
+Set-Location "$oldpwd"
+xmake --version