diff options
| author | Jeff Carr <[email protected]> | 2025-01-09 04:35:48 -0600 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2025-01-09 04:35:48 -0600 |
| commit | 62c93069c59cd03a3698b885a2ae2add2eef25bc (patch) | |
| tree | 152c8fdf3d41ef892fb518af1d617f13697e3272 /protoc.go | |
| parent | 213f719621e8fe107201b9393eda420ad7f54965 (diff) | |
protoc is running
Signed-off-by: Jeff Carr <[email protected]>
Diffstat (limited to 'protoc.go')
| -rw-r--r-- | protoc.go | 28 |
1 files changed, 19 insertions, 9 deletions
@@ -14,6 +14,17 @@ import ( "go.wit.com/log" ) +// THIS GENERATES THIS cmd and then runs it: + +// autogenpb needs the commands: + +// protoc +// gen-proto-go + +// these are in the GO tools + +// Thsese lines were taken from a working Makefile: + // test.pb.go: test.proto // cd ~/go/src && protoc --go_out=. --proto_path=go.wit.com/apps/autogenpb/testautogen \ // --go_opt=Mtest.proto=go.wit.com/apps/autogenpb/testautogen \ @@ -24,20 +35,19 @@ import ( // --go_opt=MforgeConfig.proto=go.wit.com/apps/autogenpb/testautogen \ // forgeConfig.proto -func protocBuild(names map[string]string) error { +func (pb *Files) protocBuild(f *File, pbfile string) error { // read in the .proto file - data, err := os.ReadFile(names["protofile"]) + data, err := os.ReadFile(f.Filename) if err != nil { // log.Info("open config file :", err) return err } - log.Info("") - if shell.Exists(names["protoc"]) { - log.Info("protoc file already created", names["protoc"]) - // return nil + if shell.Exists(pbfile) { + log.Info("protoc file already created", pbfile) + return nil } - log.Info("make protoc file:", names["protoc"]) + log.Info("Attempt to generate the protoc file:", pbfile) // log.Info("go src", forge.GetGoSrc()) pwd, _ := os.Getwd() log.Info("go.Getwd()", pwd) @@ -54,7 +64,7 @@ func protocBuild(names map[string]string) error { log.Info("gopath", gopath) cmd := []string{"protoc", "--go_out=."} cmd = append(cmd, "--proto_path="+gopath) - cmd = append(cmd, "--go_opt=M"+names["protofile"]+"="+gopath) + cmd = append(cmd, "--go_opt=M"+f.Filename+"="+gopath) // look for included proto files lines := strings.Split(string(data), "\n") @@ -90,7 +100,7 @@ func protocBuild(names map[string]string) error { */ } - cmd = append(cmd, names["protofile"]) + cmd = append(cmd, f.Filename) log.Info("\tpwd", argv.GoSrc) for i, s := range cmd { log.Info("\t", i, s) |
