Skip to content

Commit

Permalink
Improve the unity build process.
Browse files Browse the repository at this point in the history
  • Loading branch information
aaubry committed Oct 20, 2015
1 parent 2da9ab8 commit c2ba348
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 41 deletions.
4 changes: 4 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,7 @@
path = BuildUtils
url = https://github.com/aaubry/BuildUtils.git
branch = master
[submodule "BuildUtils.UnityPrerequisites"]
path = BuildUtils.UnityPrerequisites
url = https://github.com/aaubry/BuildUtils.UnityPrerequisites.git
branch = master
1 change: 1 addition & 0 deletions BuildUtils.UnityPrerequisites
44 changes: 3 additions & 41 deletions build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -2,52 +2,14 @@

$build_unity = $true

function Download-File($url, $path, $description) {
$wc = New-Object System.Net.WebClient

Write-Host "Downloading $description"
Write-Host ": |---------|---------|---------|---------|---------|---------|---------|---------|---------|---------|"
Write-Host ": " -NoNewline

$previousPercentage = 0
$e = Register-ObjectEvent -InputObject $wc -EventName DownloadProgressChanged -Action {
$currentPercentage = $Args[1].ProgressPercentage
for(; $previousPercentage -le $currentPercentage; $previousPercentage++) {
Write-Host "#" -NoNewline
}
}
$e = Register-ObjectEvent -InputObject $wc -EventName DownloadFileCompleted -Action {
Write-Host " Done"
New-Event "DownloadComplete"
}

$canceling = $true
$wc.DownloadFileAsync($url, $path, $description)
try {
$e = Wait-Event "DownloadComplete"
$canceling = $false
}
finally {
if($canceling) {
Write-Host " - cancelling - " -NoNewline
}
$wc.CancelAsync()
$e = Wait-Event "DownloadComplete"
Remove-Event "DownloadComplete"
Write-Host ""
}
}

$targets = "Release-Unsigned", "Release-Signed", "Release-Portable-Unsigned", "Release-Portable-Signed"

if($build_unity) {
$targets += "Release-UnitySubset-v35"

Download-File "https://visualstudiogallery.msdn.microsoft.com/20b80b8c-659b-45ef-96c1-437828fe7cf2/file/92287/8/Visual%20Studio%202013%20Tools%20for%20Unity.msi" "$env:TEMP\Unity.msi" "VS Tools for Unity"

Write-Host "Installing VS Tools for Unity... " -NoNewline
& .\BuildUtils\MsiInstaller\bin\Release\MsiInstaller.exe "$env:TEMP\Unity.msi"
Write-Host "Done"
cd BuildUtils.UnityPrerequisites
.\install.ps1
cd ..
}

$targets |
Expand Down

0 comments on commit c2ba348

Please sign in to comment.