New Build scripts

This commit is contained in:
MaddoScientisto 2026-02-07 22:31:11 +01:00
commit c9a7eee188
8 changed files with 964 additions and 86 deletions

View file

@ -1,54 +1,46 @@
# Define paths
$gitVersionPath = "dotnet-gitversion.exe"
# Export Script for Cirno No Reason
# Exports game builds for Windows and Linux platforms
# Import the module
$modulePath = Join-Path $PSScriptRoot "CirnoBuild.psm1"
Import-Module $modulePath -Force
# Configuration
$godotPath = $env:GODOT
$buildDir = ".\build"
$configFile = "export_presets.cfg"
$zipOutputDir = ".\release"
$fileName = "Cirno_No_Reason"
$platforms = Get-PlatformConfigurations
# Validate prerequisites
$prereqResult = Test-Prerequisites -GodotPath $godotPath -SkipButler
if (-not $prereqResult.Valid) {
exit 1
}
# Use resolved path if available
if ($prereqResult.ResolvedGodotPath) {
$godotPath = $prereqResult.ResolvedGodotPath
}
Write-Host "Using Godot at: $godotPath" -ForegroundColor Green
Write-Host ""
# Step 1: Clear the build directory
if (Test-Path $buildDir) {
Remove-Item "$buildDir\*" -Recurse -Force
} else {
New-Item -ItemType Directory -Path $buildDir | Out-Null
}
New-Item -ItemType Directory -Path $buildDir\win | Out-Null
New-Item -ItemType Directory -Path $buildDir\linux | Out-Null
Write-Host "Clearing build directory..."
Initialize-BuildDirectories -PlatformsToBuild @("win", "linux") -BuildDir $buildDir
# Step 2: Get version data from GitVersion
$gitVersionOutput = & $gitVersionPath | ConvertFrom-Json
$assemblySemFileVer = $gitVersionOutput.AssemblySemFileVer
$assemblySemVer = $gitVersionOutput.AssemblySemVer
$fullSemVer = $gitVersionOutput.FullSemVer
# Step 3: Set environment variables for use in the build process
[System.Environment]::SetEnvironmentVariable("GIT_ASSEMBLY_SEM_FILE_VER", $assemblySemFileVer, [System.EnvironmentVariableTarget]::Process)
[System.Environment]::SetEnvironmentVariable("GIT_ASSEMBLY_SEM_VER", $assemblySemVer, [System.EnvironmentVariableTarget]::Process)
Write-Host "Set environment variables:"
Write-Host " GIT_ASSEMBLY_SEM_FILE_VER = $assemblySemFileVer"
Write-Host " GIT_ASSEMBLY_SEM_VER = $assemblySemVer"
$versionInfo = Get-VersionInfo
# Step 3: Update export_presets.cfg
if (Test-Path $configFile) {
(Get-Content $configFile) `
-replace 'application/file_version="[^"]*"', "application/file_version=`"$assemblySemFileVer`"" `
-replace 'application/product_version="[^"]*"', "application/product_version=`"$assemblySemVer`"" `
| Set-Content $configFile
} else {
Write-Host "Warning: $configFile not found!"
Update-ExportConfig -VersionInfo $versionInfo
# Step 4: Export builds
$results = @{}
foreach ($platformKey in $platforms.Keys) {
Write-Host ""
$results[$platformKey] = Export-GodotPlatform -Platform $platformKey `
-GodotPath $godotPath `
-BuildDir $buildDir `
-VersionInfo $versionInfo
}
# Step 4: Export the build
#& $godotPath --headless --export-release "Windows Desktop" "$buildDir\win\$fileName.exe"
#& $godotPath --headless --export-release "Linux" "$buildDir\linux\$fileName.x86_64"
# Step 4: Export the Windows build via CMD in the same window
$winExportCmd = "`"$godotPath`" --headless --export-release `"Windows Desktop`" `"$buildDir\win\$fileName.exe`""
& cmd.exe /c $winExportCmd
# Step 5: Export the Linux build via CMD in the same window
$linuxExportCmd = "`"$godotPath`" --headless --export-release `"Linux`" `"$buildDir\linux\$fileName.x86_64`""
& cmd.exe /c $linuxExportCmd
Write-Host ""
Write-Host "=====================================" -ForegroundColor Cyan
Write-Host " Export Summary" -ForegroundColor Cyan
Write-Host "=====================================" -ForegroundColor Cyan
foreach ($platformKey in $results.Keys) {
$status = if ($results[$platformKey]) { "SUCCESS" } else { "FAILED" }
$color = if ($results[$platformKey]) { "Green" } else { "Red" }
Write-Host " $platformKey : $status" -ForegroundColor $color
}
Write-Host ""