build.ps1 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. param(
  2. [switch]$FullBuild = $False,
  3. [switch]$Pause = $False
  4. )
  5. $pboProject = (Get-ItemProperty "HKCU:\Software\Mikero\pboProject\").exe
  6. $output = $(Join-Path $(Get-Location) "@501st Community Auxiliary Mod")
  7. $mods = @("501st_Helmets","RD501_Compositions","RD501_Droids","RD501_Droid_Dispenser","RD501_EMP","RD501_Helmets","RD501_Jumppack","RD501_Main","RD501_Markers","RD501_Particle_Effects","RD501_RDS","RD501_Units","RD501_Vehicles","RD501_Vehicle_Weapons","RD501_Weapons","RD501_Zeus","VenMK2")
  8. $succeded = @()
  9. $failed = @()
  10. ForEach ($mod in $mods)
  11. {
  12. $target = "$output\addons\$mod.pbo"
  13. $LastModified = (Get-ChildItem "addons\$mod" -File -Recurse | Sort-Object LastWriteTime | Select-Object -Last 1).LastWriteTime
  14. $exists = Test-Path $target
  15. if($exists){ $LastBuilt = (Get-ChildItem $target).LastWriteTime }
  16. if($exists -And -Not $FullBuild -And $LastBuilt -gt $LastModified)
  17. {
  18. Write-Verbose "$mod Up to Date, skipping."
  19. }
  20. else
  21. {
  22. Write-Output "==Building $mod=="
  23. $args = @()
  24. if(-Not $Pause){ $args += "-P" }
  25. $args += "-M=$output"
  26. $args += "P:\$mod"
  27. & "$pboProject" @args
  28. Wait-Process pboProject
  29. if(Test-Path $target)
  30. {
  31. Write-Output " Successfully Built $mod."
  32. $succeded += $mod
  33. }
  34. else
  35. {
  36. Write-Output " $mod Build Failed."
  37. $failed += $mod
  38. }
  39. }
  40. }
  41. if($succeded.Count -ne 0){ Write-Output "Succeded: ", $succeded}
  42. if($failed.Count -ne 0){ Write-Output "Failed: ", $failed}
  43. if($succeded.Count -eq 0 -and $failed.Count -eq 0){ Write-Output "Nothing to build."}