Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update buf to v1 #17

Merged
merged 3 commits into from Apr 29, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
22 changes: 8 additions & 14 deletions Makefile
Expand Up @@ -88,28 +88,22 @@ define make-go-dependency
GOBIN=$(PWD)/bin go install $1
endef

.PHONY: api/proto/buf.lock
api/proto/buf.lock: bin/buf
@bin/buf mod update api/proto

# this creates a target for each go dependency to be referenced in other targets
$(foreach dep, $(GO_DEPENDENCIES), $(eval $(call make-go-dependency, $(dep))))

api/proto/google:
@mkdir -p api/proto/google/api
curl -s https://raw.githubusercontent.com/googleapis/googleapis/master/google/api/annotations.proto -o api/proto/google/api/annotations.proto
curl -s https://raw.githubusercontent.com/googleapis/googleapis/master/google/api/http.proto -o api/proto/google/api/http.proto
curl -s https://raw.githubusercontent.com/googleapis/googleapis/master/google/api/field_behavior.proto -o api/proto/google/api/field_behavior.proto

api/proto/validate:
@mkdir -p api/proto/validate
curl -s https://raw.githubusercontent.com/envoyproxy/protoc-gen-validate/main/validate/validate.proto -o api/proto/validate/validate.proto

protolint: bin/buf bin/protoc-gen-buf-lint ## Lints your protobuf files
protolint: api/proto/buf.lock bin/protoc-gen-buf-lint ## Lints your protobuf files
bin/buf lint

protobreaking: bin/buf bin/protoc-gen-buf-breaking ## Compares your current protobuf with the version on master to find breaking changes
protobreaking: api/proto/buf.lock bin/protoc-gen-buf-breaking ## Compares your current protobuf with the version on master to find breaking changes
bin/buf breaking --against '.git#branch=main'

generate: ## Generates code from protobuf files
generate: api/proto/google api/proto/validate bin/buf bin/protoc-gen-go bin/protoc-gen-go-grpc bin/protoc-gen-validate
PATH=$(PWD)/bin:$$PATH buf generate --path api/proto/dashboard/v1/dashboard.proto
generate: api/proto/buf.lock bin/protoc-gen-go bin/protoc-gen-go-grpc bin/protoc-gen-validate
PATH=$(PWD)/bin:$$PATH buf generate

ci: lint-reports test-reports ## Executes lint and test and generates reports

Expand Down
11 changes: 11 additions & 0 deletions api/proto/buf.lock
@@ -0,0 +1,11 @@
# Generated by buf. DO NOT EDIT.
version: v1
deps:
- remote: buf.build
owner: envoyproxy
repository: protoc-gen-validate
commit: dc09a417d27241f7b069feae2cd74a0e
- remote: buf.build
owner: googleapis
repository: googleapis
commit: f3590c56d388417ebbedefae77ac12bf
17 changes: 7 additions & 10 deletions buf.yaml → api/proto/buf.yaml 100755 → 100644
@@ -1,16 +1,13 @@
version: v1beta1
build:
roots:
- api/proto
version: v1
deps:
- buf.build/envoyproxy/protoc-gen-validate
- buf.build/googleapis/googleapis
breaking:
use:
- FILE
lint:
use:
- DEFAULT
ignore:
- google
- validate
except:
- RPC_RESPONSE_STANDARD_NAME
- RPC_REQUEST_RESPONSE_UNIQUE
breaking:
use:
- FILE
7 changes: 0 additions & 7 deletions api/proto/dashboard/v1/dashboard.proto
Expand Up @@ -2,13 +2,6 @@ syntax = "proto3";

package dashboard.v1;

import "google/api/annotations.proto";
import "google/api/field_behavior.proto";
import "google/protobuf/wrappers.proto";
import "google/protobuf/empty.proto";
import "google/protobuf/timestamp.proto";
import "validate/validate.proto";

// Defines the import path that should be used to import the generated package,
// and the package name.
option go_package = "github.com/brumhard/primate/pkg/pb;dashboard";
Expand Down
31 changes: 0 additions & 31 deletions api/proto/google/api/annotations.proto

This file was deleted.

90 changes: 0 additions & 90 deletions api/proto/google/api/field_behavior.proto

This file was deleted.