-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathgobl.go
More file actions
39 lines (34 loc) · 837 Bytes
/
gobl.go
File metadata and controls
39 lines (34 loc) · 837 Bytes
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
package main
import (
"path/filepath"
"runtime"
"strings"
. "github.com/kettek/gobl"
)
func main() {
var exe string
if runtime.GOOS == "windows" {
exe = ".exe"
}
runArgs := append([]interface{}{}, "./game"+exe)
var wasmSrc string
Task("build").
Exec("go", "build", "./cmd/game")
Task("run").
Exec(runArgs...)
Task("watch").
Watch("cmd/game/*", "internal/game/*", "internal/render/*", "assets/*", "assets/walls/*", "assets/floors/*").
Signaler(SigQuit).
Run("build").
Run("run")
Task("build-web").
Env("GOOS=js", "GOARCH=wasm").
Exec("go", "build", "-o", "web/ebijam24.wasm", "./cmd/game").
Exec("go", "env", "GOROOT").
Result(func(i interface{}) {
goRoot := strings.TrimSpace(i.(string))
wasmSrc = filepath.Join(goRoot, "misc/wasm/wasm_exec.js")
}).
Exec("cp", &wasmSrc, "web/")
Go()
}