|
1 | | -.PHONY: help format check test clean build generate-client |
| 1 | +.PHONY: format format-core format-openai install install-core install-openai status status-core status-openai check test clean build generate-client run |
2 | 2 |
|
3 | | -help: ## Show this help message |
4 | | - @echo "Available commands:" |
5 | | - @grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}' |
| 3 | +format: |
| 4 | + @echo "[format] judgeval-java" |
| 5 | + mvn -B -pl judgeval-java -am spotless:apply |
| 6 | + @echo "[format] instrumentation/judgeval-instrumentation-openai" |
| 7 | + mvn -B -pl instrumentation/judgeval-instrumentation-openai -am spotless:apply |
6 | 8 |
|
7 | | -format: ## Format code using Spotless |
8 | | - mvn spotless:apply |
| 9 | +format-core: |
| 10 | + mvn -B -pl judgeval-java -am spotless:apply |
9 | 11 |
|
10 | | -check: ## Run all code quality checks |
11 | | - mvn compile checkstyle:check spotless:check |
| 12 | +format-openai: |
| 13 | + mvn -B -pl instrumentation/judgeval-instrumentation-openai -am spotless:apply |
12 | 14 |
|
13 | | -test: ## Run tests |
| 15 | +check: |
| 16 | + mvn -B compile checkstyle:check spotless:check |
| 17 | + |
| 18 | +test: |
14 | 19 | mvn test |
15 | 20 |
|
16 | | -clean: ## Clean build artifacts |
| 21 | +clean: |
17 | 22 | mvn clean |
18 | 23 |
|
19 | | -build: ## Build the project |
20 | | - mvn clean compile |
| 24 | +build: |
| 25 | + mvn -B clean compile |
| 26 | + |
| 27 | +install: |
| 28 | + @echo "[install] judgeval-java" |
| 29 | + mvn -B -Dgpg.skip=true -pl judgeval-java -am clean install |
| 30 | + @echo "[install] instrumentation/judgeval-instrumentation-openai" |
| 31 | + mvn -B -Dgpg.skip=true -pl instrumentation/judgeval-instrumentation-openai -am clean install |
| 32 | + |
| 33 | +install-core: |
| 34 | + mvn -B -Dgpg.skip=true -pl judgeval-java -am clean install |
21 | 35 |
|
22 | | -install: ## Install the project |
23 | | - mvn clean install -Dgpg.skip=true |
| 36 | +install-openai: |
| 37 | + mvn -B -Dgpg.skip=true -pl instrumentation/judgeval-instrumentation-openai -am clean install |
24 | 38 |
|
25 | | -generate-client: ## Generate API client from OpenAPI spec |
| 39 | +generate-client: |
26 | 40 | ./scripts/generate-client.sh |
27 | 41 | make format |
28 | 42 |
|
29 | | -lint: ## Run linting only |
30 | | - mvn checkstyle:check |
| 43 | +lint: |
| 44 | + mvn -B checkstyle:check |
| 45 | + |
| 46 | +format-check: |
| 47 | + mvn -B spotless:check |
| 48 | + |
| 49 | +ci: |
| 50 | + mvn -B clean compile test checkstyle:check spotless:check |
| 51 | + |
| 52 | +status: |
| 53 | + $(MAKE) status-core |
| 54 | + $(MAKE) status-openai |
| 55 | + |
| 56 | +status-core: |
| 57 | + @echo "[status] judgeval-java" |
| 58 | + @G=$$(mvn -q -pl judgeval-java -DforceStdout help:evaluate -Dexpression=project.groupId); \ |
| 59 | + A=$$(mvn -q -pl judgeval-java -DforceStdout help:evaluate -Dexpression=project.artifactId); \ |
| 60 | + V=$$(mvn -q -pl judgeval-java -DforceStdout help:evaluate -Dexpression=project.version); \ |
| 61 | + echo "GAV: $$G:$$A:$$V"; \ |
| 62 | + ls -1 judgeval-java/target/*.jar 2>/dev/null || echo "No jar built" |
| 63 | + |
| 64 | +status-openai: |
| 65 | + @echo "[status] instrumentation/judgeval-instrumentation-openai" |
| 66 | + @G=$$(mvn -q -pl instrumentation/judgeval-instrumentation-openai -DforceStdout help:evaluate -Dexpression=project.groupId); \ |
| 67 | + A=$$(mvn -q -pl instrumentation/judgeval-instrumentation-openai -DforceStdout help:evaluate -Dexpression=project.artifactId); \ |
| 68 | + V=$$(mvn -q -pl instrumentation/judgeval-instrumentation-openai -DforceStdout help:evaluate -Dexpression=project.version); \ |
| 69 | + echo "GAV: $$G:$$A:$$V"; \ |
| 70 | + ls -1 instrumentation/judgeval-instrumentation-openai/target/*.jar 2>/dev/null || echo "No jar built" |
| 71 | + |
| 72 | +MAIN ?= |
| 73 | + |
| 74 | +ifneq (,$(filter run,$(MAKECMDGOALS))) |
| 75 | +EXAMPLE := $(word 2,$(MAKECMDGOALS)) |
| 76 | +ifeq ($(EXAMPLE),) |
| 77 | +$(error Usage: make run <example_folder> [MAIN=ClassName]) |
| 78 | +endif |
| 79 | +$(eval $(EXAMPLE):;@:) |
| 80 | +endif |
31 | 81 |
|
32 | | -format-check: ## Check formatting without applying |
33 | | - mvn spotless:check |
34 | 82 |
|
35 | | -ci: ## Run CI checks (compile, test, checkstyle, spotless) |
36 | | - mvn clean compile test checkstyle:check spotless:check |
37 | 83 |
|
38 | | -run: ## Run a specific Java class with environment variables (usage: make run CLASS=com.example.MyClass) |
39 | | - @if [ -f .env ]; then \ |
40 | | - export $$(grep -v '^#' .env | grep -v '^$$' | xargs) && mvn exec:java -Dexec.mainClass="$(CLASS)"; \ |
41 | | - else \ |
42 | | - mvn exec:java -Dexec.mainClass="$(CLASS)"; \ |
43 | | - fi |
| 84 | +run: |
| 85 | + @echo "[run] examples.$(EXAMPLE)" |
| 86 | + if [ -f .env ]; then export $$(grep -v '^#' .env | grep -v '^$$' | xargs); fi; \ |
| 87 | + MAIN_CLASS=$(MAIN); \ |
| 88 | + if [ -z "$$MAIN_CLASS" ]; then \ |
| 89 | + MAIN_CLASS=$$(ls examples/src/main/java/examples/$(EXAMPLE)/*.java | head -n1 | xargs -n1 basename | sed 's/\.java$$//'); \ |
| 90 | + fi; \ |
| 91 | + mvn -q -f examples/pom.xml -DskipTests -Dexec.cleanupDaemonThreads=false -Dexec.mainClass=examples.$(EXAMPLE).$$MAIN_CLASS clean compile exec:java |
0 commit comments