Zachary Ware | 6b6e687 | 2017-06-10 14:58:42 -0500 | [diff] [blame^] | 1 | @setlocal |
| 2 | @echo off |
| 3 | |
| 4 | set D=%~dp0 |
| 5 | set PCBUILD=%D%..\..\PCBuild\ |
| 6 | |
| 7 | set HOST= |
| 8 | set USER= |
| 9 | set TARGET= |
| 10 | set DRYRUN=false |
| 11 | set NOGPG= |
| 12 | set PURGE_OPTION=/p:Purge=true |
| 13 | set NOTEST= |
| 14 | |
| 15 | :CheckOpts |
| 16 | if "%1" EQU "-h" goto Help |
| 17 | if "%1" EQU "-o" (set HOST=%~2) && shift && shift && goto CheckOpts |
| 18 | if "%1" EQU "--host" (set HOST=%~2) && shift && shift && goto CheckOpts |
| 19 | if "%1" EQU "-u" (set USER=%~2) && shift && shift && goto CheckOpts |
| 20 | if "%1" EQU "--user" (set USER=%~2) && shift && shift && goto CheckOpts |
| 21 | if "%1" EQU "-t" (set TARGET=%~2) && shift && shift && goto CheckOpts |
| 22 | if "%1" EQU "--target" (set TARGET=%~2) && shift && shift && goto CheckOpts |
| 23 | if "%1" EQU "--dry-run" (set DRYRUN=true) && shift && goto CheckOpts |
| 24 | if "%1" EQU "--skip-gpg" (set NOGPG=true) && shift && goto CheckOpts |
| 25 | if "%1" EQU "--skip-purge" (set PURGE_OPTION=) && shift && godo CheckOpts |
| 26 | if "%1" EQU "--skip-test" (set NOTEST=true) && shift && godo CheckOpts |
| 27 | if "%1" EQU "-T" (set NOTEST=true) && shift && godo CheckOpts |
| 28 | if "%1" NEQ "" echo Unexpected argument "%1" & exit /B 1 |
| 29 | |
| 30 | if not defined PLINK where plink > "%TEMP%\plink.loc" 2> nul && set /P PLINK= < "%TEMP%\plink.loc" & del "%TEMP%\plink.loc" |
| 31 | if not defined PLINK where /R "%ProgramFiles(x86)%\PuTTY" plink > "%TEMP%\plink.loc" 2> nul && set /P PLINK= < "%TEMP%\plink.loc" & del "%TEMP%\plink.loc" |
| 32 | if not defined PLINK where /R "%ProgramFiles(x86)%" plink > "%TEMP%\plink.loc" 2> nul && set /P PLINK= < "%TEMP%\plink.loc" & del "%TEMP%\plink.loc" |
| 33 | if not defined PLINK echo Cannot locate plink.exe & exit /B 1 |
| 34 | echo Found plink.exe at %PLINK% |
| 35 | |
| 36 | if not defined PSCP where pscp > "%TEMP%\pscp.loc" 2> nul && set /P pscp= < "%TEMP%\pscp.loc" & del "%TEMP%\pscp.loc" |
| 37 | if not defined PSCP where /R "%ProgramFiles(x86)%\PuTTY" pscp > "%TEMP%\pscp.loc" 2> nul && set /P pscp= < "%TEMP%\pscp.loc" & del "%TEMP%\pscp.loc" |
| 38 | if not defined PSCP where /R "%ProgramFiles(x86)%" pscp > "%TEMP%\pscp.loc" 2> nul && set /P pscp= < "%TEMP%\pscp.loc" & del "%TEMP%\pscp.loc" |
| 39 | if not defined PSCP echo Cannot locate pscp.exe & exit /B 1 |
| 40 | echo Found pscp.exe at %PSCP% |
| 41 | |
| 42 | if defined NOGPG ( |
| 43 | set GPG= |
| 44 | echo Skipping GPG signature generation because of --skip-gpg |
| 45 | ) else ( |
| 46 | if not defined GPG where gpg2 > "%TEMP%\gpg.loc" 2> nul && set /P GPG= < "%TEMP%\gpg.loc" & del "%TEMP%\gpg.loc" |
| 47 | if not defined GPG where /R "%PCBUILD%..\externals\windows-installer" gpg2 > "%TEMP%\gpg.loc" 2> nul && set /P GPG= < "%TEMP%\gpg.loc" & del "%TEMP%\gpg.loc" |
| 48 | if not defined GPG echo Cannot locate gpg2.exe. Signatures will not be uploaded & pause |
| 49 | echo Found gpg2.exe at %GPG% |
| 50 | ) |
| 51 | |
| 52 | call "%PCBUILD%env.bat" > nul 2> nul |
| 53 | pushd "%D%" |
| 54 | msbuild /v:m /nologo uploadrelease.proj /t:Upload /p:Platform=x86 %PURGE_OPTION% |
| 55 | msbuild /v:m /nologo uploadrelease.proj /t:Upload /p:Platform=x64 /p:IncludeDoc=false %PURGE_OPTION% |
| 56 | if not defined NOTEST ( |
| 57 | msbuild /v:m /nologo uploadrelease.proj /t:Test /p:Platform=x86 |
| 58 | msbuild /v:m /nologo uploadrelease.proj /t:Test /p:Platform=x64 |
| 59 | ) |
| 60 | msbuild /v:m /nologo uploadrelease.proj /t:ShowHashes /p:Platform=x86 |
| 61 | msbuild /v:m /nologo uploadrelease.proj /t:ShowHashes /p:Platform=x64 /p:IncludeDoc=false |
| 62 | popd |
| 63 | exit /B 0 |
| 64 | |
| 65 | :Help |
| 66 | echo uploadrelease.bat --host HOST --user USERNAME [--target TARGET] [--dry-run] [-h] |
| 67 | echo. |
| 68 | echo --host (-o) Specify the upload host (required) |
| 69 | echo --user (-u) Specify the user on the host (required) |
| 70 | echo --target (-t) Specify the target directory on the host |
| 71 | echo --dry-run Display commands and filenames without executing them |
| 72 | echo --skip-gpg Does not generate GPG signatures before uploading |
| 73 | echo --skip-purge Does not perform CDN purge after uploading |
| 74 | echo --skip-test (-T) Does not perform post-upload tests |
| 75 | echo -h Display this help information |
| 76 | echo. |