2023-08-27 02:41:07 +01:00
|
|
|
param(
|
|
|
|
[Parameter(Mandatory = $true)]
|
|
|
|
[string]$prefix,
|
|
|
|
[string]$theme
|
|
|
|
)
|
|
|
|
|
2025-01-15 20:56:11 +00:00
|
|
|
function Format-SpecName {
|
|
|
|
param(
|
|
|
|
[string]$Kind
|
|
|
|
)
|
2023-08-27 02:41:07 +01:00
|
|
|
return @(
|
|
|
|
$prefix,
|
|
|
|
(& { if ($theme) { $theme } else { "" } }),
|
2025-01-15 20:56:11 +00:00
|
|
|
$Kind
|
2023-08-27 02:41:07 +01:00
|
|
|
).Where({ $_ -ne "" }) -Join "_"
|
|
|
|
}
|
|
|
|
|
|
|
|
function Compress-Builds {
|
|
|
|
$target = Join-Path -Path $PSScriptRoot -ChildPath "dist"
|
|
|
|
@("basic", "banana", "potato") | ForEach-Object {
|
2025-01-15 20:56:11 +00:00
|
|
|
$compressPath = Format-SpecName -Kind $_
|
|
|
|
Compress-Archive -Path (Join-Path -Path $target -ChildPath $compressPath) -DestinationPath (Join-Path -Path $target -ChildPath "${compressPath}.zip") -Force
|
2023-08-27 02:41:07 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function Get-Builds {
|
|
|
|
@("basic", "banana", "potato") | ForEach-Object {
|
2025-01-15 20:56:11 +00:00
|
|
|
$specName = Format-SpecName -Kind $_
|
2023-08-27 02:41:07 +01:00
|
|
|
|
2025-01-15 20:56:11 +00:00
|
|
|
Write-Host "building $specName"
|
2023-08-27 02:41:07 +01:00
|
|
|
|
2025-01-15 20:56:11 +00:00
|
|
|
poetry run pyinstaller --noconfirm --distpath (Join-Path -Path "dist" -ChildPath $specName) (Join-Path -Path "spec" -ChildPath "${specName}.spec")
|
|
|
|
}
|
2023-08-27 02:41:07 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
function main {
|
|
|
|
Get-Builds
|
|
|
|
Compress-Builds
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($MyInvocation.InvocationName -ne '.') { main }
|