Merge pull request #89 from barakmich/build_versioning
Add automatic linker build versioning
This commit is contained in:
commit
2673911c0f
2 changed files with 24 additions and 6 deletions
|
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"Arch": "amd64 386",
|
"Arch": "arm amd64 386",
|
||||||
"Os": "linux darwin windows",
|
"Os": "linux darwin windows",
|
||||||
"ResourcesInclude": "README.md,static,templates,LICENSE,AUTHORS,CONTRIBUTORS,docs,cayley.cfg.example,30kmoviedata.nq.gz,testdata.nq",
|
"ResourcesInclude": "README.md,static,templates,LICENSE,AUTHORS,CONTRIBUTORS,docs,cayley.cfg.example,30kmoviedata.nq.gz,testdata.nq",
|
||||||
"ConfigVersion": "0.9"
|
"ConfigVersion": "0.9"
|
||||||
|
|
|
||||||
28
cayley.go
28
cayley.go
|
|
@ -40,15 +40,20 @@ var cpuprofile = flag.String("prof", "", "Output profiling file.")
|
||||||
var queryLanguage = flag.String("query_lang", "gremlin", "Use this parser as the query language.")
|
var queryLanguage = flag.String("query_lang", "gremlin", "Use this parser as the query language.")
|
||||||
var configFile = flag.String("config", "", "Path to an explicit configuration file.")
|
var configFile = flag.String("config", "", "Path to an explicit configuration file.")
|
||||||
|
|
||||||
|
// Filled in by `go build ldflags="-X main.VERSION `ver`"`.
|
||||||
|
var BUILD_DATE string
|
||||||
|
var VERSION string
|
||||||
|
|
||||||
func Usage() {
|
func Usage() {
|
||||||
fmt.Println("Cayley is a graph store and graph query layer.")
|
fmt.Println("Cayley is a graph store and graph query layer.")
|
||||||
fmt.Println("\nUsage:")
|
fmt.Println("\nUsage:")
|
||||||
fmt.Println(" cayley COMMAND [flags]")
|
fmt.Println(" cayley COMMAND [flags]")
|
||||||
fmt.Println("\nCommands:")
|
fmt.Println("\nCommands:")
|
||||||
fmt.Println(" init\tCreate an empty database.")
|
fmt.Println(" init Create an empty database.")
|
||||||
fmt.Println(" load\tBulk-load a triple file into the database.")
|
fmt.Println(" load Bulk-load a triple file into the database.")
|
||||||
fmt.Println(" http\tServe an HTTP endpoint on the given host and port.")
|
fmt.Println(" http Serve an HTTP endpoint on the given host and port.")
|
||||||
fmt.Println(" repl\tDrop into a REPL of the given query language.")
|
fmt.Println(" repl Drop into a REPL of the given query language.")
|
||||||
|
fmt.Println(" version Version information.")
|
||||||
fmt.Println("\nFlags:")
|
fmt.Println("\nFlags:")
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
flag.PrintDefaults()
|
flag.PrintDefaults()
|
||||||
|
|
@ -62,12 +67,18 @@ func main() {
|
||||||
}
|
}
|
||||||
|
|
||||||
cmd := os.Args[1]
|
cmd := os.Args[1]
|
||||||
newargs := make([]string, 0)
|
var newargs []string
|
||||||
newargs = append(newargs, os.Args[0])
|
newargs = append(newargs, os.Args[0])
|
||||||
newargs = append(newargs, os.Args[2:]...)
|
newargs = append(newargs, os.Args[2:]...)
|
||||||
os.Args = newargs
|
os.Args = newargs
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
|
|
||||||
|
var buildString string
|
||||||
|
if VERSION != "" {
|
||||||
|
buildString = fmt.Sprint("Cayley ", VERSION, " built ", BUILD_DATE)
|
||||||
|
glog.Infoln(buildString)
|
||||||
|
}
|
||||||
|
|
||||||
cfg := config.ParseConfigFromFlagsAndFile(*configFile)
|
cfg := config.ParseConfigFromFlagsAndFile(*configFile)
|
||||||
|
|
||||||
if os.Getenv("GOMAXPROCS") == "" {
|
if os.Getenv("GOMAXPROCS") == "" {
|
||||||
|
|
@ -82,6 +93,13 @@ func main() {
|
||||||
err error
|
err error
|
||||||
)
|
)
|
||||||
switch cmd {
|
switch cmd {
|
||||||
|
case "version":
|
||||||
|
if VERSION != "" {
|
||||||
|
fmt.Println(buildString)
|
||||||
|
} else {
|
||||||
|
fmt.Println("Cayley snapshot")
|
||||||
|
}
|
||||||
|
os.Exit(0)
|
||||||
case "init":
|
case "init":
|
||||||
err = db.Init(cfg, *tripleFile)
|
err = db.Init(cfg, *tripleFile)
|
||||||
case "load":
|
case "load":
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue