Skip to content

Commit 2cd890e

Browse files
committed
Improve initial developer experience
Signed-off-by: Anuraag Agrawal <anuraaga@gmail.com>
1 parent 8781f58 commit 2cd890e

113 files changed

Lines changed: 276 additions & 20433 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Makefile

Lines changed: 17 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -6,29 +6,20 @@ SHELL := bash
66
MAKEFLAGS += --warn-undefined-variables
77
MAKEFLAGS += --no-builtin-rules
88
MAKEFLAGS += --no-print-directory
9-
BIN := .tmp/bin
10-
export PATH := $(BIN):$(PATH)
11-
export GOBIN := $(abspath $(BIN))
12-
export PYTHONPATH ?= gen
139
BUF_VERSION := 1.62.1
14-
CONFORMANCE_ARGS ?= --strict_message --expected_failures=test/conformance/nonconforming.yaml --timeout 10s
15-
ADD_LICENSE_HEADER := $(BIN)/license-header \
10+
BUF := go run github.com/bufbuild/buf/cmd/buf@v$(BUF_VERSION)
11+
ADD_LICENSE_HEADER := go run github.com/bufbuild/buf/private/pkg/licenseheader/cmd/license-header@v${BUF_VERSION} \
1612
--license-type apache \
1713
--copyright-holder "Buf Technologies, Inc." \
1814
--year-range "2023-2025"
15+
CONFORMANCE_ARGS ?= --strict_message --expected_failures=test/conformance/nonconforming.yaml --timeout 10s
1916
PROTOVALIDATE_VERSION ?= 895eefca6d1346f742fc18b9983d40478820906d
17+
PROTOVALIDATE_CONFORMANCE := go run github.com/bufbuild/protovalidate/tools/protovalidate-conformance@$(PROTOVALIDATE_VERSION)
2018
# Version of the cel-spec that this implementation is conformant with
2119
# This should be kept in sync with the version in test/test_format.py
2220
CEL_SPEC_VERSION ?= v0.25.1
2321
TESTDATA_FILE := test/testdata/string_ext_$(CEL_SPEC_VERSION).textproto
2422

25-
PROTOVALIDATE_PROTO_PATH := buf.build/bufbuild/protovalidate:$(PROTOVALIDATE_VERSION)
26-
PROTOVALIDATE_TESTING_PROTO_PATH := buf.build/bufbuild/protovalidate-testing:$(PROTOVALIDATE_VERSION)
27-
ifneq ($(shell echo ${PROTOVALIDATE_VERSION} | grep -E "^v\d+\.\d+.\d+(-.+)?$$"), $(PROTOVALIDATE_VERSION))
28-
PROTOVALIDATE_PROTO_PATH = https://github.com/bufbuild/protovalidate.git\#subdir=proto/protovalidate,ref=$(PROTOVALIDATE_VERSION)
29-
PROTOVALIDATE_TESTING_PROTO_PATH = https://github.com/bufbuild/protovalidate.git\#subdir=proto/protovalidate-testing,ref=$(PROTOVALIDATE_VERSION)
30-
endif
31-
3223
.PHONY: help
3324
help: ## Describe useful make targets
3425
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "%-15s %s\n", $$1, $$2}'
@@ -43,47 +34,36 @@ clean: ## Delete intermediate build artifacts
4334
@echo $(CEL_SPEC_VERSION)
4435

4536
.PHONY: generate
46-
generate: $(BIN)/buf $(BIN)/license-header upstream ## Regenerate code and license headers
47-
rm -rf gen
48-
$(BIN)/buf generate $(PROTOVALIDATE_PROTO_PATH)
49-
$(BIN)/buf generate $(PROTOVALIDATE_TESTING_PROTO_PATH)
50-
$(BIN)/buf generate buf.build/google/cel-spec:$(CEL_SPEC_VERSION) --exclude-path cel/expr/conformance/proto2 --exclude-path cel/expr/conformance/proto3
51-
$(BIN)/buf generate
52-
$(ADD_LICENSE_HEADER)
53-
54-
.PHONY: upstream
55-
upstream: $(BIN)/buf
56-
rm -rf upstream
57-
$(BIN)/buf export $(PROTOVALIDATE_PROTO_PATH) -o upstream/proto
37+
generate: ## Regenerate code and license headers
38+
rm -rf test/gen
39+
(cd test && $(BUF) generate)
40+
uv run -- ruff check --fix test/gen
41+
uv run -- ruff format test/gen
5842
$(ADD_LICENSE_HEADER)
5943

6044
.PHONY: format
61-
format: install $(BIN)/buf $(BIN)/license-header ## Format code
45+
format: ## Format code
6246
$(ADD_LICENSE_HEADER)
63-
buf format --write .
64-
uv run -- ruff format protovalidate test
47+
$(BUF) format --write .
6548
uv run -- ruff check --fix protovalidate test
49+
uv run -- ruff format protovalidate test
6650

6751
.PHONY: test
68-
test: generate install $(TESTDATA_FILE) ## Run unit tests
52+
test: $(TESTDATA_FILE) ## Run unit tests
6953
uv run -- pytest
7054

7155
.PHONY: conformance
72-
conformance: $(BIN)/protovalidate-conformance generate install ## Run conformance tests
73-
protovalidate-conformance $(CONFORMANCE_ARGS) uv run test/conformance/runner.py
56+
conformance: generate ## Run conformance tests
57+
$(PROTOVALIDATE_CONFORMANCE) $(CONFORMANCE_ARGS) uv run test/conformance/runner.py
7458

7559
.PHONY: lint
76-
lint: install $(BIN)/buf ## Lint code
77-
buf format -d --exit-code
60+
lint: ## Lint code
61+
$(BUF) format -d --exit-code
7862
uv run -- ruff format --check --diff protovalidate test
7963
uv run -- mypy protovalidate
8064
uv run -- ruff check protovalidate test
8165
uv lock --check
8266

83-
.PHONY: install
84-
install: ## Install dependencies
85-
uv sync --dev
86-
8767
.PHONY: checkgenerate
8868
checkgenerate: generate
8969
@# Used in CI to verify that `make generate` doesn't produce a diff.
@@ -92,15 +72,3 @@ checkgenerate: generate
9272
$(TESTDATA_FILE):
9373
mkdir -p $(dir @)
9474
curl -fsSL -o $@ https://raw.githubusercontent.com/google/cel-spec/refs/tags/$(CEL_SPEC_VERSION)/tests/simple/testdata/string_ext.textproto
95-
96-
$(BIN):
97-
@mkdir -p $(BIN)
98-
99-
$(BIN)/buf: $(BIN) Makefile
100-
go install github.com/bufbuild/buf/cmd/buf@v${BUF_VERSION}
101-
102-
$(BIN)/license-header: $(BIN) Makefile
103-
go install github.com/bufbuild/buf/private/pkg/licenseheader/cmd/license-header@v${BUF_VERSION}
104-
105-
$(BIN)/protovalidate-conformance: $(BIN) Makefile
106-
go install github.com/bufbuild/protovalidate/tools/protovalidate-conformance@$(PROTOVALIDATE_VERSION)

buf.lock

Lines changed: 0 additions & 2 deletions
This file was deleted.

buf.yaml

Lines changed: 0 additions & 10 deletions
This file was deleted.

gen/buf/validate/conformance/cases/bool_pb2.py

Lines changed: 0 additions & 54 deletions
This file was deleted.

gen/buf/validate/conformance/cases/bool_pb2.pyi

Lines changed: 0 additions & 44 deletions
This file was deleted.

0 commit comments

Comments
 (0)