Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 19 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,19 @@ ADD_LICENSE_HEADER := $(BIN)/license-header \
--license-type apache \
--copyright-holder "Buf Technologies, Inc." \
--year-range "2023-2025"
# This version should be kept in sync with the version in buf.yaml
PROTOVALIDATE_VERSION ?= v1.1.0
PROTOVALIDATE_VERSION ?= 895eefca6d1346f742fc18b9983d40478820906d
# Version of the cel-spec that this implementation is conformant with
# This should be kept in sync with the version in test/test_format.py
CEL_SPEC_VERSION ?= v0.25.1
TESTDATA_FILE := test/testdata/string_ext_$(CEL_SPEC_VERSION).textproto

PROTOVALIDATE_PROTO_PATH := buf.build/bufbuild/protovalidate:$(PROTOVALIDATE_VERSION)
PROTOVALIDATE_TESTING_PROTO_PATH := buf.build/bufbuild/protovalidate-testing:$(PROTOVALIDATE_VERSION)
ifneq ($(shell echo ${PROTOVALIDATE_VERSION} | grep -E "^v\d+\.\d+.\d+(-.+)?$$"), $(PROTOVALIDATE_VERSION))
PROTOVALIDATE_PROTO_PATH = https://github.com/bufbuild/protovalidate.git\#subdir=proto/protovalidate,ref=$(PROTOVALIDATE_VERSION)
PROTOVALIDATE_TESTING_PROTO_PATH = https://github.com/bufbuild/protovalidate.git\#subdir=proto/protovalidate-testing,ref=$(PROTOVALIDATE_VERSION)
endif

.PHONY: help
help: ## Describe useful make targets
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "%-15s %s\n", $$1, $$2}'
Expand All @@ -33,18 +39,25 @@ all: test conformance lint ## Run all tests and lint (default)
clean: ## Delete intermediate build artifacts
@# -X only removes untracked files, -d recurses into directories, -f actually removes files/dirs
git clean -Xdf
@echo $(CEL_SPEC_VERSION)

.PHONY: generate
generate: $(BIN)/buf $(BIN)/license-header ## Regenerate code and license headers
generate: $(BIN)/buf $(BIN)/license-header upstream ## Regenerate code and license headers
rm -rf gen
$(BIN)/buf generate buf.build/bufbuild/protovalidate:$(PROTOVALIDATE_VERSION)
$(BIN)/buf generate buf.build/bufbuild/protovalidate-testing:$(PROTOVALIDATE_VERSION)
$(BIN)/buf generate $(PROTOVALIDATE_PROTO_PATH)
$(BIN)/buf generate $(PROTOVALIDATE_TESTING_PROTO_PATH)
$(BIN)/buf generate buf.build/google/cel-spec:$(CEL_SPEC_VERSION) --exclude-path cel/expr/conformance/proto2 --exclude-path cel/expr/conformance/proto3
$(BIN)/buf generate
$(ADD_LICENSE_HEADER)

.PHONY: upstream
upstream: $(BIN)/buf
rm -rf upstream
$(BIN)/buf export $(PROTOVALIDATE_PROTO_PATH) -o upstream/proto
$(ADD_LICENSE_HEADER)

.PHONY: format
format: install $(BIN)/buf $(BIN)/license-header ## Format code
format: install $(BIN)/buf $(BIN)/license-header ## Format code
$(ADD_LICENSE_HEADER)
buf format --write .
uv run -- ruff format protovalidate test
Expand Down
4 changes: 0 additions & 4 deletions buf.lock
Original file line number Diff line number Diff line change
@@ -1,6 +1,2 @@
# Generated by buf. DO NOT EDIT.
version: v2
deps:
- name: buf.build/bufbuild/protovalidate
commit: 52f32327d4b045a79293a6ad4e7e1236
digest: b5:cbabc98d4b7b7b0447c9b15f68eeb8a7a44ef8516cb386ac5f66e7fd4062cd6723ed3f452ad8c384b851f79e33d26e7f8a94e2b807282b3def1cd966c7eace97
3 changes: 1 addition & 2 deletions buf.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
version: v2
modules:
- path: proto
deps:
- buf.build/bufbuild/protovalidate:v1.0.0
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

couldn't we have just specified the commit here? 😄

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is a managed module branches are not pushed

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah, forgot about that — thanks!

- path: upstream/proto
lint:
use:
- STANDARD
Expand Down
Loading