-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
326 lines (281 loc) · 11.4 KB
/
Copy pathMakefile
File metadata and controls
326 lines (281 loc) · 11.4 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
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
# SkinLab iOS Project Makefile
# Convenient make targets for common operations
.PHONY: all setup lint format test build clean quality report help
# Configuration
PROJECT_NAME = SkinLab
SCHEME = SkinLab
DESTINATION = 'platform=iOS Simulator,name=iPhone 15'
CONFIGURATION = Debug
# Colors
CYAN = \033[0;36m
GREEN = \033[0;32m
YELLOW = \033[1;33m
RED = \033[0;31m
NC = \033[0m
# Default target
all: help
#------------------------------------------------------------------------------
# Setup
#------------------------------------------------------------------------------
## Install all required development tools
setup: setup-homebrew setup-swiftlint setup-swiftformat setup-periphery setup-pmd
@echo "$(GREEN)✓ All tools installed successfully!$(NC)"
setup-homebrew:
@echo "$(CYAN)Checking Homebrew...$(NC)"
@which brew > /dev/null || (echo "Please install Homebrew first: https://brew.sh" && exit 1)
@echo "$(GREEN)✓ Homebrew available$(NC)"
setup-swiftlint:
@echo "$(CYAN)Installing SwiftLint...$(NC)"
@which swiftlint > /dev/null || brew install swiftlint
@echo "$(GREEN)✓ SwiftLint installed: $$(swiftlint version)$(NC)"
setup-swiftformat:
@echo "$(CYAN)Installing SwiftFormat...$(NC)"
@which swiftformat > /dev/null || brew install swiftformat
@echo "$(GREEN)✓ SwiftFormat installed: $$(swiftformat --version)$(NC)"
setup-periphery:
@echo "$(CYAN)Installing Periphery...$(NC)"
@which periphery > /dev/null || brew install peripheryapp/periphery/periphery
@echo "$(GREEN)✓ Periphery installed$(NC)"
setup-pmd:
@echo "$(CYAN)Installing PMD...$(NC)"
@which pmd > /dev/null || brew install pmd
@echo "$(GREEN)✓ PMD installed$(NC)"
#------------------------------------------------------------------------------
# Linting
#------------------------------------------------------------------------------
## Run SwiftLint to check code style
lint:
@echo "$(CYAN)Running SwiftLint...$(NC)"
@swiftlint lint --strict 2>/dev/null || swiftlint
@echo "$(GREEN)✓ Linting complete$(NC)"
## Run SwiftLint with auto-fix
lint-fix:
@echo "$(CYAN)Running SwiftLint with auto-fix...$(NC)"
@swiftlint --fix
@echo "$(GREEN)✓ Auto-fix complete$(NC)"
#------------------------------------------------------------------------------
# Formatting
#------------------------------------------------------------------------------
## Run SwiftFormat to format code
format:
@echo "$(CYAN)Running SwiftFormat...$(NC)"
@swiftformat $(PROJECT_NAME) --swiftversion 5.9
@echo "$(GREEN)✓ Formatting complete$(NC)"
## Check formatting without making changes
format-check:
@echo "$(CYAN)Checking code formatting...$(NC)"
@swiftformat $(PROJECT_NAME) --lint --swiftversion 5.9
@echo "$(GREEN)✓ Format check complete$(NC)"
#------------------------------------------------------------------------------
# Testing
#------------------------------------------------------------------------------
## Run all unit tests
test:
@echo "$(CYAN)Running unit tests...$(NC)"
@xcodebuild test \
-project $(PROJECT_NAME).xcodeproj \
-scheme $(SCHEME) \
-destination $(DESTINATION) \
-configuration $(CONFIGURATION) \
-resultBundlePath TestResults.xcresult \
-enableCodeCoverage YES \
| xcbeautify 2>/dev/null || xcodebuild test \
-project $(PROJECT_NAME).xcodeproj \
-scheme $(SCHEME) \
-destination $(DESTINATION) \
-enableCodeCoverage YES
@echo "$(GREEN)✓ Tests complete$(NC)"
## Run UI tests
test-ui:
@echo "$(CYAN)Running UI tests...$(NC)"
@xcodebuild test \
-project $(PROJECT_NAME).xcodeproj \
-scheme $(PROJECT_NAME)UITests \
-destination $(DESTINATION) \
| xcbeautify 2>/dev/null || xcodebuild test \
-project $(PROJECT_NAME).xcodeproj \
-scheme $(PROJECT_NAME)UITests \
-destination $(DESTINATION)
@echo "$(GREEN)✓ UI tests complete$(NC)"
## Run all tests (unit + UI)
test-all: test test-ui
## Show code coverage report
coverage:
@echo "$(CYAN)Generating coverage report...$(NC)"
@if [ -d "TestResults.xcresult" ]; then \
xcrun xccov view --report TestResults.xcresult; \
else \
echo "$(YELLOW)Run 'make test' first to generate coverage data$(NC)"; \
fi
#------------------------------------------------------------------------------
# Building
#------------------------------------------------------------------------------
## Build the project (Debug)
build:
@echo "$(CYAN)Building project (Debug)...$(NC)"
@xcodebuild build \
-project $(PROJECT_NAME).xcodeproj \
-scheme $(SCHEME) \
-destination $(DESTINATION) \
-configuration Debug \
CODE_SIGNING_ALLOWED=NO \
| xcbeautify 2>/dev/null || xcodebuild build \
-project $(PROJECT_NAME).xcodeproj \
-scheme $(SCHEME) \
-destination $(DESTINATION) \
CODE_SIGNING_ALLOWED=NO
@echo "$(GREEN)✓ Build complete$(NC)"
## Build the project (Release)
build-release:
@echo "$(CYAN)Building project (Release)...$(NC)"
@xcodebuild build \
-project $(PROJECT_NAME).xcodeproj \
-scheme $(SCHEME) \
-destination $(DESTINATION) \
-configuration Release \
CODE_SIGNING_ALLOWED=NO \
| xcbeautify 2>/dev/null || xcodebuild build \
-project $(PROJECT_NAME).xcodeproj \
-scheme $(SCHEME) \
-destination $(DESTINATION) \
-configuration Release \
CODE_SIGNING_ALLOWED=NO
@echo "$(GREEN)✓ Release build complete$(NC)"
## Clean build artifacts
clean:
@echo "$(CYAN)Cleaning build artifacts...$(NC)"
@xcodebuild clean \
-project $(PROJECT_NAME).xcodeproj \
-scheme $(SCHEME) \
-configuration $(CONFIGURATION)
@rm -rf DerivedData
@rm -rf build
@rm -rf TestResults.xcresult
@echo "$(GREEN)✓ Clean complete$(NC)"
#------------------------------------------------------------------------------
# Quality Checks
#------------------------------------------------------------------------------
## Run all quality checks (lint, format-check, test, build)
quality: lint format-check build test
@echo "$(GREEN)━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━$(NC)"
@echo "$(GREEN)✓ All quality checks passed!$(NC)"
@echo "$(GREEN)━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━$(NC)"
## Run quick quality checks (lint, build)
quality-quick: lint build
@echo "$(GREEN)✓ Quick quality checks passed!$(NC)"
## Run dead code detection
dead-code:
@echo "$(CYAN)Running dead code detection...$(NC)"
@./scripts/dead-code.sh
## Run duplicate code detection
duplicates:
@echo "$(CYAN)Running duplicate code detection...$(NC)"
@./scripts/duplicate-code.sh
## Check for stale feature flags
stale-flags:
@echo "$(CYAN)Checking for stale feature flags...$(NC)"
@./scripts/stale-flags.sh
#------------------------------------------------------------------------------
# Reports
#------------------------------------------------------------------------------
## Generate all tech debt and quality reports
report: tech-debt stale-flags dead-code duplicates
@echo "$(GREEN)━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━$(NC)"
@echo "$(GREEN)✓ All reports generated in docs/$(NC)"
@echo "$(GREEN)━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━$(NC)"
@ls -la docs/*.md 2>/dev/null || true
## Generate tech debt report (TODOs, FIXMEs, HACKs)
tech-debt:
@echo "$(CYAN)Generating tech debt report...$(NC)"
@./scripts/tech-debt-report.sh
#------------------------------------------------------------------------------
# Development
#------------------------------------------------------------------------------
## Open project in Xcode
open:
@open $(PROJECT_NAME).xcodeproj
## Generate Xcode project (if using Swift Package Manager)
generate:
@echo "$(CYAN)Generating Xcode project...$(NC)"
@swift package generate-xcodeproj || echo "Not a Swift Package"
## Update Swift packages
update-packages:
@echo "$(CYAN)Updating Swift packages...$(NC)"
@xcodebuild -resolvePackageDependencies \
-project $(PROJECT_NAME).xcodeproj \
-scheme $(SCHEME)
@echo "$(GREEN)✓ Packages updated$(NC)"
## Show outdated dependencies (requires swift-outdated)
outdated:
@echo "$(CYAN)Checking for outdated packages...$(NC)"
@which swift-outdated > /dev/null || (echo "Install with: brew install swift-outdated" && exit 1)
@swift-outdated
#------------------------------------------------------------------------------
# CI/CD
#------------------------------------------------------------------------------
## Run CI pipeline locally (quality + coverage)
ci: clean quality coverage
@echo "$(GREEN)━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━$(NC)"
@echo "$(GREEN)✓ CI pipeline passed!$(NC)"
@echo "$(GREEN)━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━$(NC)"
## Archive for distribution
archive:
@echo "$(CYAN)Creating archive...$(NC)"
@xcodebuild archive \
-project $(PROJECT_NAME).xcodeproj \
-scheme $(SCHEME) \
-archivePath build/$(PROJECT_NAME).xcarchive \
-configuration Release \
CODE_SIGNING_ALLOWED=NO
@echo "$(GREEN)✓ Archive created at build/$(PROJECT_NAME).xcarchive$(NC)"
#------------------------------------------------------------------------------
# Help
#------------------------------------------------------------------------------
## Show this help message
help:
@echo ""
@echo "$(CYAN)SkinLab iOS Project$(NC)"
@echo "$(CYAN)━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━$(NC)"
@echo ""
@echo "$(YELLOW)Usage:$(NC) make [target]"
@echo ""
@echo "$(YELLOW)Setup:$(NC)"
@echo " setup Install all required development tools"
@echo ""
@echo "$(YELLOW)Code Quality:$(NC)"
@echo " lint Run SwiftLint to check code style"
@echo " lint-fix Run SwiftLint with auto-fix"
@echo " format Run SwiftFormat to format code"
@echo " format-check Check formatting without changes"
@echo ""
@echo "$(YELLOW)Testing:$(NC)"
@echo " test Run unit tests"
@echo " test-ui Run UI tests"
@echo " test-all Run all tests"
@echo " coverage Show code coverage report"
@echo ""
@echo "$(YELLOW)Building:$(NC)"
@echo " build Build project (Debug)"
@echo " build-release Build project (Release)"
@echo " clean Clean build artifacts"
@echo " archive Create archive for distribution"
@echo ""
@echo "$(YELLOW)Quality:$(NC)"
@echo " quality Run all quality checks"
@echo " quality-quick Run quick quality checks"
@echo " dead-code Detect unused code"
@echo " duplicates Detect duplicate code"
@echo " stale-flags Check for stale feature flags"
@echo ""
@echo "$(YELLOW)Reports:$(NC)"
@echo " report Generate all quality reports"
@echo " tech-debt Generate tech debt report"
@echo ""
@echo "$(YELLOW)Development:$(NC)"
@echo " open Open project in Xcode"
@echo " update-packages Update Swift packages"
@echo " outdated Check for outdated packages"
@echo ""
@echo "$(YELLOW)CI/CD:$(NC)"
@echo " ci Run CI pipeline locally"
@echo ""