Skip to content

Commit

Permalink
use protoparse instead of protoc command (#37)
Browse files Browse the repository at this point in the history
  • Loading branch information
ktr authored Feb 28, 2018
1 parent 41b3f8e commit 8bfca72
Show file tree
Hide file tree
Showing 9 changed files with 25 additions and 96 deletions.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2017 lycoris0731
Copyright (c) 2017 ktr0731

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
80 changes: 0 additions & 80 deletions adapter/internal/proto_parser/parser.go

This file was deleted.

14 changes: 14 additions & 0 deletions adapter/internal/protoparser/parser.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package protoparser

import (
"github.com/jhump/protoreflect/desc"
"github.com/jhump/protoreflect/desc/protoparse"
)

// ParseFile parses proto files to []*desc.FileDescriptor
func ParseFile(filename []string, paths []string) ([]*desc.FileDescriptor, error) {
p := &protoparse.Parser{
ImportPaths: append(paths, "."),
}
return p.ParseFiles(filename...)
}
4 changes: 2 additions & 2 deletions adapter/internal/testhelper/helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"testing"

"github.com/jhump/protoreflect/desc"
"github.com/ktr0731/evans/adapter/internal/proto_parser"
"github.com/ktr0731/evans/adapter/internal/protoparser"
"github.com/ktr0731/evans/entity"
"github.com/ktr0731/evans/tests/helper"
"github.com/stretchr/testify/require"
Expand All @@ -15,7 +15,7 @@ func ReadProtoAsFileDescriptors(t *testing.T, fpath ...string) []*desc.FileDescr
for i := range fpath {
fpath[i] = filepath.Join("testdata", fpath[i])
}
set, err := proto_parser.ParseFile(fpath, nil)
set, err := protoparser.ParseFile(fpath, nil)
require.NoError(t, err)
require.Len(t, set, len(fpath))
return set
Expand Down
4 changes: 2 additions & 2 deletions adapter/parser/parser.go
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
package parser

import (
"github.com/ktr0731/evans/adapter/internal/proto_parser"
"github.com/ktr0731/evans/adapter/internal/protoparser"
"github.com/ktr0731/evans/adapter/protobuf"
"github.com/ktr0731/evans/entity"
)

func ParseFile(filename []string, paths []string) ([]*entity.Package, error) {
set, err := proto_parser.ParseFile(filename, paths)
set, err := protoparser.ParseFile(filename, paths)
if err != nil {
return nil, err
}
Expand Down
2 changes: 1 addition & 1 deletion config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ import (
"os/exec"
"path/filepath"

"github.com/BurntSushi/toml"
"github.com/kelseyhightower/envconfig"
configure "github.com/ktr0731/go-configure"
"github.com/ktr0731/mapstruct"
"github.com/ktr0731/toml"
"github.com/mitchellh/mapstructure"
)

Expand Down
11 changes: 3 additions & 8 deletions glide.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion glide.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package: github.com/lycoris0731/evans
package: github.com/ktr0731/evans
import:
- package: github.com/alexflint/go-arg
- package: github.com/fatih/color
Expand Down
2 changes: 1 addition & 1 deletion meta/meta.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ package meta

const (
Name = "evans"
Version = "0.2.7"
Version = "0.2.8"
)

0 comments on commit 8bfca72

Please sign in to comment.