1 Star 0 Fork 0

wuzpdev / goworld

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
build.go 1.05 KB
一键复制 编辑 原始数据 按行查看 历史
package main
import (
"os"
"os/exec"
"path/filepath"
)
func build(sid ServerID) {
showMsg("building server %s ...", sid)
buildServer(sid)
buildDispatcher()
buildGate()
}
func buildServer(sid ServerID) {
serverPath := sid.Path()
showMsg("server directory is %s ...", serverPath)
if !isdir(serverPath) {
showMsgAndQuit("wrong server id: %s, using '\\' instead of '/'?", sid)
}
showMsg("go build %s ...", sid)
buildDirectory(serverPath)
}
func buildDispatcher() {
showMsg("go build dispatcher ...")
buildDirectory(filepath.Join(env.GoWorldRoot, "components", "dispatcher"))
}
func buildGate() {
showMsg("go build gate ...")
buildDirectory(filepath.Join(env.GoWorldRoot, "components", "gate"))
}
func buildDirectory(dir string) {
var err error
var curdir string
curdir, err = os.Getwd()
checkErrorOrQuit(err, "")
err = os.Chdir(dir)
checkErrorOrQuit(err, "")
defer os.Chdir(curdir)
cmd := exec.Command("go", "build", ".")
cmd.Stderr = os.Stderr
cmd.Stdout = os.Stdout
cmd.Stdin = os.Stdin
err = cmd.Run()
checkErrorOrQuit(err, "")
return
}
1
https://gitee.com/wuzpdev/goworld.git
git@gitee.com:wuzpdev/goworld.git
wuzpdev
goworld
goworld
v0.1.6

搜索帮助