mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-01 08:55:35 +00:00
186 lines
5.9 KiB
PowerShell
186 lines
5.9 KiB
PowerShell
|
|
# Build and Publish Script for Cirno No Reason
|
|||
|
|
# Interactive launcher with proper Godot export handling
|
|||
|
|
|
|||
|
|
param(
|
|||
|
|
[string]$Operation
|
|||
|
|
)
|
|||
|
|
|
|||
|
|
# Import the module
|
|||
|
|
$modulePath = Join-Path $PSScriptRoot "CirnoBuild.psm1"
|
|||
|
|
Import-Module $modulePath -Force
|
|||
|
|
|
|||
|
|
# Configuration
|
|||
|
|
$script:godotPath = $env:GODOT
|
|||
|
|
$script:butlerPath = "F:\Apps\butler\butler.exe"
|
|||
|
|
$script:buildDir = ".\build"
|
|||
|
|
$script:releaseDir = ".\release"
|
|||
|
|
$script:platforms = Get-PlatformConfigurations
|
|||
|
|
|
|||
|
|
function Show-Menu {
|
|||
|
|
Clear-Host
|
|||
|
|
Write-Host "=====================================" -ForegroundColor Cyan
|
|||
|
|
Write-Host " Cirno No Reason - Build & Publish" -ForegroundColor Cyan
|
|||
|
|
Write-Host "=====================================" -ForegroundColor Cyan
|
|||
|
|
Write-Host ""
|
|||
|
|
Write-Host "1. Build Windows" -ForegroundColor Green
|
|||
|
|
Write-Host "2. Build Linux" -ForegroundColor Green
|
|||
|
|
Write-Host "3. Build Windows + Linux" -ForegroundColor Green
|
|||
|
|
Write-Host "4. Publish Windows" -ForegroundColor Yellow
|
|||
|
|
Write-Host "5. Publish Linux" -ForegroundColor Yellow
|
|||
|
|
Write-Host "6. Publish Windows + Linux" -ForegroundColor Yellow
|
|||
|
|
Write-Host "7. Build and Publish Windows + Linux" -ForegroundColor Magenta
|
|||
|
|
Write-Host "0. Exit" -ForegroundColor Red
|
|||
|
|
Write-Host ""
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
function Build-Platforms {
|
|||
|
|
param([string[]]$PlatformsToBuild)
|
|||
|
|
|
|||
|
|
Write-Host ""
|
|||
|
|
Write-Host "========================================" -ForegroundColor Cyan
|
|||
|
|
Write-Host " Starting Build Process" -ForegroundColor Cyan
|
|||
|
|
Write-Host "========================================" -ForegroundColor Cyan
|
|||
|
|
|
|||
|
|
$prereqResult = Test-Prerequisites -GodotPath $script:godotPath -ButlerPath $script:butlerPath -SkipButler
|
|||
|
|
if (-not $prereqResult.Valid) {
|
|||
|
|
return @{}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
# Use resolved path if available
|
|||
|
|
if ($prereqResult.ResolvedGodotPath) {
|
|||
|
|
$script:godotPath = $prereqResult.ResolvedGodotPath
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
$versionInfo = Get-VersionInfo
|
|||
|
|
Initialize-BuildDirectories -PlatformsToBuild $PlatformsToBuild -BuildDir $script:buildDir
|
|||
|
|
Update-ExportConfig -VersionInfo $versionInfo
|
|||
|
|
|
|||
|
|
$results = @{}
|
|||
|
|
foreach ($platform in $PlatformsToBuild) {
|
|||
|
|
$results[$platform] = Export-GodotPlatform -Platform $platform `
|
|||
|
|
-GodotPath $script:godotPath `
|
|||
|
|
-BuildDir $script:buildDir `
|
|||
|
|
-VersionInfo $versionInfo
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
Write-Host ""
|
|||
|
|
Write-Host "Build Summary:" -ForegroundColor Cyan
|
|||
|
|
foreach ($platform in $PlatformsToBuild) {
|
|||
|
|
$status = if ($results[$platform]) { "SUCCESS" } else { "FAILED" }
|
|||
|
|
$color = if ($results[$platform]) { "Green" } else { "Red" }
|
|||
|
|
Write-Host " $platform : $status" -ForegroundColor $color
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return $results
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
function Publish-Platforms {
|
|||
|
|
param([string[]]$PlatformsToPublish)
|
|||
|
|
|
|||
|
|
Write-Host ""
|
|||
|
|
Write-Host "========================================" -ForegroundColor Cyan
|
|||
|
|
Write-Host " Starting Publish Process" -ForegroundColor Cyan
|
|||
|
|
Write-Host "========================================" -ForegroundColor Cyan
|
|||
|
|
|
|||
|
|
$prereqResult = Test-Prerequisites -GodotPath $script:godotPath -ButlerPath $script:butlerPath
|
|||
|
|
if (-not $prereqResult.Valid) {
|
|||
|
|
return @{}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
# Use resolved path if available
|
|||
|
|
if ($prereqResult.ResolvedGodotPath) {
|
|||
|
|
$script:godotPath = $prereqResult.ResolvedGodotPath
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
$versionInfo = Get-VersionInfo
|
|||
|
|
|
|||
|
|
$results = @{}
|
|||
|
|
foreach ($platform in $PlatformsToPublish) {
|
|||
|
|
$results[$platform] = Publish-PlatformBuild -Platform $platform `
|
|||
|
|
-VersionInfo $versionInfo `
|
|||
|
|
-BuildDir $script:buildDir `
|
|||
|
|
-ReleaseDir $script:releaseDir `
|
|||
|
|
-ButlerPath $script:butlerPath
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
Write-Host ""
|
|||
|
|
Write-Host "Publish Summary:" -ForegroundColor Cyan
|
|||
|
|
foreach ($platform in $PlatformsToPublish) {
|
|||
|
|
$status = if ($results[$platform]) { "SUCCESS" } else { "FAILED" }
|
|||
|
|
$color = if ($results[$platform]) { "Green" } else { "Red" }
|
|||
|
|
Write-Host " $platform : $status" -ForegroundColor $color
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
return $results
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
function Invoke-Operation {
|
|||
|
|
param([string]$Choice)
|
|||
|
|
|
|||
|
|
switch ($Choice) {
|
|||
|
|
"1" {
|
|||
|
|
Build-Platforms -PlatformsToBuild @("win")
|
|||
|
|
}
|
|||
|
|
"2" {
|
|||
|
|
Build-Platforms -PlatformsToBuild @("linux")
|
|||
|
|
}
|
|||
|
|
"3" {
|
|||
|
|
Build-Platforms -PlatformsToBuild @("win", "linux")
|
|||
|
|
}
|
|||
|
|
"4" {
|
|||
|
|
Publish-Platforms -PlatformsToPublish @("win")
|
|||
|
|
}
|
|||
|
|
"5" {
|
|||
|
|
Publish-Platforms -PlatformsToPublish @("linux")
|
|||
|
|
}
|
|||
|
|
"6" {
|
|||
|
|
Publish-Platforms -PlatformsToPublish @("win", "linux")
|
|||
|
|
}
|
|||
|
|
"7" {
|
|||
|
|
$buildResults = Build-Platforms -PlatformsToBuild @("win", "linux")
|
|||
|
|
|
|||
|
|
$platformsToPublish = @()
|
|||
|
|
foreach ($platform in @("win", "linux")) {
|
|||
|
|
if ($buildResults[$platform]) {
|
|||
|
|
$platformsToPublish += $platform
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
if ($platformsToPublish.Count -gt 0) {
|
|||
|
|
Publish-Platforms -PlatformsToPublish $platformsToPublish
|
|||
|
|
} else {
|
|||
|
|
Write-Host ""
|
|||
|
|
Write-Host "ERROR: No successful builds to publish!" -ForegroundColor Red
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
"0" {
|
|||
|
|
Write-Host "Exiting..." -ForegroundColor Yellow
|
|||
|
|
exit 0
|
|||
|
|
}
|
|||
|
|
default {
|
|||
|
|
Write-Host "Invalid selection!" -ForegroundColor Red
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
# Main execution
|
|||
|
|
if ($Operation) {
|
|||
|
|
Invoke-Operation -Choice $Operation
|
|||
|
|
} else {
|
|||
|
|
while ($true) {
|
|||
|
|
Show-Menu
|
|||
|
|
$choice = Read-Host "Select an option (0-7)"
|
|||
|
|
|
|||
|
|
if ($choice -eq "0") {
|
|||
|
|
Write-Host "Exiting..." -ForegroundColor Yellow
|
|||
|
|
break
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
Invoke-Operation -Choice $choice
|
|||
|
|
|
|||
|
|
Write-Host ""
|
|||
|
|
Write-Host "Press any key to continue..." -ForegroundColor Yellow
|
|||
|
|
$null = $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown")
|
|||
|
|
}
|
|||
|
|
}
|