-
Notifications
You must be signed in to change notification settings - Fork 1
/
merge.ps1
41 lines (31 loc) · 1.26 KB
/
merge.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
Import-Module -Name ./core.psm1;
# Reset build folders if it exists
Remove-Folder("build");
Remove-Folder("modpack");
New-Folder("build");
New-Folder("modpack");
$CommonBuild = "$(Get-Location)/build";
Foreach ($Repository in Get-ChildItem -Path "./repositories" -Directory)
{
$BuildDir = "$($Repository.FullName)\Build";
If (Test-Path -Path $BuildDir) {
Write-Host "Copying $($Repository.Name) to common build directory...";
Foreach ($Element in Get-ChildItem -Path "$BuildDir") {
Copy-Item -Path $Element.FullName -Destination "$CommonBuild" -Force -Recurse;
}
}
}
Foreach ($Artifact in Get-ChildItem -Path "./build" -Directory -Exclude "${ModpackName}/Centrifuge*")
{
Write-Host "Adding $($Artifact.Name) to merged mod artifact...";
Foreach ($Element in Get-ChildItem -Path "$Artifact") {
Copy-Item -Path $Element.FullName -Destination "./modpack" -Force -Recurse;
}
}
$MergedName = "All Mods";
Move-Item -Path "./modpack" -Destination "./build/${MergedName}";
Write-Host "Compressing combined mod artifact...";
Foreach ($Element in Get-ChildItem -Path "./build/${MergedName}") {
Write-Host "Adding ${$Element.Name} to combined archive...";
Compress-Archive -Path $Element.FullName -DestinationPath "./build/${MergedName}.zip" -Update -CompressionLevel Optimal;
}