Files

53 lines
1.1 KiB
Go
Raw Permalink Normal View History

2019-11-02 21:06:02 +11:00
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()
2019-11-27 22:55:19 +11:00
fmt.Println(string(output))
2019-11-02 21:06:02 +11:00
if err != nil {
2019-11-27 21:28:33 +11:00
log.Println(string(output))
2019-11-02 21:06:02 +11:00
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"))
2021-04-02 20:44:55 +11:00
err := os.Chdir(runtimeDir)
if err != nil {
log.Fatal(err)
}
2019-11-02 21:06:02 +11:00
runCommand("npm", "install")
runCommand("npm", "run", "build")
// Install Wails
fmt.Println("**** Installing Wails locally ****")
execDir, _ := filepath.Abs(filepath.Join(dir, "..", "cmd", "wails"))
2021-04-02 20:44:55 +11:00
err = os.Chdir(execDir)
if err != nil {
log.Fatal(err)
}
2019-11-02 21:06:02 +11:00
runCommand("go", "install")
baseDir, _ := filepath.Abs(filepath.Join(dir, ".."))
2021-04-02 20:44:55 +11:00
err = os.Chdir(baseDir)
if err != nil {
log.Fatal(err)
}
2019-11-02 21:06:02 +11:00
runCommand("go", "mod", "tidy")
}