attempt to symlink plugin files
This commit is contained in:
parent
b55548a58b
commit
e796788e22
47
build.go
47
build.go
|
@ -90,13 +90,15 @@ func (f *Forge) doBuild(repo *gitpb.Repo, userFlags []string, goWhat string) err
|
|||
cmd = append(cmd, goWhat)
|
||||
}
|
||||
|
||||
_, fname := filepath.Split(repo.FullPath)
|
||||
homeDir, _ := os.UserHomeDir()
|
||||
soname := fname + "." + version + ".so"
|
||||
linkname := fname + ".so"
|
||||
sopath := filepath.Join(homeDir, "go/lib/go-gui")
|
||||
// if this is a plugin, use buildmode=plugin
|
||||
if repo.RepoType() == "plugin" {
|
||||
_, fname := filepath.Split(repo.FullPath)
|
||||
soname := fname + "." + version + ".so"
|
||||
if goWhat == "install" {
|
||||
homeDir, _ := os.UserHomeDir()
|
||||
fullname := filepath.Join(homeDir, "go/lib", soname)
|
||||
fullname := filepath.Join(sopath, soname)
|
||||
cmd = append(cmd, "-buildmode=plugin", "-o", fullname)
|
||||
} else {
|
||||
cmd = append(cmd, "-buildmode=plugin", "-o", soname)
|
||||
|
@ -130,25 +132,38 @@ func (f *Forge) doBuild(repo *gitpb.Repo, userFlags []string, goWhat string) err
|
|||
log.Info("running:", repo.FullPath)
|
||||
log.Info("running:", cmd)
|
||||
result := repo.RunRealtime(cmd)
|
||||
if result.Exit == 0 {
|
||||
log.Info(strings.Join(result.Stdout, "\n"))
|
||||
return nil
|
||||
} else {
|
||||
if result.Exit != 0 {
|
||||
// build failed
|
||||
log.DaemonMode(true)
|
||||
log.Info(strings.Join(result.Stdout, "\n"))
|
||||
log.Info(strings.Join(result.Stderr, "\n"))
|
||||
log.Info("result.Error =", result.Error)
|
||||
log.Info("result.Exit =", result.Exit)
|
||||
log.DaemonMode(false)
|
||||
log.Warn("go build failed", cmd)
|
||||
pwd, _ := os.Getwd()
|
||||
log.Warn("go build pwd", pwd)
|
||||
res2 := shell.RunEcho(cmd)
|
||||
if res2.Exit == 0 {
|
||||
log.Info("again failed", res2.Exit)
|
||||
log.Info("again failed cmd", strings.Join(cmd, "a"))
|
||||
log.Info("again failed", strings.Join(res2.Stdout, "\n"))
|
||||
}
|
||||
/*
|
||||
pwd, _ := os.Getwd()
|
||||
log.Warn("go build pwd", pwd)
|
||||
res2 := shell.RunEcho(cmd)
|
||||
if res2.Exit == 0 {
|
||||
log.Info("again failed", res2.Exit)
|
||||
log.Info("again failed cmd", strings.Join(cmd, "a"))
|
||||
log.Info("again failed", strings.Join(res2.Stdout, "\n"))
|
||||
}
|
||||
*/
|
||||
return errors.New("go " + goWhat + " failed: " + fmt.Sprint(result.Error))
|
||||
}
|
||||
// make symlinks
|
||||
if repo.RepoType() == "plugin" {
|
||||
cmd := []string{"ln", "-sf", soname, linkname}
|
||||
if goWhat == "install" {
|
||||
shell.PathRun(sopath, cmd)
|
||||
} else {
|
||||
repo.Run(cmd)
|
||||
}
|
||||
}
|
||||
log.Info(strings.Join(result.Stdout, "\n"))
|
||||
return nil
|
||||
}
|
||||
|
||||
func (f *Forge) runAutogenpb(repo *gitpb.Repo) error {
|
||||
|
|
Loading…
Reference in New Issue