This repository was archived by the owner on Dec 4, 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
108 lines (100 loc) · 3.43 KB
/
Copy pathMakefile
File metadata and controls
108 lines (100 loc) · 3.43 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
# Makefile for Claude Code Hooks Integration
# NotelyCapture - Kotlin Multiplatform Mobile Application
.PHONY: lint test lint-all test-all lint-kotlin lint-python check-integration
# Lint target - called by smart-lint.sh after file edits
# Receives FILE= argument with relative path to edited file
lint:
@if [ -n "$(FILE)" ]; then \
echo "Linting specific file: $(FILE)" >&2; \
case "$(FILE)" in \
*.kt|*.kts) \
echo "Running Kotlin linting for $(FILE)" >&2; \
./gradlew ktlintCheck --daemon >&2; \
;; \
*.py) \
echo "Running Python linting for $(FILE)" >&2; \
if command -v ruff >/dev/null 2>&1; then \
ruff check "$(FILE)" >&2; \
elif command -v flake8 >/dev/null 2>&1; then \
flake8 "$(FILE)" >&2; \
else \
echo "Warning: No Python linter found (ruff or flake8)" >&2; \
fi; \
;; \
*) \
echo "No specific linter for file type: $(FILE)" >&2; \
;; \
esac \
else \
echo "Linting all files" >&2; \
$(MAKE) lint-all; \
fi
# Test target - called by smart-test.sh after file edits
# Receives FILE= argument with relative path to edited file
test:
@if [ -n "$(FILE)" ]; then \
echo "Testing for file: $(FILE)" >&2; \
case "$(FILE)" in \
*.kt|*.kts) \
echo "Running Kotlin tests" >&2; \
./gradlew testDebugUnitTest --daemon >&2; \
;; \
*.py) \
echo "Running Python tests (if any)" >&2; \
if command -v pytest >/dev/null 2>&1; then \
pytest -xvs >&2 || echo "No Python tests found" >&2; \
else \
echo "No Python testing framework found" >&2; \
fi; \
;; \
*) \
echo "Running all available tests" >&2; \
$(MAKE) test-all; \
;; \
esac \
else \
echo "Running all tests" >&2; \
$(MAKE) test-all; \
fi
# Project-wide linting
lint-all:
@echo "Running all linting checks" >&2
@$(MAKE) lint-kotlin
@$(MAKE) lint-python
# Project-wide testing
test-all:
@echo "Running all tests" >&2
@./gradlew testDebugUnitTest --daemon >&2
@if command -v pytest >/dev/null 2>&1; then \
pytest -xvs >&2 || echo "No Python tests to run" >&2; \
fi
# Kotlin-specific linting
lint-kotlin:
@echo "Running Kotlin linting (ktlint)" >&2
@./gradlew ktlintCheck --daemon >&2
# Python-specific linting (for utility files)
lint-python:
@echo "Running Python linting (optional)" >&2
@if command -v ruff >/dev/null 2>&1; then \
echo "Using ruff for Python linting" >&2; \
ruff check lib/src/main/jni/ggml/src/ggml-cuda/template-instances/ >&2 || true; \
ruff check lib/src/main/jni/ggml/src/ggml-opencl/kernels/ >&2 || true; \
elif command -v flake8 >/dev/null 2>&1; then \
echo "Using flake8 for Python linting" >&2; \
flake8 lib/src/main/jni/ggml/src/ggml-cuda/template-instances/ >&2 || true; \
flake8 lib/src/main/jni/ggml/src/ggml-opencl/kernels/ >&2 || true; \
else \
echo "No Python linter available (install ruff or flake8 if needed)" >&2; \
fi
# Helper target to verify integration
check-integration:
@echo "✓ Makefile detected by Claude Code hooks" >&2
@echo " - 'make lint' target: available" >&2
@echo " - 'make test' target: available" >&2
@echo " - Project type: Kotlin Multiplatform (Android/iOS)" >&2
@echo " - Build system: Gradle" >&2
@echo "" >&2
@echo "Test integration with:" >&2
@echo " make lint FILE=shared/src/commonMain/kotlin/SomeFile.kt" >&2
@echo " make test FILE=shared/src/commonTest/kotlin/SomeTest.kt" >&2
@echo " make lint FILE=lib/src/main/jni/ggml/src/ggml-cuda/template-instances/generate_cu_files.py" >&2