Skip to content

Commit f4161dc

Browse files
committed
add force-protobuf target
1 parent 315d929 commit f4161dc

1 file changed

Lines changed: 19 additions & 1 deletion

File tree

Makefile

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
# Usage:
44
# make Build protobuf bindings, parsers, and printers.
55
# make protobuf Lint, check breaking changes, and generate protobuf code.
6+
# make force-protobuf Force-regenerate all protobuf code.
67
# make parsers Regenerate Python, Julia, and Go parsers from the grammar.
78
# make parser-X Regenerate a single parser (X = python, julia, go).
89
# make force-parsers Force-regenerate all parsers.
@@ -74,7 +75,7 @@ JL_PROTO_GENERATED := \
7475
$(JL_PROTO_DIR)/fragments_pb.jl \
7576
$(JL_PROTO_DIR)/transactions_pb.jl
7677

77-
.PHONY: all protobuf parsers parser-python parser-julia parser-go \
78+
.PHONY: all protobuf force-protobuf parsers parser-python parser-julia parser-go \
7879
force-parsers force-parser-python force-parser-julia force-parser-go \
7980
printers printer-python printer-julia printer-go \
8081
force-printers force-printer-python force-printer-julia force-printer-go \
@@ -92,6 +93,23 @@ protobuf: $(PY_PROTO_GENERATED) $(GO_PROTO_GENERATED) $(JL_PROTO_GENERATED)
9293
touch-proto-generated:
9394
touch $(PY_PROTO_GENERATED) $(GO_PROTO_GENERATED) $(JL_PROTO_GENERATED)
9495

96+
force-protobuf:
97+
buf lint
98+
buf breaking --against ".git#branch=main,subdir=proto"
99+
buf generate
100+
mkdir -p $(PY_PROTO_DIR)
101+
cp gen/python/relationalai/lqp/v1/*_pb2.py* $(PY_PROTO_DIR)/
102+
for file in $(PY_PROTO_DIR)/*_pb2.py*; do \
103+
sed 's/from relationalai\.lqp\.v1/from lqp\.proto\.v1/g' "$$file" > "$$file.tmp" && \
104+
mv "$$file.tmp" "$$file"; \
105+
sed 's/import relationalai\.lqp\.v1/import lqp\.proto\.v1/g' "$$file" > "$$file.tmp" && \
106+
mv "$$file.tmp" "$$file"; \
107+
done
108+
mkdir -p $(GO_PROTO_DIR)
109+
cp gen/go/relationalai/lqp/v1/*.pb.go $(GO_PROTO_DIR)/
110+
rm -rf gen/python gen/go
111+
cd sdks/julia && julia --project=LogicalQueryProtocol.jl generate_proto.jl
112+
95113
$(PY_PROTO_GENERATED) $(GO_PROTO_GENERATED): $(PROTO_FILES)
96114
buf lint
97115
buf breaking --against ".git#branch=main,subdir=proto"

0 commit comments

Comments
 (0)