make a simple build script

Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
Jeff Carr 2019-06-10 23:00:45 -07:00
parent 8d39c04b6a
commit fb4a2523b4
3 changed files with 52 additions and 14 deletions

15
.gitignore vendored
View File

@ -11,18 +11,5 @@ resources/BUILDDATE
cloud-control-panel
example-gui/example-gui
example-systray/example-systray
example-UI-table/example-UI-table
example-table/example-table
example-aminal/example-aminal
example-multiple-windows/example-multiple-windows
example-lookupAAAA/example-lookupAAAA
build/build
autobuild/autobuild
test1/test1
test2/test2
test3/test3
test4/test4
test5/test5

2
build/Makefile Normal file
View File

@ -0,0 +1,2 @@
all:
go build

49
build/build.go Normal file
View File

@ -0,0 +1,49 @@
package main
// This should build and upload the binary to mirrors
// upload binary to mirrors.wit.com/cloud/control-panel
import "log"
import "fmt"
import "time"
// import "github.com/davecgh/go-spew/spew"
import "git.wit.com/wit/shell"
// import "os/user"
// import "io/ioutil"
// github.com/bramvdbogaerde/go-scp
var filename string
var builddir string
func main() {
filename := "cloud-control-panel"
// shell.Quiet(true)
shell.Quiet(false)
gitref := shell.Run("git rev-list -1 HEAD")
// setup the files that will end up in the binary
epoch := fmt.Sprintf("%d", time.Now().Unix())
shell.Write("./resources/BUILDDATE", epoch)
shell.Write("./resources/BUILDREF", gitref)
// rebuild the binary (always remove the old one
shell.Run("rm " + filename)
shell.Run("packr build")
log.Println("build finished")
/*
md5sum = shell.Run("md5sum " + filename)
log.Println("\tmd5sum =", md5sum)
if (md5sum == "") {
log.Println("\tBUILD FAILED")
b = false
return &b
}
shell.Write("/tmp/autobuild.md5sum", md5sum)
*/
}