This repository was archived by the owner on Jan 4, 2026. It is now read-only.
forked from TimefoldAI/timefold-solver-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
170 lines (147 loc) · 7.01 KB
/
Copy pathMakefile
File metadata and controls
170 lines (147 loc) · 7.01 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
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
.PHONY: help venv install install-dev build test lint format clean dist check-dist publish-test publish check-deps maven-build
# Colors and formatting
BOLD := \033[1m
RED := \033[31m
GREEN := \033[32m
YELLOW := \033[33m
BLUE := \033[34m
MAGENTA := \033[35m
CYAN := \033[36m
RESET := \033[0m
# System python used to create the venv. The runtime python/pip/tools are taken from the venv.
SYSTEM_PYTHON := python
VENV := .venv
# VENV bin dir differs on Windows
ifeq ($(OS),Windows_NT)
VENV_BIN := $(VENV)/Scripts
else
VENV_BIN := $(VENV)/bin
endif
PYTHON := $(SYSTEM_PYTHON)
VENV_PY := $(VENV_BIN)/python
PIP := $(VENV_BIN)/pip
TOX := $(VENV_BIN)/tox
PRECOMMIT := $(VENV_BIN)/pre-commit
BLACK := $(VENV_BIN)/black
ISORT := $(VENV_BIN)/isort
MAVEN := ./mvnw
ifeq ($(OS),Windows_NT)
MAVEN := ./mvnw.cmd
endif
help:
@printf "$(BOLD)⚡ SolverForge Legacy$(RESET)\n"
@printf "$(CYAN)━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━$(RESET)\n"
@printf "\n"
@printf "$(BOLD)🛠️ Development Commands:$(RESET)\n"
@printf " $(GREEN)venv$(RESET) 🐍 Create Python virtual environment\n"
@printf " $(GREEN)install$(RESET) 📦 Install Python dependencies\n"
@printf " $(GREEN)install-dev$(RESET) 🔧 Install package in development mode\n"
@printf " $(GREEN)maven-build$(RESET) ☕ Run Maven clean install\n"
@printf " $(GREEN)build$(RESET) 🏗️ Full build (Maven + Python dev install)\n"
@printf "\n"
@printf "$(BOLD)🧪 Testing:$(RESET)\n"
@printf " $(BLUE)test$(RESET) 🧬 Run tests across Python versions\n"
@printf "\n"
@printf "$(BOLD)🎨 Code Quality:$(RESET)\n"
@printf " $(YELLOW)lint$(RESET) ✨ Run pre-commit hooks\n"
@printf " $(YELLOW)format$(RESET) 🎨 Format code\n"
@printf " $(YELLOW)check-deps$(RESET) 🔍 Verify dependencies\n"
@printf "\n"
@printf "$(BOLD)📦 Distribution:$(RESET)\n"
@printf " $(MAGENTA)dist$(RESET) 🔨 Build distribution packages\n"
@printf " $(MAGENTA)check-dist$(RESET) ✅ Validate distribution packages\n"
@printf "\n"
@printf "$(BOLD)🚀 Publishing:$(RESET)\n"
@printf " $(CYAN)publish-test$(RESET) 🧪 Publish to TestPyPI\n"
@printf " $(CYAN)publish$(RESET) 🌟 Publish to PyPI\n"
@printf "\n"
@printf "$(BOLD)🧹 Maintenance:$(RESET)\n"
@printf " $(RED)clean$(RESET) 🧽 Remove build artifacts\n"
@printf "\n"
@printf "$(CYAN)━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━$(RESET)\n"
venv:
@printf "$(GREEN)🐍 Creating virtual environment...$(RESET)\n"
@$(PYTHON) -m venv $(VENV)
@printf "$(GREEN)✅ Virtual environment created at $(VENV)$(RESET)\n"
@printf "$(CYAN)💡 Use $(VENV_BIN)/python and $(VENV_BIN)/pip for subsequent commands$(RESET)\n"
install: venv
@printf "$(BLUE)📦 Installing Python dependencies into venv...$(RESET)\n"
@$(PIP) install --upgrade pip
@$(PIP) install build twine wheel setuptools JPype1==1.5.1
@$(PIP) install pytest pytest-cov coverage tox
@$(PIP) install pre-commit black isort flake8
@printf "$(GREEN)✅ Python dependencies installed in venv$(RESET)\n"
maven-build:
@printf "$(YELLOW)☕ Running Maven clean install...$(RESET)\n"
@$(MAVEN) clean install
@printf "$(GREEN)✅ Maven build completed$(RESET)\n"
install-dev: install
@printf "$(CYAN)🔧 Installing package in development mode into venv...$(RESET)\n"
@$(PIP) install -e .
@printf "$(GREEN)✅ Package installed in development mode (editable)$(RESET)\n"
build: install maven-build install-dev
@printf "$(BOLD)$(GREEN)🏗️ Full build completed successfully!$(RESET)\n"
# Make 'test' depend on 'install' so tools (tox) are available in the venv.
test: install
@printf "$(MAGENTA)🧬 Running tests across Python versions...$(RESET)\n"
@$(TOX)
lint: install
@printf "$(YELLOW)✨ Running code quality checks...$(RESET)\n"
@$(PRECOMMIT) run --all-files || true
@printf "$(GREEN)✅ Linting completed$(RESET)\n"
format: install
@printf "$(MAGENTA)🎨 Formatting Python code...$(RESET)\n"
@$(BLACK) python-core/src jpyinterpreter/src/main/python python-core/tests jpyinterpreter/tests
@$(ISORT) python-core/src jpyinterpreter/src/main/python python-core/tests jpyinterpreter/tests
@printf "$(GREEN)✅ Code formatted$(RESET)\n"
check-deps: install
@printf "$(CYAN)🔍 Checking dependencies...$(RESET)\n"
@$(PIP) check
@$(PIP) list | grep -E "(build|twine|wheel|setuptools|JPype1)"
@printf "$(GREEN)✅ Dependencies verified$(RESET)\n"
clean:
@printf "$(RED)🧽 Cleaning up build artifacts...$(RESET)\n"
@rm -rf $(VENV) __pycache__ */__pycache__ .pytest_cache .mypy_cache .coverage .hypothesis
@rm -rf .build dist solverforge_legacy.egg-info .tox
@rm -rf python-core/target jpyinterpreter/target
@find . -type f -name '*.pyc' -delete
@find . -type d -name '__pycache__' -exec rm -rf {} + 2>/dev/null || true
@$(MAVEN) clean 2>/dev/null || true
@printf "$(GREEN)✅ Cleanup complete$(RESET)\n"
dist: install-dev
@printf "$(MAGENTA)🔨 Building distribution packages...$(RESET)\n"
@rm -rf dist/
@$(VENV_PY) -m build
@printf "$(GREEN)✅ Distribution packages built:$(RESET)\n"
@ls -lh dist/
check-dist: dist
@printf "$(CYAN)✅ Validating distribution packages...$(RESET)\n"
@$(VENV_PY) -m twine check dist/*
@printf "$(GREEN)✅ Distribution packages are valid$(RESET)\n"
publish-test: check-dist
@printf "$(YELLOW)🧪 Publishing to TestPyPI...$(RESET)\n"
@printf "$(CYAN)💡 Make sure you have TestPyPI credentials configured$(RESET)\n"
@$(VENV_PY) -m twine upload --repository testpypi dist/*
@printf "$(GREEN)✅ Published to TestPyPI$(RESET)\n"
@printf "$(CYAN)🔗 Test installation: pip install --index-url https://test.pypi.org/simple/ solverforge_legacy$(RESET)\n"
publish: check-dist
@printf "$(BOLD)$(MAGENTA)🚀 Publishing to PyPI...$(RESET)\n"
@printf "$(YELLOW)⚠️ This will publish to production PyPI!$(RESET)\n"
@read -p "Are you sure? (y/N): " confirm && [ "$$confirm" = "y" ]
@printf "$(CYAN)💡 Make sure you have PyPI credentials configured$(RESET)\n"
@$(VENV_PY) -m twine upload dist/*
@printf "$(BOLD)$(GREEN)🌟 Successfully published to PyPI!$(RESET)\n"
@printf "$(CYAN)🔗 Install with: pip install solverforge_legacy$(RESET)\n"
# Convenience aliases
dev: install-dev
@printf "$(GREEN)✅ Development environment ready$(RESET)\n"
release: publish
@printf "$(BOLD)$(GREEN)🎉 Release completed!$(RESET)\n"
# Version info
version:
@printf "$(BOLD)📋 Version Information:$(RESET)\n"
@grep "solverforge_legacy_version" setup.py | head -1
@printf "$(CYAN)Java Version: $(RESET)"
@java -version 2>&1 | head -1
@printf "$(CYAN)Python (system): $(RESET)"; $(PYTHON) --version
@printf "$(CYAN)Python (venv): $(RESET)"; if [ -x "$(VENV_PY)" ]; then $(VENV_PY) --version; else printf "venv not created\n"; fi