Skip to content

Commit

Permalink
feat: move examples/proto to proto
Browse files Browse the repository at this point in the history
The proto schemas are not strictly examples, and are better housed one
level up.

BREAKING CHANGE: Import path of example freight API has been updated.
  • Loading branch information
odsod committed Mar 9, 2021
1 parent 7cb7970 commit 664238d
Show file tree
Hide file tree
Showing 23 changed files with 69 additions and 73 deletions.
4 changes: 2 additions & 2 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[submodule "examples/proto/api-common-protos"]
path = examples/proto/api-common-protos
[submodule "proto/api-common-protos"]
path = proto/api-common-protos
url = https://github.com/googleapis/api-common-protos
18 changes: 9 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ include tools/protoc/rules.mk
include tools/semantic-release/rules.mk
include tools/stringer/rules.mk

.PHONY: examples/proto/api-common-protos
examples/proto/api-common-protos:
.PHONY: proto/api-common-protos
proto/api-common-protos:
@git submodule update --init --recursive $@

.PHONY: go-generate
Expand All @@ -53,12 +53,12 @@ api-linter-lint: $(api_linter_wrapper)
$(info [$@] linting APIs...)
@$(api_linter_wrapper) \
--config api-linter.yaml \
-I examples/proto/api-common-protos \
-I examples/proto/src \
$(shell find examples/proto/src -type f -name '*.proto' | cut -d '/' -f 4-)
-I proto/api-common-protos \
-I proto/src \
$(shell find proto/src -type f -name '*.proto' | cut -d '/' -f 4-)

.PHONY: buf-lint
buf-lint: $(buf) examples/proto/api-common-protos
buf-lint: $(buf) proto/api-common-protos
$(info [$@] linting protobuf schemas...)
@$(buf) lint

Expand All @@ -68,7 +68,7 @@ protoc_plugins := \
$(protoc_gen_gapic_validator)

.PHONY: buf-generate
buf-generate: $(buf) $(protoc) $(protoc_plugins) examples/proto/api-common-protos
buf-generate: $(buf) $(protoc) $(protoc_plugins) proto/api-common-protos
$(info [$@] generating protobuf stubs...)
@rm -rf examples/proto/gen
@$(buf) generate --path examples/proto/src/einride
@rm -rf proto/gen
@$(buf) generate --path proto/src/einride
2 changes: 1 addition & 1 deletion aipmiddleware/parentvalidator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"sync"
"testing"

examplefreightv1 "go.einride.tech/aip/examples/proto/gen/einride/example/freight/v1"
examplefreightv1 "go.einride.tech/aip/proto/gen/einride/example/freight/v1"
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
Expand Down
8 changes: 4 additions & 4 deletions buf.gen.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ plugins:
out: .

- name: go
out: examples/proto/gen
opt: module=go.einride.tech/aip/examples/proto/gen
out: proto/gen
opt: module=go.einride.tech/aip/proto/gen

- name: go-grpc
out: examples/proto/gen
opt: module=go.einride.tech/aip/examples/proto/gen,require_unimplemented_servers=false
out: proto/gen
opt: module=go.einride.tech/aip/proto/gen,require_unimplemented_servers=false
4 changes: 2 additions & 2 deletions buf.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ version: v1beta1

build:
roots:
- examples/proto/src
- examples/proto/api-common-protos
- proto/src
- proto/api-common-protos

lint:
use:
Expand Down
1 change: 0 additions & 1 deletion examples/proto/api-common-protos
Submodule api-common-protos deleted from 0fcae7
2 changes: 1 addition & 1 deletion fieldbehavior/fieldbehavior_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package fieldbehavior
import (
"testing"

examplefreightv1 "go.einride.tech/aip/examples/proto/gen/einride/example/freight/v1"
examplefreightv1 "go.einride.tech/aip/proto/gen/einride/example/freight/v1"
"google.golang.org/genproto/googleapis/api/annotations"
"google.golang.org/genproto/googleapis/example/library/v1"
"google.golang.org/protobuf/types/known/fieldmaskpb"
Expand Down
2 changes: 1 addition & 1 deletion fieldmask/update_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package fieldmask
import (
"testing"

syntaxv1 "go.einride.tech/aip/examples/proto/gen/einride/example/syntax/v1"
syntaxv1 "go.einride.tech/aip/proto/gen/einride/example/syntax/v1"
"google.golang.org/genproto/googleapis/example/library/v1"
"google.golang.org/protobuf/proto"
"google.golang.org/protobuf/testing/protocmp"
Expand Down
2 changes: 1 addition & 1 deletion filtering/checker_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package filtering
import (
"testing"

syntaxv1 "go.einride.tech/aip/examples/proto/gen/einride/example/syntax/v1"
syntaxv1 "go.einride.tech/aip/proto/gen/einride/example/syntax/v1"
"gotest.tools/v3/assert"
)

Expand Down
1 change: 1 addition & 0 deletions proto/api-common-protos
Submodule api-common-protos added at f37c0e

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

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

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

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

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

Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ syntax = "proto3";

package einride.example.freight.v1;

option go_package = "go.einride.tech/aip/examples/proto/gen/einride/example/freight/v1;examplefreightv1";
option go_package = "go.einride.tech/aip/proto/gen/einride/example/freight/v1;examplefreightv1";
option java_multiple_files = true;
option java_outer_classname = "FreightServiceProto";
option java_package = "tech.einride.example.freight.v1";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ syntax = "proto3";

package einride.example.freight.v1;

option go_package = "go.einride.tech/aip/examples/proto/gen/einride/example/freight/v1;examplefreightv1";
option go_package = "go.einride.tech/aip/proto/gen/einride/example/freight/v1;examplefreightv1";
option java_multiple_files = true;
option java_outer_classname = "ShipmentProto";
option java_package = "tech.einride.example.freight.v1";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ syntax = "proto3";

package einride.example.freight.v1;

option go_package = "go.einride.tech/aip/examples/proto/gen/einride/example/freight/v1;examplefreightv1";
option go_package = "go.einride.tech/aip/proto/gen/einride/example/freight/v1;examplefreightv1";
option java_multiple_files = true;
option java_outer_classname = "ShipperProto";
option java_package = "tech.einride.example.freight.v1";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ syntax = "proto3";

package einride.example.freight.v1;

option go_package = "go.einride.tech/aip/examples/proto/gen/einride/example/freight/v1;examplefreightv1";
option go_package = "go.einride.tech/aip/proto/gen/einride/example/freight/v1;examplefreightv1";
option java_multiple_files = true;
option java_outer_classname = "SiteProto";
option java_package = "tech.einride.example.freight.v1";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ syntax = "proto3";

package einride.example.syntax.v1;

option go_package = "go.einride.tech/aip/examples/proto/gen/einride/example/syntax/v1;syntaxv1";
option go_package = "go.einride.tech/aip/proto/gen/einride/example/syntax/v1;syntaxv1";
option java_multiple_files = true;
option java_outer_classname = "SyntaxProto";
option java_package = "tech.einride.example.syntax.v1";
Expand Down
2 changes: 1 addition & 1 deletion reflect/aipreflect/resourcedescriptor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package aipreflect
import (
"testing"

examplefreightv1 "go.einride.tech/aip/examples/proto/gen/einride/example/freight/v1"
examplefreightv1 "go.einride.tech/aip/proto/gen/einride/example/freight/v1"
"google.golang.org/genproto/googleapis/api/annotations"
"google.golang.org/protobuf/proto"
"google.golang.org/protobuf/reflect/protoreflect"
Expand Down
2 changes: 1 addition & 1 deletion reflect/aipregistry/resources_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package aipregistry
import (
"testing"

examplefreightv1 "go.einride.tech/aip/examples/proto/gen/einride/example/freight/v1"
examplefreightv1 "go.einride.tech/aip/proto/gen/einride/example/freight/v1"
"go.einride.tech/aip/reflect/aipreflect"
"google.golang.org/protobuf/reflect/protoreflect"
"google.golang.org/protobuf/reflect/protoregistry"
Expand Down

0 comments on commit 664238d

Please sign in to comment.