@@ -15,13 +15,19 @@ ADD_LICENSE_HEADER := $(BIN)/license-header \
1515 --license-type apache \
1616 --copyright-holder "Buf Technologies, Inc." \
1717 --year-range "2023-2025"
18- # This version should be kept in sync with the version in buf.yaml
19- PROTOVALIDATE_VERSION ?= v1.1.0
18+ PROTOVALIDATE_VERSION ?= 895eefca6d1346f742fc18b9983d40478820906d
2019# Version of the cel-spec that this implementation is conformant with
2120# This should be kept in sync with the version in test/test_format.py
2221CEL_SPEC_VERSION ?= v0.25.1
2322TESTDATA_FILE := test/testdata/string_ext_$(CEL_SPEC_VERSION ) .textproto
2423
24+ PROTOVALIDATE_PROTO_PATH := buf.build/bufbuild/protovalidate:$(PROTOVALIDATE_VERSION )
25+ PROTOVALIDATE_TESTING_PROTO_PATH := buf.build/bufbuild/protovalidate-testing:$(PROTOVALIDATE_VERSION )
26+ ifneq ($(shell echo ${PROTOVALIDATE_VERSION} | grep -E "^v\d+\.\d+.\d+(-.+) ?$$"), $(PROTOVALIDATE_VERSION ) )
27+ PROTOVALIDATE_PROTO_PATH = https://github.com/bufbuild/protovalidate.git\# subdir=proto/protovalidate,ref=$(PROTOVALIDATE_VERSION)
28+ PROTOVALIDATE_TESTING_PROTO_PATH = https://github.com/bufbuild/protovalidate.git\# subdir=proto/protovalidate-testing,ref=$(PROTOVALIDATE_VERSION)
29+ endif
30+
2531.PHONY : help
2632help : # # Describe useful make targets
2733 @grep -E ' ^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST ) | sort | awk ' BEGIN {FS = ":.*?## "}; {printf "%-15s %s\n", $$1, $$2}'
@@ -33,18 +39,25 @@ all: test conformance lint ## Run all tests and lint (default)
3339clean : # # Delete intermediate build artifacts
3440 @# -X only removes untracked files, -d recurses into directories, -f actually removes files/dirs
3541 git clean -Xdf
42+ @echo $(CEL_SPEC_VERSION )
3643
3744.PHONY : generate
38- generate : $(BIN ) /buf $(BIN ) /license-header # # Regenerate code and license headers
45+ generate : $(BIN ) /buf $(BIN ) /license-header upstream # # Regenerate code and license headers
3946 rm -rf gen
40- $(BIN ) /buf generate buf.build/bufbuild/protovalidate: $( PROTOVALIDATE_VERSION )
41- $(BIN ) /buf generate buf.build/bufbuild/protovalidate-testing: $( PROTOVALIDATE_VERSION )
47+ $(BIN ) /buf generate $( PROTOVALIDATE_PROTO_PATH )
48+ $(BIN ) /buf generate $( PROTOVALIDATE_TESTING_PROTO_PATH )
4249 $(BIN ) /buf generate buf.build/google/cel-spec:$(CEL_SPEC_VERSION ) --exclude-path cel/expr/conformance/proto2 --exclude-path cel/expr/conformance/proto3
4350 $(BIN ) /buf generate
4451 $(ADD_LICENSE_HEADER )
4552
53+ .PHONY : upstream
54+ upstream : $(BIN ) /buf
55+ rm -rf upstream
56+ $(BIN ) /buf export $(PROTOVALIDATE_PROTO_PATH ) -o upstream/proto
57+ $(ADD_LICENSE_HEADER )
58+
4659.PHONY : format
47- format : install $(BIN ) /buf $(BIN ) /license-header # # Format code
60+ format : install $(BIN ) /buf $(BIN ) /license-header # # Format code
4861 $(ADD_LICENSE_HEADER )
4962 buf format --write .
5063 uv run -- ruff format protovalidate test
0 commit comments