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