-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
60 lines (51 loc) · 1.66 KB
/
Makefile
File metadata and controls
60 lines (51 loc) · 1.66 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
# My Makefile - for server side Swift projects
build:
swift build
update:
swift package update
release:
swift build -c release
test:
swift test
clean:
rm -rf .build
lint:
@echo "🔍 Running SwiftLint..."
@if ! command -v swiftlint >/dev/null 2>&1; then \
echo "❌ SwiftLint not found. Please install it with: brew install swiftlint"; \
exit 1; \
fi
swiftlint
@echo "✅ Linting complete."
lint-fix:
swiftlint --fix
format-check:
@echo "🔍 Checking code formatting with swift-format..."
@if ! command -v swift-format >/dev/null 2>&1; then \
echo "❌ swift-format not found. Please install it with: brew install swift-format"; \
exit 1; \
fi
@if [ -z "$$(find Sources Tests -name '*.swift' 2>/dev/null)" ]; then \
echo "⚠️ No Swift files found in Sources or Tests. Skipping format check."; \
else \
if find Sources Tests -name "*.swift" | xargs swift-format --mode diff 2>/dev/null | grep -q .; then \
echo "❌ Code formatting issues found. Run 'make format' to fix them."; \
find Sources Tests -name "*.swift" | xargs swift-format --mode diff; \
exit 1; \
else \
echo "✅ Code formatting is correct."; \
fi \
fi
format:
@echo "🎨 Formatting code with swift-format..."
@if ! command -v swift-format >/dev/null 2>&1; then \
echo "❌ swift-format not found. Please install it with: brew install swift-format"; \
exit 1; \
fi
@if [ -z "$$(find Sources Tests -name '*.swift' 2>/dev/null)" ]; then \
echo "⚠️ No Swift files found in Sources or Tests. Skipping formatting."; \
exit 0; \
else \
find Sources Tests -name "*.swift" | xargs swift-format --mode write --in-place; \
echo "✅ Code formatting complete."; \
fi