Skip to content

Commit cc5953b

Browse files
authored
Add ability to depend on an arbitrary upstream commit (#409)
To enale this, we also keeps a local copy of the protovalidate protos. This is similar to Java. Signed-off-by: Sri Krishna <skrishna@buf.build>
1 parent 480c88d commit cc5953b

File tree

4 files changed

+5224
-12
lines changed

4 files changed

+5224
-12
lines changed

Makefile

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -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
2221
CEL_SPEC_VERSION ?= v0.25.1
2322
TESTDATA_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
2632
help: ## 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)
3339
clean: ## 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

buf.lock

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,2 @@
11
# Generated by buf. DO NOT EDIT.
22
version: v2
3-
deps:
4-
- name: buf.build/bufbuild/protovalidate
5-
commit: 52f32327d4b045a79293a6ad4e7e1236
6-
digest: b5:cbabc98d4b7b7b0447c9b15f68eeb8a7a44ef8516cb386ac5f66e7fd4062cd6723ed3f452ad8c384b851f79e33d26e7f8a94e2b807282b3def1cd966c7eace97

buf.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
version: v2
22
modules:
33
- path: proto
4-
deps:
5-
- buf.build/bufbuild/protovalidate:v1.0.0
4+
- path: upstream/proto
65
lint:
76
use:
87
- STANDARD

0 commit comments

Comments
 (0)