forked from apptreesoftware/protoc-gen-twirp_dart
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.go
More file actions
29 lines (27 loc) · 847 Bytes
/
main.go
File metadata and controls
29 lines (27 loc) · 847 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
package main
import (
"github.com/apptreesoftware/protoc-gen-twirp_dart/generator"
"google.golang.org/protobuf/compiler/protogen"
"google.golang.org/protobuf/types/pluginpb"
)
func main() {
protogen.Options{}.Run(func(p *protogen.Plugin) error {
p.SupportedFeatures = uint64(pluginpb.CodeGeneratorResponse_FEATURE_PROTO3_OPTIONAL)
for _, f := range p.Files {
if !f.Generate {
continue
}
// skip google/protobuf/timestamp, we don't do any special serialization for jsonpb.
if f.Proto.GetName() == "google/protobuf/timestamp.proto" {
continue
}
p.NewGeneratedFile("twirp_dart_core.dart", "").Write([]byte(generator.CoreFile))
p.NewGeneratedFile("requester.dart", "").Write([]byte(generator.RequesterFile))
err := generator.CreateClientAPI(p, f)
if err != nil {
return err
}
}
return nil
})
}