Skip to content

Commit

Permalink
Update proto dependency resolution table (#1004)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jay Conrod authored Mar 8, 2021
1 parent 05b2371 commit e909144
Show file tree
Hide file tree
Showing 5 changed files with 528 additions and 1,826 deletions.
16 changes: 12 additions & 4 deletions language/proto/gen/update_proto_csv.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ var (
var prefix = `# This file lists special protos that Gazelle knows how to import. This is used to generate
# code for proto and Go resolvers.
#
# Generated by internal/language/proto/gen/update_proto_csv.go
# Generated by language/proto/gen/update_proto_csv.go
# Do not edit directly.
#
# proto name,proto label,go import path,go proto label
Expand Down Expand Up @@ -291,15 +291,23 @@ func generateFromPath(w io.Writer, rootPath string) error {
if err != nil {
return err
}
if !strings.HasSuffix(path, ".proto") {
return nil
}
relPath, err := filepath.Rel(rootPath, path)
if err != nil || strings.HasPrefix(relPath, "..") {
log.Panicf("file %q not in repository rootPath %q", path, rootPath)
}
relPath = filepath.ToSlash(relPath)

if relPath == "google/actions/sdk/v2" {
// Special case: these protos span multiple directories but have the same
// go_package. Not sure if these are meant to be publically consumed, but
// we can't handle them directly.
return filepath.SkipDir
}

if info.IsDir() || !strings.HasSuffix(path, ".proto") {
return nil
}

if strings.HasPrefix(relPath, "google/api/experimental/") {
// Special case: these protos need to be built together with protos in
// google/api. They have the same 'option go_package'. The proto_library
Expand Down
Loading

0 comments on commit e909144

Please sign in to comment.