diff options
Diffstat (limited to 'build.go')
| -rw-r--r-- | build.go | 20 |
1 files changed, 14 insertions, 6 deletions
@@ -1,14 +1,12 @@ package forgepb // for golang repos, this is an attempt to build the package -// there might be some 'standard' ways to implement a build -// that make sense. - +// // Additions to 'go build' that are attempted here: // // * detect packages that are plugins -// * autogen packages that have .proto protobuf files -// * define some 'standard' ldflags +// * run autogenpb packages that have .proto protobuf files +// * use some 'standard' ldflags (VERISON, BUILDTIME) // import ( @@ -66,6 +64,8 @@ func (f *Forge) doBuild(repo *gitpb.Repo, userFlags []string, goWhat string) err repo.RedoGoMod() f.Repos.ConfigSave() } + + // run autogenpb in all protobuf repos loop1 := repo.GoDeps.SortByGoPath() for loop1.Scan() { t := loop1.Next() @@ -80,7 +80,14 @@ func (f *Forge) doBuild(repo *gitpb.Repo, userFlags []string, goWhat string) err if repo.CheckDirty() { version = version + "-dirty" } - cmd := []string{"go", goWhat, "-v"} + cmd := []string{"go", goWhat} + + // if this is a plugin, use buildmode=plugin + if repo.RepoType() == "plugin" { + _, fname := filepath.Split(repo.FullPath) + cmd = append(cmd, "-buildmode=plugin", "-o", fname+".so") + } + cmd = append(cmd, "-v") // set standard ldflag options now := time.Now() @@ -105,6 +112,7 @@ func (f *Forge) doBuild(repo *gitpb.Repo, userFlags []string, goWhat string) err } else { log.Info("GO111MODULE=", testenv, "f.goWork =", f.IsGoWork(), "f.gosrc =", f.GetGoSrc()) } + log.Info("running:", repo.FullPath) log.Info("running:", cmd) result := repo.RunRealtime(cmd) if result.Exit == 0 { |
