autogenpb now completely automatic

This commit is contained in:
Jeff Carr 2024-12-01 22:23:38 -06:00
parent 2ebdd32040
commit 45fc9ea257
7 changed files with 35 additions and 3 deletions

View File

@ -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

View File

@ -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

View File

@ -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' ?

View File

@ -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"
}

View File

@ -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

View File

@ -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
}

View File

@ -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)