-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
/
build.go
52 lines (45 loc) · 1.08 KB
/
build.go
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
52
package main
import (
"fmt"
"log"
"os"
"os/exec"
"path/filepath"
)
func runCommand(command string, args ...string) {
cmd := exec.Command(command, args...)
output, err := cmd.CombinedOutput()
fmt.Println(string(output))
if err != nil {
log.Println(string(output))
log.Fatal(err)
}
fmt.Println(string(output))
}
// A build step that requires additional params, or platform specific steps for example
func main() {
dir, _ := os.Getwd()
// Build Runtime
fmt.Println("**** Building Runtime ****")
runtimeDir, _ := filepath.Abs(filepath.Join(dir, "..", "runtime", "js"))
err := os.Chdir(runtimeDir)
if err != nil {
log.Fatal(err)
}
runCommand("npm", "install")
runCommand("npm", "run", "build")
// Install Wails
fmt.Println("**** Installing Wails locally ****")
execDir, _ := filepath.Abs(filepath.Join(dir, "..", "cmd", "wails"))
err = os.Chdir(execDir)
if err != nil {
log.Fatal(err)
}
runCommand("go", "install")
baseDir, _ := filepath.Abs(filepath.Join(dir, ".."))
err = os.Chdir(baseDir)
if err != nil {
log.Fatal(err)
}
runCommand("go", "mod", "tidy")
}