summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOpportunityLiu <[email protected]>2019-06-18 19:12:06 +0800
committerOpportunityLiu <[email protected]>2019-06-18 19:12:06 +0800
commit72f86392dd7bf482f409dfe4dd00219ef422ad9c (patch)
tree24e0a3a7f88cc6d32d8552229a575dbda8c0316f
parent284857c1a43ce61a9f5433d88414e539f2bdc02a (diff)
support download tag from ci
-rw-r--r--.appveyor.yml2
-rw-r--r--scripts/get.ps123
-rw-r--r--xmake/actions/update/main.lua3
3 files changed, 21 insertions, 7 deletions
diff --git a/.appveyor.yml b/.appveyor.yml
index 253c09efe..144fd6438 100644
--- a/.appveyor.yml
+++ b/.appveyor.yml
@@ -1,5 +1,5 @@
#version: v2.1.8.{build}
-os:
+image:
- Visual Studio 2013
- Visual Studio 2015
- Visual Studio 2017
diff --git a/scripts/get.ps1 b/scripts/get.ps1
index 0a07c8d2e..726d74a42 100644
--- a/scripts/get.ps1
+++ b/scripts/get.ps1
@@ -6,7 +6,7 @@
# Invoke-Expression (Invoke-Webrequest <my location> -UseBasicParsing).Content
param (
- [string]$branch = "master",
+ [string]$version = "master",
[string]$installdir = ""
)
@@ -57,10 +57,15 @@ if ($null -eq $installdir -or $installdir -match '^\s*$') {
}
}
-if ($null -eq $branch -or $branch -match '^\s*$') {
- $branch = 'master'
+if ($null -eq $version -or $version -match '^\s*$') {
+ $v = 'master'
+} else {
+ $v = $version.Trim()
+ if ($v.Contains('.')) {
+ $v = [version]::Parse($version)
+ $v = New-Object -TypeName version -ArgumentList $v.Major, $v.Minor, $v.Build
+ }
}
-
function checkTempAccess {
$outfile = Join-Path $temppath "$pid.tmp"
try {
@@ -77,7 +82,15 @@ function xmakeInstall {
$outfile = Join-Path $temppath "$pid-xmake-installer.exe"
$x64arch = @('AMD64', 'IA64', 'ARM64')
$arch = if ($env:PROCESSOR_ARCHITECTURE -in $x64arch -or $env:PROCESSOR_ARCHITEW6432 -in $x64arch) { 'x64' } else { 'x86' }
- $url = "https://ci.appveyor.com/api/projects/waruqi/xmake/artifacts/xmake-installer.exe?branch=$branch&pr=false&job=Image%3A+Visual+Studio+2017%3B+Platform%3A+$arch"
+ $url = if ($v -is [version]) {
+ if ($v -gt "2.2.6") {
+ "https://ci.appveyor.com/api/projects/waruqi/xmake/artifacts/xmake-installer.exe?tag=v$v&pr=false&job=Image%3A+Visual+Studio+2017%3B+Platform%3A+$arch"
+ } else {
+ "https://github.com/xmake-io/xmake/releases/download/v$v/xmake-v$v.exe"
+ }
+ } else {
+ "https://ci.appveyor.com/api/projects/waruqi/xmake/artifacts/xmake-installer.exe?branch=$v&pr=false&job=Image%3A+Visual+Studio+2017%3B+Platform%3A+$arch"
+ }
Write-Host "Start downloading $url .."
try {
Invoke-Webrequest $url -OutFile $outfile -UseBasicParsing
diff --git a/xmake/actions/update/main.lua b/xmake/actions/update/main.lua
index 060fe398c..ab17ef135 100644
--- a/xmake/actions/update/main.lua
+++ b/xmake/actions/update/main.lua
@@ -275,7 +275,8 @@ function main()
end
if version:find('.', 1, true) then
- mainurls = {format("https://github.com/xmake-io/xmake/releases/download/%s/xmake-%s.exe", version, version),
+ mainurls = {format("https://ci.appveyor.com/api/projects/waruqi/xmake/artifacts/xmake-installer.exe?tag=%s&pr=false&job=Image%%3A+Visual+Studio+2017%%3B+Platform%%3A+%s", version, os.arch()),
+ format("https://github.com/xmake-io/xmake/releases/download/%s/xmake-%s.exe", version, version),
format("https://qcloud.coding.net/u/waruqi/p/xmake-releases/git/raw/master/xmake-%s.exe", version),
format("https://gitlab.com/xmake-mirror/xmake-releases/raw/master/xmake-%s.exe", version)}
else