-
Notifications
You must be signed in to change notification settings - Fork 0
/
BuildAndRun.ps1
47 lines (40 loc) · 912 Bytes
/
BuildAndRun.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
param (
[string]$build = ".\builds",
[string]$source = ".\source",
[string]$name = (Get-Item -Path .).BaseName,
[switch]$dontbuild = $false
)
$pdx = Join-Path -Path "$build" -ChildPath "$name.pdx"
# Create build folder if not present
if (!$dontbuild)
{
New-Item -ItemType Directory -Force -Path "$build"
}
# Clean build folder
if (!$dontbuild)
{
Remove-Item "$build\*" -Recurse -Force
}
# Build
if (!$dontbuild)
{
pdc -sdkpath "$Env:PLAYDATE_SDK_PATH" "$source" "$pdx"
}
# Close Simulator
$sim = Get-Process "PlaydateSimulator" -ErrorAction SilentlyContinue
if ($sim)
{
$sim.CloseMainWindow()
$count = 0
while (!$sim.HasExited)
{
Start-Sleep -Milliseconds 10
$count += 1
if ($count -ge 5)
{
$sim | Stop-Process -Force
}
}
}
# Run (Simulator)
& "$Env:PLAYDATE_SDK_PATH\bin\PlaydateSimulator.exe" "$pdx"