diff options
| author | Jeff Carr <[email protected]> | 2024-12-01 22:23:38 -0600 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2024-12-01 22:23:38 -0600 |
| commit | 45fc9ea257d3f6bd3987858cc472c3e17f50c046 (patch) | |
| tree | 9ea0823baf600c085ead565b04ff3866726da117 | |
| parent | 2ebdd32040635ac84d173ebb315dc65b35af2b57 (diff) | |
autogenpb now completely automatic
| -rw-r--r-- | Makefile | 6 | ||||
| -rw-r--r-- | gitTag.proto | 2 | ||||
| -rw-r--r-- | goDep.proto | 2 | ||||
| -rw-r--r-- | goDep.redoGoMod.go | 3 | ||||
| -rw-r--r-- | repo.proto | 2 | ||||
| -rw-r--r-- | repo.protofiles.go | 19 | ||||
| -rw-r--r-- | shell.go | 4 |
7 files changed, 35 insertions, 3 deletions
@@ -31,10 +31,10 @@ clean: # refs.proto gitTag.pb.go: gitTag.proto - autogenpb --proto gitTag.proto --mutex + autogenpb --proto gitTag.proto goDep.pb.go: goDep.proto - autogenpb --proto goDep.proto --mutex + autogenpb --proto goDep.proto repo.pb.go: repo.proto - autogenpb --proto repo.proto --mutex + autogenpb --proto repo.proto diff --git a/gitTag.proto b/gitTag.proto index e69a25e..53eb346 100644 --- a/gitTag.proto +++ b/gitTag.proto @@ -4,6 +4,8 @@ package gitpb; import "google/protobuf/timestamp.proto"; // Import the well-known type for Timestamp +// global settings for autogenpb `autogenpb:mutex` + message GitTag { // `autogenpb:marshal` string refname = 1; // `autogenpb:unique` // tag name. treated as unique google.protobuf.Timestamp creatordate = 2; // git creatordate diff --git a/goDep.proto b/goDep.proto index 41af614..df374f5 100644 --- a/goDep.proto +++ b/goDep.proto @@ -6,6 +6,8 @@ package gitpb; import "google/protobuf/timestamp.proto"; // Import the well-known type for Timestamp +// global settings for autogenpb `autogenpb:mutex` + message GoDep { // `autogenpb:marshal` string hash = 1; // `autogenpb:unique` // md5sum/hash value from the go.sum file google.protobuf.Timestamp ctime = 2; // get the go date from 'go list' ? diff --git a/goDep.redoGoMod.go b/goDep.redoGoMod.go index ab55fa9..f15ed40 100644 --- a/goDep.redoGoMod.go +++ b/goDep.redoGoMod.go @@ -124,6 +124,9 @@ func (repo *Repo) parseGoSum() (bool, error) { return true, nil } func (repo *Repo) RepoType() string { + if repo == nil { + return "nil" + } if repo.GetGoPlugin() { return "plugin" } @@ -9,6 +9,8 @@ import "gitTag.proto"; import "goDep.proto"; import "google/protobuf/timestamp.proto"; // Import the well-known type for Timestamp +// global settings for autogenpb `autogenpb:mutex` + message Repo { // `autogenpb:marshal` string fullPath = 1; // the actual path to the .git directory: '/home/devel/golang.org/x/tools' google.protobuf.Timestamp lastPull = 2; // last time a git pull was done diff --git a/repo.protofiles.go b/repo.protofiles.go index 2087830..eff0d82 100644 --- a/repo.protofiles.go +++ b/repo.protofiles.go @@ -80,3 +80,22 @@ func scanForProtobuf(srcDir string) ([]string, []string, error) { return protofiles, compiled, err } + +func (repo *Repo) GetProtoFiles() ([]string, error) { + var protofiles []string + err := filepath.Walk(repo.GetFullPath(), func(path string, info os.FileInfo, err error) error { + if err != nil { + log.Log(GITPBWARN, "Error accessing path:", path, err) + return err + } + + if strings.HasSuffix(path, ".proto") { + // + protofiles = append(protofiles, path) + } + + return nil + }) + + return protofiles, err +} @@ -34,6 +34,10 @@ func (repo *Repo) RunQuiet(cmd []string) cmd.Status { return result } +func (repo *Repo) RunRealtime(cmd []string) cmd.Status { + return shell.PathRunRealtime(repo.GetFullPath(), cmd) +} + // for now, even check cmd.Exit func (repo *Repo) strictRun(cmd []string) (bool, error) { result := repo.RunQuiet(cmd) |
