-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathgobl.go
More file actions
51 lines (44 loc) · 1.03 KB
/
gobl.go
File metadata and controls
51 lines (44 loc) · 1.03 KB
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
48
49
50
51
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/**", "internal/**", "pkg/**", "stuff/**").
Signaler(SigQuit).
Run("build").
Run("run")
Task("build-web").
Env("GOOS=js", "GOARCH=wasm").
Exec("go", "build", "-o", "web/ebijam25.wasm", "./cmd/game").
Exec("go", "env", "GOROOT").
Result(func(i interface{}) {
goRoot := strings.TrimSpace(i.(string))
wasmSrc = filepath.Join(goRoot, "lib/wasm/wasm_exec.js")
}).
Exec("cp", &wasmSrc, "./web/")
// Mob
Task("mob-build").
Exec("go", "build", "./prototype/mob")
Task("mob-run").
Exec(append([]interface{}{}, "./mob"+exe)...)
Task("mob-watch").
Watch("internal/**", "pkg/**", "prototype/mob/**").
Signaler(SigQuit).
Run("mob-build").
Run("mob-run")
Go()
}