Automatically download title sequences in msbuild

This commit is contained in:
Ted John 2016-12-16 17:39:10 +00:00
parent f57d69eeb9
commit 5583d7afd0
1 changed files with 33 additions and 0 deletions

View File

@ -221,6 +221,39 @@
StandardOutputImportance="low" />
</Target>
<PropertyGroup>
<SequencesUrl>https://github.com/OpenRCT2/title-sequences/releases/download/v0.0.5/title-sequence-v0.0.5.zip</SequencesUrl>
<SequencesPath>$(TargetDir)data\title</SequencesPath>
<SequencesZip>$(TargetDir)data\title\seqs.zip</SequencesZip>
<SequencesVersionPath>$(TargetDir)sequencesversion</SequencesVersionPath>
</PropertyGroup>
<Target Name="CheckTitleSequences" AfterTargets="Build">
<PropertyGroup>
<CurrentSequencesVersion Condition="Exists($(SequencesVersionPath))">$([System.IO.File]::ReadAllText($(SequencesVersionPath)).Trim())</CurrentSequencesVersion>
<UpdateSequences Condition="'$(CurrentSequencesVersion)'!='$(SequencesUrl)'">true</UpdateSequences>
</PropertyGroup>
<Message Condition="'$(UpdateSequences)'!='true'" Text="Sequences up to date" Importance="high" />
<Message Condition="'$(UpdateSequences)'=='true'" Text="Sequences out of date, updating..." Importance="high" />
<CallTarget Condition="'$(UpdateSequences)'=='true'" Targets="DownloadTitleSequences" />
</Target>
<!-- Target to download the title sequences -->
<Target Name="DownloadTitleSequences">
<!-- Clean sequences directory -->
<RemoveDir Directories="$(SequencesPath)" />
<MakeDir Directories="$(SequencesPath)" />
<Message Text="Downloading title sequences..." Importance="normal" />
<Exec Command="powershell -ExecutionPolicy Unrestricted -Command &quot;Invoke-WebRequest '$(SequencesUrl)' -OutFile '$(SequencesZip)'&quot;" StandardOutputImportance="low" />
<Unzip Input="$(SequencesZip)" OutputDirectory="$(SequencesPath)" />
<Delete Files="$(SequencesZip)" ContinueOnError="true" />
<!-- Update version file -->
<WriteLinesToFile Lines="$(SequencesUrl)" File="$(SequencesVersionPath)" Overwrite="true" />
</Target>
<!-- Target to sign OpenRCT2
This requires the project parameter SIGN_PASSWORD to be set -->
<Target Name="Sign" AfterTargets="Build" Inputs="@(SignItems)" Outputs="%(SignItems.Identity).signed"