-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
132 lines (112 loc) Β· 5.16 KB
/
Makefile
File metadata and controls
132 lines (112 loc) Β· 5.16 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
# FoldingKit - iOS & macOS App Development Commands
# Similar to package.json scripts but for Swift/iOS
.PHONY: help install test lint format build clean hooks-install
help: ## Show available commands
@echo "π± FoldingKit Development Commands"
@echo ""
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {printf " \033[36m%-15s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST)
install: ## Install development dependencies (SwiftLint, SwiftFormat, git-chglog)
@echo "π¦ Installing development tools..."
@if command -v mint >/dev/null 2>&1; then \
echo "Using Mint (Swift package manager for tools)..."; \
mint bootstrap; \
elif command -v brew >/dev/null 2>&1; then \
echo "Using Homebrew..."; \
brew install swiftlint swiftformat; \
else \
echo "β Neither Mint nor Homebrew found."; \
echo "Install Homebrew: https://brew.sh"; \
echo "Or install Mint: brew install mint"; \
exit 1; \
fi
@echo "π¦ Installing git-chglog for changelog generation..."
@if [ ! -f "$$HOME/.local/bin/git-chglog" ]; then \
echo "Downloading git-chglog binary..."; \
mkdir -p "$$HOME/.local/bin"; \
ARCH=$$(uname -m); \
if [ "$$ARCH" = "arm64" ]; then ARCH="arm64"; else ARCH="amd64"; fi; \
curl -sL "https://github.com/git-chglog/git-chglog/releases/download/v0.15.4/git-chglog_0.15.4_darwin_$${ARCH}.tar.gz" | tar xz -C /tmp && \
mv /tmp/git-chglog "$$HOME/.local/bin/" && \
echo "β
git-chglog installed to ~/.local/bin"; \
else \
echo "β
git-chglog already installed"; \
fi
@echo "π¦ Checking GitHub CLI (gh)..."
@if ! command -v gh >/dev/null 2>&1; then \
echo "β οΈ GitHub CLI (gh) not found - required for releases"; \
echo "Install with: brew install gh"; \
fi
@echo "β
Development tools installed!"
hooks-install: ## Install git hooks for commit message validation
@echo "πͺ Installing git hooks..."
@git config core.hooksPath .githooks
@chmod +x .githooks/*
@echo "β
Git hooks installed!"
@echo " Commits will now be validated for Conventional Commits format"
@echo " Run 'git commit' to see validation in action"
test: ## Run basic tests (full test target setup needed in Xcode)
@./scripts/test.sh
lint: ## Run SwiftLint (check code quality only)
@./scripts/lint.sh
lint-fix: ## Run SwiftLint with auto-fix (like eslint --fix)
@./scripts/lint-fix.sh
format: ## Run SwiftFormat (auto-format code like Prettier)
@./scripts/format.sh
format-check: ## Check formatting without modifying files (for CI)
@echo "π Checking code formatting..."
@if command -v swiftformat >/dev/null 2>&1; then \
swiftformat --lint Sources Tests FoldingKit; \
elif command -v mint >/dev/null 2>&1; then \
mint run swiftformat --lint Sources Tests FoldingKit; \
else \
echo "β Neither swiftformat nor mint found"; \
exit 1; \
fi
build: ## Build the app for simulator
@echo "π¨ Building FoldingKit..."
@xcodebuild -project FoldingKit.xcodeproj -scheme FoldingKit -sdk iphonesimulator
clean: ## Clean build artifacts
@echo "π§Ή Cleaning build artifacts..."
@xcodebuild clean -project FoldingKit.xcodeproj
@rm -rf build/
@echo "β
Clean complete!"
check: lint test ## Run both linting and tests
fix: format lint-fix ## Format code and auto-fix linting issues (like prettier + eslint --fix)
ready: fix test ## Full pre-commit workflow: format, auto-fix, and test
dev: fix ## Alias for fix - format and auto-fix before committing
setup: install hooks-install ## Complete first-time setup (tools + hooks)
version: ## Update version and build number
@./scripts/update-version.sh
changelog: ## Generate CHANGELOG.md from conventional commits
@echo "π Generating CHANGELOG.md..."
@if [ ! -f "$$HOME/.local/bin/git-chglog" ] && ! command -v git-chglog >/dev/null 2>&1; then \
echo "β git-chglog not found. Installing..."; \
mkdir -p "$$HOME/.local/bin"; \
ARCH=$$(uname -m); \
if [ "$$ARCH" = "arm64" ]; then ARCH="arm64"; else ARCH="amd64"; fi; \
curl -sL "https://github.com/git-chglog/git-chglog/releases/download/v0.15.4/git-chglog_0.15.4_darwin_$${ARCH}.tar.gz" | tar xz -C /tmp && \
mv /tmp/git-chglog "$$HOME/.local/bin/" && \
echo "β
git-chglog installed"; \
fi
@if [ -f "$$HOME/.local/bin/git-chglog" ]; then \
$$HOME/.local/bin/git-chglog -o CHANGELOG.md; \
else \
git-chglog -o CHANGELOG.md; \
fi
@echo "β
CHANGELOG.md updated!"
release: ## Automated release: reads version from Xcode, auto-increments build (usage: make release [PLATFORM=ios|macos|both])
@./scripts/release-auto.sh $(PLATFORM)
release-manual: ## Manual release with explicit version/build (usage: make release-manual VERSION=x.x.x BUILD=n [PLATFORM=ios|macos|both])
@if [ -z "$(VERSION)" ] || [ -z "$(BUILD)" ]; then \
echo "β Error: Missing required parameters"; \
echo ""; \
echo "Usage: make release-manual VERSION=x.x.x BUILD=n [PLATFORM=ios|macos|both]"; \
echo ""; \
echo "Examples:"; \
echo " make release-manual VERSION=1.0.0 BUILD=3 (creates both iOS and macOS)"; \
echo " make release-manual VERSION=1.0.0 BUILD=3 PLATFORM=ios (creates iOS only)"; \
echo " make release-manual VERSION=1.0.0 BUILD=3 PLATFORM=macos (creates macOS only)"; \
echo ""; \
exit 1; \
fi
@./scripts/release.sh $(VERSION) $(BUILD) $(PLATFORM)