Skip to content

Commit 1a089a0

Browse files
committed
Created a build script that compiles MESS and then prepares release .zip files for several platforms (Windows 32/64 bit and Linux 64 bit).
1 parent 2bb1551 commit 1a089a0

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

make_release.ps1

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
$platforms = @{ name = 'win64'; profile = 'Windows64bit.pubxml'; runtime = 'win-x64' },
2+
@{ name = 'win32'; profile = 'Windows32bit.pubxml'; runtime = 'win-x86' },
3+
@{ name = 'linux64'; profile = 'Linux64bit.pubxml'; runtime = 'linux-x64' }
4+
5+
# Build all platform variants:
6+
foreach ($platform in $platforms) {
7+
# NOTE: dotnet publish doesn't handle .pubxml files correctly, hence all the extra arguments here:
8+
dotnet publish .\MESS\MESS.csproj -c Release -f net6.0 -r $($platform.runtime) --self-contained true -p:PublishSingleFile=true -p:PublishTrimmed=true --output .\MESS\bin\Release\net6.0\publish\$($platform.runtime)
9+
}
10+
11+
# Create release zip files:
12+
$version = (Get-Item .\MESS\bin\Release\net6.0\publish\win-x64\MESS.exe).VersionInfo.ProductVersion
13+
foreach ($platform in $platforms) {
14+
# Create output directory:
15+
$output_dir = (Join-Path (Get-Location) "Releases\${version}\mess_${version}_$($platform.name)")
16+
Write-Host $output_dir
17+
[System.IO.Directory]::CreateDirectory($output_dir)
18+
19+
# Copy files (executables, config files, template entities and template maps):
20+
Copy-Item -Path .\MESS\bin\Release\net6.0\publish\$($platform.runtime)\* -Destination $output_dir
21+
Copy-Item -Path .\files\* -Destination $output_dir
22+
Copy-Item -Path .\template_entities -Destination $output_dir\template_entities -Recurse -Container
23+
Copy-Item -Path .\template_maps -Destination $output_dir\template_maps -Recurse -Container
24+
}
25+
26+
# Run MESS.exe to generate the mess.fgd file:
27+
& ".\Releases\${version}\mess_${version}_win64\MESS.exe" -log off
28+
29+
foreach ($platform in $platforms) {
30+
$output_dir = (Join-Path (Get-Location) "Releases\${version}\mess_${version}_$($platform.name)")
31+
32+
# Copy the mess.fgd file that was just generated by MESS:
33+
if ($platform.name -ne 'win64') {
34+
Copy-Item -Path .\Releases\${version}\mess_${version}_win64\mess.fgd -Destination $output_dir
35+
}
36+
37+
# Zip it:
38+
Compress-Archive -Force -CompressionLevel Optimal -Path $output_dir -DestinationPath "${output_dir}.zip"
39+
}

0 commit comments

Comments
 (0)