Skip to content

Commit 335775d

Browse files
DATA-1102: add description/contributing to README and clean up Makefile (#263)
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
1 parent ff078ba commit 335775d

File tree

12 files changed

+87
-63
lines changed

12 files changed

+87
-63
lines changed

Makefile

Lines changed: 24 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,22 @@
1-
TOOL_BIN = bin/gotools/$(shell uname -s)-$(shell uname -m)
1+
PROTO_FILES := $(shell find proto/ -type f -name '*.proto')
22

3-
PATH_WITH_TOOLS="`pwd`/$(TOOL_BIN):`pwd`/node_modules/.bin:${PATH}"
3+
export GOBIN := $(shell pwd)/bin/gotools/$(shell uname -s)-$(shell uname -m)
4+
export PATH := $(GOBIN):$(shell npm root)/.bin:$(PATH)
45

5-
PROTO_FILES=$(shell find proto/ -type f -name '*.proto')
6+
.PHONY: all
7+
all: clean dist/buf
68

9+
.PHONY: setup
710
setup:
811
bash etc/setup.sh
912

10-
clean-all:
13+
.PHONY: clean
14+
clean:
1115
git clean -fxd
1216

1317
dist/tool-install: Makefile
1418
npm ci --audit=false
15-
GOBIN=`pwd`/$(TOOL_BIN) go install google.golang.org/protobuf/cmd/protoc-gen-go \
19+
go install google.golang.org/protobuf/cmd/protoc-gen-go \
1620
github.com/bufbuild/buf/cmd/protoc-gen-buf-breaking \
1721
github.com/bufbuild/buf/cmd/protoc-gen-buf-lint \
1822
github.com/pseudomuto/protoc-gen-doc/cmd/protoc-gen-doc \
@@ -26,23 +30,26 @@ dist/tool-install: Makefile
2630
mkdir -p dist
2731
touch dist/tool-install
2832

33+
.PHONY: dist/buf
2934
dist/buf: dist/buf-go dist/buf-web
3035

3136
dist/buf-go: dist/tool-install $(PROTO_FILES)
32-
PATH=$(PATH_WITH_TOOLS) buf lint
33-
PATH=$(PATH_WITH_TOOLS) buf format -w
34-
PATH=$(PATH_WITH_TOOLS) buf generate --template ./proto/viam/buf.gen.yaml
35-
PATH=$(PATH_WITH_TOOLS) buf generate --template ./proto/viam/buf.gen.tagger.yaml
37+
buf lint
38+
buf format -w
39+
buf generate --template ./proto/viam/buf.gen.yaml
40+
buf generate --template ./proto/viam/buf.gen.tagger.yaml
3641
touch dist/buf-go
3742

3843
dist/buf-web: dist/tool-install $(PROTO_FILES)
39-
PATH=$(PATH_WITH_TOOLS) buf lint
40-
PATH=$(PATH_WITH_TOOLS) buf format -w
41-
PATH=$(PATH_WITH_TOOLS) buf generate --template ./proto/viam/buf.gen.web.yaml
42-
PATH=$(PATH_WITH_TOOLS) buf generate --timeout 5m --template ./proto/viam/buf.gen.web.yaml buf.build/googleapis/googleapis
44+
buf lint
45+
buf format -w
46+
buf generate --template ./proto/viam/buf.gen.web.yaml
47+
buf generate --timeout 5m --template ./proto/viam/buf.gen.web.yaml buf.build/googleapis/googleapis
48+
touch dist/buf-web
4349

50+
.PHONY: lint
4451
lint: dist/tool-install
45-
PATH=$(PATH_WITH_TOOLS) buf lint
46-
PATH=$(PATH_WITH_TOOLS) buf format -w
47-
export pkgs=`go list -f '{{.Dir}}' ./... | grep -v gen | grep -v proto` && echo "$$pkgs" | xargs go vet -vettool=$(TOOL_BIN)/combined
48-
export GOGC=50 pkgs=`go list -f '{{.Dir}}' ./... | grep -v gen | grep -v proto` && echo "$$pkgs" | xargs $(TOOL_BIN)/golangci-lint run $(LINT_BUILD_TAGS) -v --fix --config=./etc/.golangci.yaml
52+
buf lint
53+
buf format -w
54+
export pkgs=`go list -f '{{.Dir}}' ./... | grep -v gen | grep -v proto` && echo "$$pkgs" | xargs go vet -vettool=`which combined`
55+
export GOGC=50 pkgs=`go list -f '{{.Dir}}' ./... | grep -v gen | grep -v proto` && echo "$$pkgs" | xargs golangci-lint run $(LINT_BUILD_TAGS) -v --fix --config=./etc/.golangci.yaml

README.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,23 @@
11
# API
22

3+
Protobuf definitions for Viam's public-facing API.
4+
5+
## Contributing
6+
7+
### Development
8+
9+
- `make setup` - Setup your development environment
10+
- `make all` - Clean and build the Go and web generated libraries
11+
- `make dist/buf` - Build the Go and web generated libraries without cleaning
12+
- `make clean` - Clean tool cache
13+
14+
### Submitting PRs for Protobuf Changes
15+
16+
- Only submit PRs with changes to `.proto` files, CI will handle generating other files
17+
- Do not make breaking changes to APIs if it can be avoided
18+
319
## License
20+
421
Copyright 2022 Viam Inc.
522

623
Apache 2.0 - See [LICENSE](https://github.com/viamrobotics/api/blob/main/LICENSE) file

component/arm/v1/arm.pb.gw.go

Lines changed: 7 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

component/audioinput/v1/audioinput.pb.gw.go

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

component/camera/v1/camera.pb.gw.go

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

component/gantry/v1/gantry.pb.gw.go

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

component/generic/v1/generic.pb.gw.go

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

component/gripper/v1/gripper.pb.gw.go

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)