2024-01-16 04:46:17 -06:00
|
|
|
// This is a simple example
|
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"os"
|
|
|
|
"strings"
|
|
|
|
|
|
|
|
"go.wit.com/log"
|
|
|
|
|
|
|
|
"go.wit.com/gui/gui"
|
|
|
|
"go.wit.com/gui/gadgets"
|
|
|
|
)
|
|
|
|
|
|
|
|
func doesExist(path string) bool {
|
|
|
|
if _, err := os.Stat(path); err != nil {
|
|
|
|
if os.IsNotExist(err) {
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return true
|
|
|
|
}
|
|
|
|
|
|
|
|
func globalBuildOptions(box *gui.Node) {
|
|
|
|
var setCurrentBranch *gui.Node
|
|
|
|
group1 := box.NewGroup("Global Build Options")
|
|
|
|
groupvbox := group1.NewBox("bw vbox", false)
|
|
|
|
// grouphbox := groupvbox.NewBox("bw hbox", true)
|
|
|
|
|
|
|
|
grid := groupvbox.NewGrid("buildOptions",2, 1)
|
|
|
|
|
|
|
|
me.mainBranch = gadgets.NewBasicCombobox(grid, "default main branch")
|
2024-01-17 03:57:17 -06:00
|
|
|
me.mainBranch.AddText("guimain")
|
|
|
|
me.mainBranch.AddText("gitea server default")
|
2024-01-16 04:46:17 -06:00
|
|
|
me.mainBranch.Disable()
|
|
|
|
|
|
|
|
me.develBranch = gadgets.NewBasicCombobox(grid, "default devel branch")
|
2024-01-17 03:57:17 -06:00
|
|
|
me.develBranch.AddText("devel")
|
2024-01-16 04:46:17 -06:00
|
|
|
|
|
|
|
me.userBranch = gadgets.NewBasicCombobox(grid, "default user branch")
|
2024-01-17 03:57:17 -06:00
|
|
|
me.userBranch.AddText("jcarr")
|
2024-01-16 04:46:17 -06:00
|
|
|
|
|
|
|
// select the branch you want to test, build and develop against
|
|
|
|
// this lets you select your user branch, but, when you are happy
|
|
|
|
// you can merge everything into the devel branch and make sure it actually
|
|
|
|
// works. Then, when that is good, merge and version everything in master
|
|
|
|
guiBranch := gadgets.NewBasicCombobox(grid, "Set Current Working Branch")
|
2024-01-17 03:57:17 -06:00
|
|
|
guiBranch.AddText("guimaster")
|
|
|
|
guiBranch.AddText("guidevel")
|
|
|
|
guiBranch.AddText("jcarr")
|
2024-01-16 04:46:17 -06:00
|
|
|
guiBranch.Custom = func () {
|
2024-01-17 03:57:17 -06:00
|
|
|
me.toMoveToBranch = guiBranch.String()
|
2024-01-16 04:46:17 -06:00
|
|
|
setCurrentBranch.Set("set all branches to " + me.toMoveToBranch)
|
|
|
|
me.mainBranch.Disable()
|
|
|
|
}
|
|
|
|
setCurrentBranch = groupvbox.NewButton("set all branches to", func () {
|
|
|
|
for _, repo := range allrepos {
|
|
|
|
var changeBranch [][]string
|
|
|
|
// realname, realversion := repo.status.CheckoutBranch(me.toMoveToBranch)
|
|
|
|
// log.Warn("GOT", realname, realversion)
|
|
|
|
path := repo.status.GetPath()
|
|
|
|
changeBranch = append(changeBranch, []string{"cd", "go/src/" + path})
|
|
|
|
changeBranch = append(changeBranch, []string{"git", "checkout", me.toMoveToBranch})
|
|
|
|
me.script = changeBranch
|
|
|
|
setGitCommands()
|
|
|
|
goMake("--doit")
|
|
|
|
return
|
|
|
|
}
|
|
|
|
})
|
|
|
|
var everything *gui.Node
|
|
|
|
everything = groupvbox.NewButton("go get everything on go.wit.com", func () {
|
|
|
|
var perfect bool = true
|
|
|
|
var newCmds [][]string
|
|
|
|
// usr, _ := user.Current()
|
|
|
|
newCmds = append(newCmds, []string{"cd", "go/src/gui/app/myrepos"})
|
|
|
|
repos := myrepolist()
|
|
|
|
for _, line := range repos {
|
|
|
|
log.Warn("repo =", line)
|
|
|
|
path, _, _, _ := splitLine(line)
|
|
|
|
path = strings.TrimSpace(path)
|
|
|
|
if path == "#" {
|
|
|
|
// skip comment lines
|
|
|
|
continue
|
|
|
|
}
|
|
|
|
if doesExist("/home/jcarr/go/src/" + path) {
|
|
|
|
continue
|
|
|
|
}
|
|
|
|
newCmds = append(newCmds, []string{"go", "get", "-v", path})
|
|
|
|
perfect = false
|
|
|
|
}
|
|
|
|
|
|
|
|
if perfect {
|
|
|
|
var notes [][]string
|
|
|
|
notes = append(notes, []string{"you have already downloaded"})
|
|
|
|
notes = append(notes, []string{"everything on go.wit.com"})
|
|
|
|
me.script = notes
|
|
|
|
setGitCommands()
|
|
|
|
doit.Disable()
|
|
|
|
everything.Disable()
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
me.script = newCmds
|
|
|
|
doit.Enable()
|
|
|
|
setGitCommands()
|
|
|
|
})
|
|
|
|
groupvbox.NewButton("build all apps", func () {
|
|
|
|
})
|
|
|
|
}
|