Browse Source

added build script

Hobnob 3 years ago
parent
commit
9bece10ca6
2 changed files with 44 additions and 0 deletions
  1. 30 0
      build.ps1
  2. 14 0
      makeSymlinks.ps1

+ 30 - 0
build.ps1

@@ -0,0 +1,30 @@
+$pboProject = (Get-ItemProperty "HKCU:\Software\Mikero\pboProject\").exe
+$output = $(Join-Path $(Get-Location) "@501st Community Auxiliary Mod")
+$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")
+
+ForEach ($mod in $mods)
+{
+    $target = "$output\addons\$mod.pbo"
+    $LastModified = (Get-ChildItem "addons\$mod" -File -Recurse | Sort-Object LastWriteTime | Select-Object -Last 1).LastWriteTime
+    $exists = Test-Path $target
+    if($exists){ $LastBuilt = (Get-ChildItem $target).LastWriteTime }
+    if($exists -And $LastBuilt -gt $LastModified)
+    {
+        Write-Verbose "$mod Up to Date, skipping."
+    }
+    else
+    {
+        Write-Output "==Building $mod=="
+        & "$pboProject" "-M=$output" "P:\$mod"
+        Wait-Process pboProject
+        if(Test-Path $target)
+        {
+            Write-Output "  Successfully Built $mod."
+        }
+        else 
+        {
+            Write-Output "  $mod Build Failed."
+            Write-Output $(Get-Content "P:\temp\$mod.packing.log")
+        }
+    }
+}

+ 14 - 0
makeSymlinks.ps1

@@ -0,0 +1,14 @@
+$addonPath = ".\addons"
+function SymLink
+{
+    param([string]$source, [string]$dest)
+    Write-Verbose("Creating SymLink: $source > $destination")
+    New-Item -ItemType SymbolicLink -Path $dest -Target $source -Force
+}
+if(Test-Path 'P:') #if P Drive Mounted, create symlinks and build from there. 
+{
+    foreach($addonFolder in Get-ChildItem -Directory $addonPath)
+    {
+        SymLink -source "$addonPath\$addonFolder" -dest "P:\$addonFolder"
+    }
+}