Commit 12f2ca92 by Torkel Ödegaard

updated build file

parent 5631d52f
...@@ -11,6 +11,7 @@ import ( ...@@ -11,6 +11,7 @@ import (
"log" "log"
"os" "os"
"os/exec" "os/exec"
"path"
"path/filepath" "path/filepath"
"regexp" "regexp"
"runtime" "runtime"
...@@ -20,12 +21,12 @@ import ( ...@@ -20,12 +21,12 @@ import (
) )
var ( var (
versionRe = regexp.MustCompile(`-[0-9]{1,3}-g[0-9a-f]{5,10}`) versionRe = regexp.MustCompile(`-[0-9]{1,3}-g[0-9a-f]{5,10}`)
goarch string goarch string
goos string goos string
noupgrade bool version string = "2.0.0-alpha"
version string = "2.0.0-alpha" race bool
race bool workingDir string
) )
const minGoVersion = 1.3 const minGoVersion = 1.3
...@@ -56,6 +57,8 @@ func main() { ...@@ -56,6 +57,8 @@ func main() {
return return
} }
workingDir, _ = os.Getwd()
for _, cmd := range flag.Args() { for _, cmd := range flag.Args() {
switch cmd { switch cmd {
case "setup": case "setup":
...@@ -64,17 +67,19 @@ func main() { ...@@ -64,17 +67,19 @@ func main() {
case "build": case "build":
pkg := "." pkg := "."
var tags []string var tags []string
if noupgrade {
tags = []string{"noupgrade"}
}
build(pkg, tags) build(pkg, tags)
case "test": case "test":
pkg := "./..." test("./pkg/...")
test(pkg)
case "package":
test("./pkg/...")
build(".", []string{})
case "build-ui":
buildFrontend()
case "clean": case "clean":
clean()
default: default:
log.Fatalf("Unknown command %q", cmd) log.Fatalf("Unknown command %q", cmd)
...@@ -82,6 +87,19 @@ func main() { ...@@ -82,6 +87,19 @@ func main() {
} }
} }
func ChangeWorkingDir(dir string) {
os.Chdir(dir)
}
func buildFrontend() {
ChangeWorkingDir(path.Join(workingDir, "grafana"))
defer func() {
ChangeWorkingDir(path.Join(workingDir, "../"))
}()
runPrint("grunt")
}
func setup() { func setup() {
runPrint("go", "get", "-v", "github.com/tools/godep") runPrint("go", "get", "-v", "github.com/tools/godep")
runPrint("go", "get", "-v", "github.com/mattn/go-sqlite3") runPrint("go", "get", "-v", "github.com/mattn/go-sqlite3")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment