-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.ps1
43 lines (43 loc) · 1.43 KB
/
build.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
if (($args[0]) -eq "final")
{
Write-Host "With optimizations ON"
if (Test-Path -Path "./out/build")
{
# Assume the rest exists
# GHC may or may not force a rebuild if optimization changes, but I am not sure, so delete the cache just to be certain
Remove-Item "./out/build" -Recurse
Remove-Item "./out/cache" -Recurse
Remove-Item "./out/packagedb" -Recurse
Remove-Item "./out/tmp" -Recurse
}
cabal build --builddir=./out
$extraelmflags = "--optimize"
}
else
{
cabal build --builddir=./out --flags="debug"
$extraelmflags = ""
}
$ghcver = Invoke-Expression -Command "ghc --numeric-version"
$version = "1.3.0.0"
New-Item -ItemType Directory -Force -Path out
New-Item -ItemType Directory -Force -Path out/frontend
if ($IsLinux)
{
$system = "x86_64-linux"
$exe = "tf2-web-server-manager"
}
if ($IsWindows)
{
$system = "x86_64-windows"
$exe = "tf2-web-server-manager.exe"
}
$exe_path = "./out/build/" + $system + "/ghc-" + $ghcver + "/tf2-web-server-manager-" + $version + "/x/tf2-web-server-manager/build/tf2-web-server-manager/" + $exe
$out_exe = "./out/" + $exe
Write-Host ("Copying: " + $exe_path)
Copy-Item $exe_path $out_exe -Force
cd frontend
Get-ChildItem static | Copy-Item -Destination ../out/frontend -Recurse
elm make src/login.elm --output=../out/frontend/login.js $extraelmflags
elm make src/server.elm --output=../out/frontend/server.js $extraelmflags
cd ..