call task from poe

remove build.ps1 and scripts.py
This commit is contained in:
Onyx and Iris 2025-02-13 16:23:35 +00:00
parent 1d8ffdc756
commit 293bccc5ba
4 changed files with 10 additions and 70 deletions

View File

@ -63,7 +63,7 @@ tasks:
- for:
matrix:
KIND: [basic, banana, potato]
cmd: '{{.SHELL}} -Command "Compress-Archive -Path dist/sunvalley-{{.ITEM.KIND}} -DestinationPath dist/sunvalley-{{.ITEM.KIND}}.zip"'
cmd: '{{.SHELL}} -Command "Compress-Archive -Path dist/sunvalley-{{.ITEM.KIND}} -DestinationPath dist/sunvalley-{{.ITEM.KIND}}.zip -Force"'
compress-forest:
cmds:
@ -71,7 +71,7 @@ tasks:
matrix:
KIND: [basic, banana, potato]
THEME: [light, dark]
cmd: '{{.SHELL}} -Command "Compress-Archive -Path dist/forest-{{.ITEM.KIND}}-{{.ITEM.THEME}} -DestinationPath dist/forest-{{.ITEM.KIND}}-{{.ITEM.THEME}}.zip"'
cmd: '{{.SHELL}} -Command "Compress-Archive -Path dist/forest-{{.ITEM.KIND}}-{{.ITEM.THEME}} -DestinationPath dist/forest-{{.ITEM.KIND}}-{{.ITEM.THEME}}.zip -Force"'
clean:
desc: Clean up build and dist directories

View File

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

View File

@ -38,9 +38,14 @@ requires = ["poetry-core>=2.0.0,<3.0.0"]
build-backend = "poetry.core.masonry.api"
[tool.poe.tasks]
build_sunvalley.script = "scripts:build_sunvalley"
build_forest.script = "scripts:build_forest"
build_all.script = "scripts:build_all"
build-sunvalley = "task build-sunvalley"
build-forest = "task build-forest"
release = [
{ ref = "build-sunvalley" },
{ ref = "build-forest" },
{ cmd = "task compress-sunvalley" },
{ cmd = "task compress-forest" },
]
[tool.ruff]
exclude = [

View File

@ -1,24 +0,0 @@
import subprocess
import sys
from pathlib import Path
def build_sunvalley():
buildscript = Path.cwd() / 'build.ps1'
subprocess.run(['powershell', str(buildscript), 'sunvalley'])
def build_forest():
rewriter = Path.cwd() / 'tools' / 'rewriter.py'
subprocess.run([sys.executable, str(rewriter), '--rewrite'])
buildscript = Path.cwd() / 'build.ps1'
for theme in ('light', 'dark'):
subprocess.run(['powershell', str(buildscript), 'forest', theme])
subprocess.run([sys.executable, str(rewriter), '--restore'])
def build_all():
steps = (build_sunvalley, build_forest)
[step() for step in steps]