This repository was archived by the owner on Sep 10, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
141 lines (123 loc) Β· 4.35 KB
/
Makefile
File metadata and controls
141 lines (123 loc) Β· 4.35 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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
# FTL - Polyglot WebAssembly MCP Platform
# Main orchestration Makefile
.PHONY: all help build test clean install
# Default to showing help
help:
@echo "FTL - Fast, polyglot toolkit for building MCP tools on WebAssembly"
@echo ""
@echo "Available targets:"
@echo ""
@echo " Core Commands:"
@echo " build - Build FTL CLI (Go)"
@echo " test - Run all tests (Go CLI + Rust SDKs)"
@echo " install - Install FTL CLI to system"
@echo " clean - Clean all build artifacts"
@echo ""
@echo " Component Commands:"
@echo " build-components - Build WebAssembly components"
@echo " test-components - Test WebAssembly components"
@echo ""
@echo " Development Commands:"
@echo " generate-api - Generate API client from OpenAPI spec"
@echo " fmt - Format all code (Go + Rust)"
@echo " lint - Lint all code (Go + Rust)"
@echo " coverage - Generate test coverage reports"
@echo ""
@echo " Quick Commands:"
@echo " dev - Quick development build and test"
@echo " all - Build everything (CLI + components)"
# Generate API client from OpenAPI spec
generate-api:
@echo "π Generating API client from OpenAPI spec..."
@oapi-codegen -package api -generate types,client -o internal/api/client.gen.go internal/api/openapi.json
@echo "β
API client generated: internal/api/client.gen.go"
# Build FTL CLI (Go)
build:
@echo "π¨ Building FTL CLI..."
@echo "π Generating embedded files..."
@go generate ./...
@go build -ldflags "-X github.com/fastertools/ftl/internal/cli.version=$$(git describe --tags --always) \
-X github.com/fastertools/ftl/internal/cli.commit=$$(git rev-parse --short HEAD) \
-X github.com/fastertools/ftl/internal/cli.buildDate=$$(date -u +%Y-%m-%dT%H:%M:%SZ)" \
-o bin/ftl ./cmd/ftl
@echo "β
FTL CLI built: bin/ftl"
# Test Go CLI
test-cli:
@echo "π§ͺ Testing FTL CLI..."
@go test -v ./...
# Test Rust SDKs
test-sdk:
@echo "π§ͺ Testing Rust SDKs..."
@cd sdk/rust && cargo test --target $(shell rustc -vV | sed -n 's/host: //p')
@cd sdk/rust-macros && cargo test --target $(shell rustc -vV | sed -n 's/host: //p')
# Build WebAssembly components
build-components:
@echo "π¨ Building WebAssembly components..."
@# With .cargo/config.toml, wasm32-wasip1 is the default target
@cargo build --workspace --release
@echo "β
Components built in target/wasm32-wasip1/release/"
# Test WebAssembly components
test-components:
@echo "π§ͺ Testing WebAssembly components..."
@if command -v spin >/dev/null 2>&1; then \
cd components/mcp-authorizer && spin test; \
cd ../mcp-gateway && spin test; \
else \
echo "β οΈ spin not installed"; \
echo " Install from: https://developer.fermyon.com/spin/install"; \
fi
# Run all tests
test: test-cli test-sdk test-components
# Format all code
fmt:
@echo "π¨ Formatting code..."
@echo " Formatting Go code..."
@go fmt ./...
@echo " Formatting Rust code..."
@cargo fmt --all
# Lint all code
lint:
@echo "π Linting code..."
@echo " Linting Go code..."
@go vet ./...
@if command -v golangci-lint >/dev/null 2>&1; then \
golangci-lint run ./...; \
fi
@echo " Linting Rust code..."
@cargo clippy --all-targets --all-features -- -D warnings
# Generate coverage reports
coverage:
@echo "π Generating coverage reports..."
@echo " Go coverage..."
@go test -coverprofile=coverage.out ./...
@go tool cover -html=coverage.out -o coverage-go.html
@go tool cover -func=coverage.out | tail -1
@echo " Coverage report: coverage-go.html"
# Install FTL CLI
install: build
@echo "π¦ Installing FTL CLI..."
@mkdir -p ~/.local/bin
@cp bin/ftl ~/.local/bin/
@echo "β
Installed to ~/.local/bin/ftl"
@echo ""
@echo "Make sure ~/.local/bin is in your PATH:"
@echo ' export PATH=$$HOME/.local/bin:$$PATH'
# Install to system location (requires sudo)
install-system: build
@echo "π¦ Installing FTL CLI to system..."
@sudo cp bin/ftl /usr/local/bin/
@echo "β
Installed to /usr/local/bin/ftl"
# Clean all build artifacts
clean:
@echo "π§Ή Cleaning build artifacts..."
@rm -rf bin/ target/ coverage*.out coverage*.html
@go clean -cache -testcache
@cargo clean
@echo "β
Clean complete"
# Quick development cycle
dev: fmt build test-cli
@echo "β
Development build complete"
# Build everything
all: build build-components
@echo "β
All components built successfully"
.DEFAULT_GOAL := help