blob: 4753fd350325857866eeed4233a0bf20a8825a33 [file] [log] [blame]
Zachary Ware6b6e6872017-06-10 14:58:42 -05001@setlocal
2@echo off
3
4set D=%~dp0
Stefan Grönkef1502d02017-09-25 18:58:10 +02005set PCBUILD=%D%..\..\PCbuild\
Zachary Ware6b6e6872017-06-10 14:58:42 -05006
7set HOST=
8set USER=
9set TARGET=
10set DRYRUN=false
11set NOGPG=
12set PURGE_OPTION=/p:Purge=true
13set NOTEST=
14
15:CheckOpts
16if "%1" EQU "-h" goto Help
17if "%1" EQU "-o" (set HOST=%~2) && shift && shift && goto CheckOpts
18if "%1" EQU "--host" (set HOST=%~2) && shift && shift && goto CheckOpts
19if "%1" EQU "-u" (set USER=%~2) && shift && shift && goto CheckOpts
20if "%1" EQU "--user" (set USER=%~2) && shift && shift && goto CheckOpts
21if "%1" EQU "-t" (set TARGET=%~2) && shift && shift && goto CheckOpts
22if "%1" EQU "--target" (set TARGET=%~2) && shift && shift && goto CheckOpts
23if "%1" EQU "--dry-run" (set DRYRUN=true) && shift && goto CheckOpts
24if "%1" EQU "--skip-gpg" (set NOGPG=true) && shift && goto CheckOpts
25if "%1" EQU "--skip-purge" (set PURGE_OPTION=) && shift && godo CheckOpts
26if "%1" EQU "--skip-test" (set NOTEST=true) && shift && godo CheckOpts
27if "%1" EQU "-T" (set NOTEST=true) && shift && godo CheckOpts
28if "%1" NEQ "" echo Unexpected argument "%1" & exit /B 1
29
30if not defined PLINK where plink > "%TEMP%\plink.loc" 2> nul && set /P PLINK= < "%TEMP%\plink.loc" & del "%TEMP%\plink.loc"
31if not defined PLINK where /R "%ProgramFiles(x86)%\PuTTY" plink > "%TEMP%\plink.loc" 2> nul && set /P PLINK= < "%TEMP%\plink.loc" & del "%TEMP%\plink.loc"
32if not defined PLINK where /R "%ProgramFiles(x86)%" plink > "%TEMP%\plink.loc" 2> nul && set /P PLINK= < "%TEMP%\plink.loc" & del "%TEMP%\plink.loc"
33if not defined PLINK echo Cannot locate plink.exe & exit /B 1
34echo Found plink.exe at %PLINK%
35
36if not defined PSCP where pscp > "%TEMP%\pscp.loc" 2> nul && set /P pscp= < "%TEMP%\pscp.loc" & del "%TEMP%\pscp.loc"
37if not defined PSCP where /R "%ProgramFiles(x86)%\PuTTY" pscp > "%TEMP%\pscp.loc" 2> nul && set /P pscp= < "%TEMP%\pscp.loc" & del "%TEMP%\pscp.loc"
38if not defined PSCP where /R "%ProgramFiles(x86)%" pscp > "%TEMP%\pscp.loc" 2> nul && set /P pscp= < "%TEMP%\pscp.loc" & del "%TEMP%\pscp.loc"
39if not defined PSCP echo Cannot locate pscp.exe & exit /B 1
40echo Found pscp.exe at %PSCP%
41
42if 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
Steve Dower40a23e82017-06-19 10:34:25 -070052call "%PCBUILD%find_msbuild.bat" %MSBUILD%
53if ERRORLEVEL 1 (echo Cannot locate MSBuild.exe on PATH or as MSBUILD variable & exit /b 2)
Zachary Ware6b6e6872017-06-10 14:58:42 -050054pushd "%D%"
Steve Dower40a23e82017-06-19 10:34:25 -070055%MSBUILD% /v:m /nologo uploadrelease.proj /t:Upload /p:Platform=x86 %PURGE_OPTION%
56%MSBUILD% /v:m /nologo uploadrelease.proj /t:Upload /p:Platform=x64 /p:IncludeDoc=false %PURGE_OPTION%
Zachary Ware6b6e6872017-06-10 14:58:42 -050057if not defined NOTEST (
Steve Dower40a23e82017-06-19 10:34:25 -070058 %MSBUILD% /v:m /nologo uploadrelease.proj /t:Test /p:Platform=x86
59 %MSBUILD% /v:m /nologo uploadrelease.proj /t:Test /p:Platform=x64
Zachary Ware6b6e6872017-06-10 14:58:42 -050060)
Steve Dower40a23e82017-06-19 10:34:25 -070061%MSBUILD% /v:m /nologo uploadrelease.proj /t:ShowHashes /p:Platform=x86
62%MSBUILD% /v:m /nologo uploadrelease.proj /t:ShowHashes /p:Platform=x64 /p:IncludeDoc=false
Zachary Ware6b6e6872017-06-10 14:58:42 -050063popd
64exit /B 0
65
66:Help
67echo uploadrelease.bat --host HOST --user USERNAME [--target TARGET] [--dry-run] [-h]
68echo.
69echo --host (-o) Specify the upload host (required)
70echo --user (-u) Specify the user on the host (required)
71echo --target (-t) Specify the target directory on the host
72echo --dry-run Display commands and filenames without executing them
73echo --skip-gpg Does not generate GPG signatures before uploading
74echo --skip-purge Does not perform CDN purge after uploading
75echo --skip-test (-T) Does not perform post-upload tests
76echo -h Display this help information
77echo.