-
-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathBuild-QMod.ps1
45 lines (35 loc) · 1.03 KB
/
Build-QMod.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
42
43
44
45
Param(
[Parameter(Mandatory=$false)]
[Switch] $Clean
)
& $PSScriptRoot/Build-Binary.ps1 -Clean:$Clean
if ($LASTEXITCODE -ne 0) {
echo "Failed to build binary, exiting..."
exit $LASTEXITCODE
}
$ModFile = "./mod.json"
$ModJson = Get-Content $ModFile -Raw | ConvertFrom-Json
$FileList = @($ModFile)
$CoverImage = "./" + $modJson.coverImage
if ((-not ($CoverImage -eq "./")) -and (Test-Path $CoverImage)) {
$FileList += , $CoverImage
}
foreach ($Mod in $ModJson.modFiles) {
$Path = "./build/" + $Mod
if (-not (Test-Path $Path)) {
$Path = "./extern/libs/" + $Mod
}
$FileList += $Path
}
foreach ($Lib in $ModJson.libraryFiles) {
$Path = "./extern/libs/" + $Lib
if (-not (Test-Path $Path)) {
$Path = "./build/" + $Lib
}
$FileList += $Path
}
$FileList += "./content"
$ArchiveName = "anytweaks_v" + $ModJson.version + ".qmod"
$TempArchiveName = $ArchiveName + ".zip"
Compress-Archive -Path $FileList -DestinationPath $TempArchiveName -Force
Move-Item $TempArchiveName $ArchiveName -Force