Skip to content

Commit

Permalink
update buf config (#4)
Browse files Browse the repository at this point in the history
* update buf config

* remove googleapis submodule
  • Loading branch information
ethernetdan authored Oct 4, 2023
1 parent a221d00 commit 0e626be
Show file tree
Hide file tree
Showing 10 changed files with 39 additions and 31 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/protobuf.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: 'true'
- name: Run protogen
run: make proto
- name: Check Protobuf descriptor generation
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
_proto/**
api/_proto/**
.idea/**
3 changes: 0 additions & 3 deletions .gitmodules

This file was deleted.

1 change: 0 additions & 1 deletion _proto/googleapis
Submodule googleapis deleted from a7e2f4
8 changes: 8 additions & 0 deletions api/buf.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Generated by buf. DO NOT EDIT.
version: v1
deps:
- remote: buf.build
owner: googleapis
repository: googleapis
commit: 28151c0d0a1641bf938a7672c500e01d
digest: shake256:49215edf8ef57f7863004539deff8834cfb2195113f0b890dd1f67815d9353e28e668019165b9d872395871eeafcbab3ccfdb2b5f11734d3cca95be9e8d139de
13 changes: 13 additions & 0 deletions api/buf.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
version: v1
name: buf.build/indent/multiparty

deps:
- buf.build/googleapis/googleapis:28151c0d0a1641bf938a7672c500e01d

breaking:
use:
- FILE

lint:
use:
- DEFAULT
2 changes: 1 addition & 1 deletion api/multiparty/v1/buf.gen.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ plugins:
- plugin: go
opt:
- paths=source_relative
out: api
out: .
12 changes: 0 additions & 12 deletions buf.yaml

This file was deleted.

25 changes: 15 additions & 10 deletions proto.mk
Original file line number Diff line number Diff line change
@@ -1,22 +1,27 @@
GET="./scripts/get.sh"
.PHONY: proto

PROTO=_proto
BUF := PATH=$(PROTO):$(PROTO)/protoc/bin:$$PATH $(PROTO)/buf
API=api
PROTO=api/_proto
GET=./scripts/get.sh
BUF := cd $(API) && PATH=$(notdir $(PROTO)):$(notdir $(PROTO))/protoc/bin:$$PATH buf

proto: api/multiparty/v1/buf.gen.yaml \
PKGS := \
multiparty/v1

proto: $(PKGS)

$(PKGS): proto-deps
$(BUF) generate --path $@ --template $@/buf.gen.yaml
$(BUF) build . --path $@ --as-file-descriptor-set -o $@/$(notdir $@).descriptor.pb

proto-deps: \
$(PROTO)/buf \
$(PROTO)/googleapis \
$(PROTO)/protoc/bin/protoc \
$(PROTO)/protoc-gen-go
$(BUF) generate --path api/multiparty/v1 --template $<
$(BUF) build . --path api/multiparty/v1 --as-file-descriptor-set -o api/multiparty/v1/v1.descriptor.pb

$(PROTO)/buf:
@$(GET) buf

$(PROTO)/googleapis:
@git submodule update --quiet --depth=1 --init $@ >/dev/null 2>&1

$(PROTO)/protoc/bin/protoc:
@$(GET) protoc

Expand Down
2 changes: 1 addition & 1 deletion scripts/get.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
set -euo pipefail

SUMS="$(dirname "$(readlink -f "$0")")/get.sha256"
OUTDIR="$(dirname "$(readlink -f "$0")")/../_proto"
OUTDIR="$(dirname "$(readlink -f "$0")")/../api/_proto"

# write to temp file and cleanup later
tmpDir="$(mktemp -d)"
Expand Down

0 comments on commit 0e626be

Please sign in to comment.