-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
56 lines (48 loc) · 1.84 KB
/
Makefile
File metadata and controls
56 lines (48 loc) · 1.84 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
.PHONY: help proto-gen clean-proto install-buf check-buf
# Default target
help:
@echo "Available targets:"
@echo " proto-gen - Generate protobuf code from CometBFT protos"
@echo " clean-proto - Clean generated protobuf code"
@echo " install-buf - Install buf CLI tool"
@echo " check-buf - Check if buf is installed"
@echo " help - Show this help message"
# Check if buf is installed
check-buf:
@which buf > /dev/null || (echo "buf is not installed. Run 'make install-buf' to install it." && exit 1)
# Install buf CLI tool
install-buf:
@echo "Installing buf CLI..."
@if command -v brew >/dev/null 2>&1; then \
brew install bufbuild/buf/buf; \
elif command -v curl >/dev/null 2>&1; then \
curl -sSL https://github.com/bufbuild/buf/releases/latest/download/buf-$$(uname -s)-$$(uname -m) -o /tmp/buf && \
sudo mv /tmp/buf /usr/local/bin/buf && \
sudo chmod +x /usr/local/bin/buf; \
else \
echo "Please install buf manually from https://github.com/bufbuild/buf/releases"; \
exit 1; \
fi
@echo "buf installed successfully!"
# Generate protobuf code
proto-gen: check-buf
@echo "Generating protobuf code from CometBFT protos..."
@mkdir -p crates/astro-proto-types/src/codegen
buf generate
@echo "Protobuf code generation completed!"
@echo "Generated files are located in: crates/astro-proto-types/src/codegen/"
# Clean generated protobuf code
clean-proto:
@echo "Cleaning generated protobuf code..."
rm -rf crates/astro-proto-types/src/codegen
@echo "Cleaned generated protobuf code!"
# Full rebuild: clean and generate
rebuild-proto: clean-proto proto-gen
# Build the proto crate after generation
build-proto: proto-gen
@echo "Building astro-proto-types crate..."
cargo build -p astro-proto-types
# Run tests for the proto crate
test-proto: proto-gen
@echo "Testing astro-proto-types crate..."
cargo test -p astro-proto-types