Skip to content

Commit

Permalink
Update buf to v1
Browse files Browse the repository at this point in the history
Signed-off-by: Tobias Brumhard <code@brumhard.com>
  • Loading branch information
brumhard committed Apr 29, 2022
1 parent 155226b commit d827207
Show file tree
Hide file tree
Showing 14 changed files with 115 additions and 1,414 deletions.
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: 3b4e902919a04bd4a955f1fc17e47cdc
20 changes: 10 additions & 10 deletions buf.yaml → api/proto/buf.yaml 100755 → 100644
@@ -1,16 +1,16 @@
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
ignore:
- google
- validate
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.

0 comments on commit d827207

Please sign in to comment.