blob: 8fbc1fc3151bd6c2a78e0ae9ad73ad06d5e2131a [file] [log] [blame]
Zack Williamse940c7a2019-08-21 14:25:39 -07001package protoparse
2
3import (
4 dpb "github.com/golang/protobuf/protoc-gen-go/descriptor"
5 // link in packages that include the standard protos included with protoc
6 _ "github.com/golang/protobuf/protoc-gen-go/plugin"
7 _ "github.com/golang/protobuf/ptypes/any"
8 _ "github.com/golang/protobuf/ptypes/duration"
9 _ "github.com/golang/protobuf/ptypes/empty"
10 _ "github.com/golang/protobuf/ptypes/struct"
11 _ "github.com/golang/protobuf/ptypes/timestamp"
12 _ "github.com/golang/protobuf/ptypes/wrappers"
13 _ "google.golang.org/genproto/protobuf/api"
14 _ "google.golang.org/genproto/protobuf/field_mask"
15 _ "google.golang.org/genproto/protobuf/ptype"
16 _ "google.golang.org/genproto/protobuf/source_context"
17
18 "github.com/jhump/protoreflect/internal"
19)
20
21// All files that are included with protoc are also included with this package
22// so that clients do not need to explicitly supply a copy of these protos (just
23// like callers of protoc do not need to supply them).
24var standardImports map[string]*dpb.FileDescriptorProto
25
26func init() {
27 standardFilenames := []string{
28 "google/protobuf/any.proto",
29 "google/protobuf/api.proto",
30 "google/protobuf/compiler/plugin.proto",
31 "google/protobuf/descriptor.proto",
32 "google/protobuf/duration.proto",
33 "google/protobuf/empty.proto",
34 "google/protobuf/field_mask.proto",
35 "google/protobuf/source_context.proto",
36 "google/protobuf/struct.proto",
37 "google/protobuf/timestamp.proto",
38 "google/protobuf/type.proto",
39 "google/protobuf/wrappers.proto",
40 }
41
42 standardImports = map[string]*dpb.FileDescriptorProto{}
43 for _, fn := range standardFilenames {
44 fd, err := internal.LoadFileDescriptor(fn)
Scott Baker4a35a702019-11-26 08:17:33 -080045 if err != nil {
46 panic(err.Error())
Zack Williamse940c7a2019-08-21 14:25:39 -070047 }
Scott Baker4a35a702019-11-26 08:17:33 -080048 standardImports[fn] = fd
Zack Williamse940c7a2019-08-21 14:25:39 -070049 }
50}