set USER=
set TARGET=
set DRYRUN=false
+set NOUPLOAD=
set NOGPG=
-set PURGE_OPTION=/p:Purge=true
+set NOPURGE=
set NOTEST=
:CheckOpts
if "%1" EQU "-t" (set TARGET=%~2) && shift && shift && goto CheckOpts
if "%1" EQU "--target" (set TARGET=%~2) && shift && shift && goto CheckOpts
if "%1" EQU "--dry-run" (set DRYRUN=true) && shift && goto CheckOpts
+if "%1" EQU "--skip-upload" (set NOUPLOAD=true) && shift && goto CheckOpts
if "%1" EQU "--skip-gpg" (set NOGPG=true) && shift && goto CheckOpts
-if "%1" EQU "--skip-purge" (set PURGE_OPTION=) && shift && goto CheckOpts
+if "%1" EQU "--skip-purge" (set NOPURGE=true) && shift && goto CheckOpts
if "%1" EQU "--skip-test" (set NOTEST=true) && shift && goto CheckOpts
if "%1" EQU "-T" (set NOTEST=true) && shift && goto CheckOpts
if "%1" NEQ "" echo Unexpected argument "%1" & exit /B 1
call "%PCBUILD%find_msbuild.bat" %MSBUILD%
if ERRORLEVEL 1 (echo Cannot locate MSBuild.exe on PATH or as MSBUILD variable & exit /b 2)
pushd "%D%"
-%MSBUILD% /v:m /nologo uploadrelease.proj /t:Upload /p:Platform=x86 %PURGE_OPTION%
-%MSBUILD% /v:m /nologo uploadrelease.proj /t:Upload /p:Platform=x64 /p:IncludeDoc=false %PURGE_OPTION%
+if not defined NOUPLOAD (
+ %MSBUILD% /v:m /nologo uploadrelease.proj /t:Upload /p:Platform=x86
+ if errorlevel 1 goto :failed
+ %MSBUILD% /v:m /nologo uploadrelease.proj /t:Upload /p:Platform=x64 /p:IncludeDoc=false
+ if errorlevel 1 goto :failed
+)
+if not defined NOPURGE (
+ %MSBUILD% /v:m /nologo uploadrelease.proj /t:Purge
+)
if not defined NOTEST (
- %MSBUILD% /v:m /nologo uploadrelease.proj /t:Test /p:Platform=x86
- %MSBUILD% /v:m /nologo uploadrelease.proj /t:Test /p:Platform=x64
+ call :test x86
+ if errorlevel 1 goto :failed
+ call :test x64
+ if errorlevel 1 goto :failed
)
%MSBUILD% /v:m /nologo uploadrelease.proj /t:ShowHashes /p:Platform=x86
+if errorlevel 1 goto :failed
%MSBUILD% /v:m /nologo uploadrelease.proj /t:ShowHashes /p:Platform=x64 /p:IncludeDoc=false
+if errorlevel 1 goto :failed
+
popd
exit /B 0
+:test
+%MSBUILD% /v:m /nologo uploadrelease.proj /t:Test /p:Platform=%1
+if errorlevel 1 (
+ echo Test failed - purging and retrying
+ %MSBUILD% /v:m /nologo uploadrelease.proj /t:Purge
+ if errorlevel 1 exit /B
+ %MSBUILD% /v:m /nologo uploadrelease.proj /t:Test /p:Platform=%1
+)
+exit /B
+
+:failed
+popd
+exit /B
+
:Help
echo uploadrelease.bat --host HOST --user USERNAME [--target TARGET] [--dry-run] [-h]
echo.
<IncludeDoc Condition="'$(IncludeDoc)' == ''">true</IncludeDoc>
<BuildForRelease Condition="'$(BuildForRelease)' == ''">true</BuildForRelease>
<DryRun Condition="'$(DryRun)' == ''">false</DryRun>
- <Purge Condition="'$(Purge)' == ''">false</Purge>
</PropertyGroup>
<Import Project="msi.props" />
<Target Name="_RunGpg" Condition="'$(GPG)' != ''" Inputs="@(File)" Outputs="$(IntermediateOutputPath)\gpg\%(FileName)%(Extension).asc">
<MakeDir Directories="$(IntermediateOutputPath)gpg" />
<Delete Files="$(IntermediateOutputPath)\gpg\%(File.FileName)%(File.Extension).asc" Condition="Exists('$(IntermediateOutputPath)\gpg\%(File.FileName)%(File.Extension).asc')" />
- <Exec Command=""$(GPG)" -ba -o "$(IntermediateOutputPath)\gpg\%(File.FileName)%(File.Extension).asc" "%(File.FullPath)"" />
+ <Exec Command=""$(GPG)" -ba -o "$(IntermediateOutputPath)\gpg\%(File.FileName)%(File.Extension).asc" "%(File.FullPath)""
+ IgnoreExitCode="false" />
<ItemGroup>
<File Include="$(IntermediateOutputPath)\gpg\%(File.FileName)%(File.Extension).asc">
<CopyTo>%(File.CopyTo)</CopyTo>
</Target>
<Target Name="_Upload" Condition="!$(DryRun)">
- <Exec Command=""$(PLINK)" $(User)@$(Host) mkdir %(File.CopyTo) ^&^& chgrp downloads %(File.CopyTo) ^&^& chmod g-w,o+rx %(File.CopyTo)
-"$(PSCP)" @(File,' ') $(User)@$(Host):%(File.CopyTo)
-"$(PLINK)" $(User)@$(Host) chgrp downloads %(File.CopyTo)/*; chmod g-w,o+r %(File.CopyTo)/*
-" />
+ <Exec Command=""$(PLINK)" $(User)@$(Host) mkdir %(File.CopyTo) ^&^& chgrp downloads %(File.CopyTo) ^&^& chmod g-w,o+rx %(File.CopyTo)" />
+ <Exec Command=""$(PSCP)" @(File,' ') $(User)@$(Host):%(File.CopyTo)" />
+ <Exec Command=""$(PLINK)" $(User)@$(Host) chgrp downloads %(File.CopyTo)/*; chmod g-w,o+r %(File.CopyTo)/*" />
</Target>
<Target Name="_PrintNames" Condition="$(DryRun)">
- <Exec Command="echo "$(PLINK)" $(User)@$(Host) mkdir %(File.CopyTo) ^&^& chgrp downloads %(File.CopyTo) ^&^& chmod g-w,o+rx %(File.CopyTo)
-echo "$(PSCP)" @(File,' ') $(User)@$(Host):%(File.CopyTo)
-echo "$(PLINK)" $(User)@$(Host) chgrp downloads %(File.CopyTo)/*; chmod g-w,o+r %(File.CopyTo)/*
-echo.
-echo." />
- </Target>
-
- <Target Name="_Purge" Condition="$(Purge) and !$(DryRun)">
- <Error Condition="!Exists('$(PythonExe)')" Text="No Python executable available at $(PythonExe)" />
- <Exec Command=""$(PythonExe)" purge.py $(PythonVersion)" />
+ <Exec Command="echo "$(PLINK)" $(User)@$(Host) mkdir %(File.CopyTo) ^&^& chgrp downloads %(File.CopyTo) ^&^& chmod g-w,o+rx %(File.CopyTo)" />
+ <Exec Command="echo "$(PSCP)" @(File,' ') $(User)@$(Host):%(File.CopyTo)" />
+ <Exec Command="echo "$(PLINK)" $(User)@$(Host) chgrp downloads %(File.CopyTo)/*; chmod g-w,o+r %(File.CopyTo)/*" />
</Target>
<Target Name="_TestLayout">
<LogFile>$(OutputPath)\%(Filename)_layoutlog\%(Filename).log</LogFile>
</WebInstaller>
</ItemGroup>
+ <Error Text="Could not find installer" Condition="@(WebInstaller) == ''" />
<RemoveDir Directories="%(WebInstaller.SourceDir)" Condition="Exists('%(WebInstaller.SourceDir)')" />
<RemoveDir Directories="%(WebInstaller.LayoutDir)" Condition="Exists('%(WebInstaller.LayoutDir)')" />
<RemoveDir Directories="%(WebInstaller.LogDir)" Condition="Exists('%(WebInstaller.LogDir)')" />
<Message Text="Successfully downloaded %(WebInstaller.Filename)%(WebInstaller.Extension) layout" Importance="high" />
</Target>
- <Target Name="Upload" DependsOnTargets="_ValidateProperties;_RunGpg;_PrintNames;_Upload;_Purge" />
+ <Target Name="Upload" DependsOnTargets="_ValidateProperties;_RunGpg;_PrintNames;_Upload" />
<Target Name="Test" DependsOnTargets="_TestLayout" />
+ <Target Name="Purge">
+ <Error Condition="!Exists('$(PythonExe)')" Text="No Python executable available at $(PythonExe)" />
+ <Exec Command="echo "$(PythonExe)" purge.py $(PythonVersion)" Condition="$(DryRun)" />
+ <Exec Command=""$(PythonExe)" purge.py $(PythonVersion)" Condition="!$(DryRun)" />
+ <Message Text="Purged uploaded files" Importance="high" />
+ </Target>
+
<Target Name="ShowHashes">
<ItemGroup>
<UserFiles Include="@(File)" Condition="'%(File.CopyTo)' == '$(EXETarget)'" />
</ItemGroup>
+ <Error Text="No files generated" Condition="@(UserFiles) == ''" />
<Exec Command=""$(PythonExe)" generate_md5.py @(UserFiles->'"%(FullPath)"',' ')" />
</Target>