-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
503 lines (429 loc) · 17.1 KB
/
Makefile
File metadata and controls
503 lines (429 loc) · 17.1 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
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
# Airo Super App Makefile
# Cross-platform build and development automation
# Variables
FLUTTER_VERSION := 3.35.7
APP_DIR := app
ANDROID_DIR := $(APP_DIR)/android
IOS_DIR := $(APP_DIR)/ios
WEB_DIR := $(APP_DIR)/web
# Environment Variables for --dart-define
# Set these in your shell or .env file before running make commands
# Example: export GITHUB_ISSUE_TOKEN=ghp_xxxxx && make run-android
DART_DEFINE_ARGS :=
ifdef GITHUB_ISSUE_TOKEN
DART_DEFINE_ARGS += --dart-define=GITHUB_ISSUE_TOKEN=$(GITHUB_ISSUE_TOKEN)
endif
ifdef GITHUB_ISSUE_PROXY_URL
DART_DEFINE_ARGS += --dart-define=GITHUB_ISSUE_PROXY_URL=$(GITHUB_ISSUE_PROXY_URL)
endif
ifdef GITHUB_ISSUE_PROXY_API_KEY
DART_DEFINE_ARGS += --dart-define=GITHUB_ISSUE_PROXY_API_KEY=$(GITHUB_ISSUE_PROXY_API_KEY)
endif
# Colors for output
RED := \033[0;31m
GREEN := \033[0;32m
YELLOW := \033[0;33m
BLUE := \033[0;34m
NC := \033[0m # No Color
# Default target
.DEFAULT_GOAL := help
# Help target
.PHONY: help
help: ## Show this help message
@echo "$(BLUE)Airo Super App - Development Commands$(NC)"
@echo ""
@echo "$(YELLOW)Setup Commands:$(NC)"
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | grep -E '(setup|install|clean)' | awk 'BEGIN {FS = ":.*?## "}; {printf " $(GREEN)%-20s$(NC) %s\n", $$1, $$2}'
@echo ""
@echo "$(YELLOW)Development Commands:$(NC)"
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | grep -E '(run|build|test|analyze)' | awk 'BEGIN {FS = ":.*?## "}; {printf " $(GREEN)%-20s$(NC) %s\n", $$1, $$2}'
@echo ""
@echo "$(YELLOW)Platform-Specific Commands:$(NC)"
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | grep -E '(android|ios|web|chrome|pixel)' | awk 'BEGIN {FS = ":.*?## "}; {printf " $(GREEN)%-20s$(NC) %s\n", $$1, $$2}'
# Setup Commands
.PHONY: setup
setup: ## Complete first-time setup for newly cloned repo
@echo "$(BLUE)Setting up Airo Super App...$(NC)"
@$(MAKE) check-flutter
@$(MAKE) install-deps
@$(MAKE) setup-android
@$(MAKE) setup-ios
@$(MAKE) setup-web
@echo "$(GREEN)Setup complete! Run 'make run-android' or 'make run-ios' to start development.$(NC)"
.PHONY: check-flutter
check-flutter: ## Check if Flutter is installed and correct version
@echo "$(YELLOW)Checking Flutter installation...$(NC)"
@if ! command -v flutter &> /dev/null; then \
echo "$(RED)Flutter is not installed. Please install Flutter first.$(NC)"; \
echo "Visit: https://flutter.dev/docs/get-started/install"; \
exit 1; \
fi
@flutter --version
@flutter doctor
.PHONY: install-deps
install-deps: ## Install all dependencies
@echo "$(YELLOW)Installing dependencies...$(NC)"
@cd $(APP_DIR) && flutter pub get
@cd packages/airo && flutter pub get
@cd packages/airomoney && flutter pub get
.PHONY: setup-android
setup-android: ## Setup Android development environment
@echo "$(YELLOW)Setting up Android...$(NC)"
@if [ ! -d "$(ANDROID_SDK_ROOT)" ]; then \
echo "$(RED)Android SDK not found. Please install Android Studio and SDK.$(NC)"; \
else \
echo "$(GREEN)Android SDK found at $(ANDROID_SDK_ROOT)$(NC)"; \
fi
@cd $(APP_DIR) && flutter build apk --debug
.PHONY: setup-ios
setup-ios: ## Setup iOS development environment (macOS only)
@echo "$(YELLOW)Setting up iOS...$(NC)"
@if [ "$$(uname)" != "Darwin" ]; then \
echo "$(YELLOW)iOS development is only available on macOS$(NC)"; \
else \
if ! command -v xcodebuild &> /dev/null; then \
echo "$(RED)Xcode is not installed. Please install Xcode from App Store.$(NC)"; \
else \
cd $(IOS_DIR) && pod install; \
fi \
fi
.PHONY: setup-web
setup-web: ## Setup web development environment
@echo "$(YELLOW)Setting up web...$(NC)"
@cd $(APP_DIR) && flutter build web --debug
# Development Commands
.PHONY: devices
devices: ## List all available devices
@echo "$(BLUE)Available devices:$(NC)"
@cd $(APP_DIR) && flutter devices
.PHONY: run-android-auto
run-android-auto: ## Run app on any connected Android device
@echo "$(BLUE)Running on Android (auto-detect)...$(NC)"
@cd $(APP_DIR) && flutter run -d android $(DART_DEFINE_ARGS)
.PHONY: run-android
run-android: ## Run app on Android device/emulator (Pixel 9)
@echo "$(BLUE)Running on Android (Pixel 9)...$(NC)"
@cd $(APP_DIR) && flutter run --device-id "4C031VDAQ000GG" $(DART_DEFINE_ARGS)
.PHONY: run-pixel9
run-pixel9: ## Run app specifically optimized for Pixel 9
@echo "$(BLUE)Running on Pixel 9 (Android)...$(NC)"
@cd $(APP_DIR) && flutter run --device-id "4C031VDAQ000GG" --target-platform android-arm64 $(DART_DEFINE_ARGS)
.PHONY: run-ios
run-ios: ## Run app on iOS device/simulator
@echo "$(BLUE)Running on iOS...$(NC)"
@if [ "$$(uname)" != "Darwin" ]; then \
echo "$(RED)iOS development is only available on macOS$(NC)"; \
exit 1; \
fi
@cd $(APP_DIR) && flutter run -d ios $(DART_DEFINE_ARGS)
.PHONY: run-iphone13
run-iphone13: ## Run app on iPhone 13 Pro Max simulator
@echo "$(BLUE)Running on iPhone 13 Pro Max...$(NC)"
@if [ "$$(uname)" != "Darwin" ]; then \
echo "$(RED)iOS development is only available on macOS$(NC)"; \
exit 1; \
fi
@cd $(APP_DIR) && flutter run -d "iPhone 13 Pro Max" $(DART_DEFINE_ARGS)
.PHONY: run-web
run-web: ## Run app on web browser
@echo "$(BLUE)Running on web...$(NC)"
@cd $(APP_DIR) && flutter run -d web-server --web-port 8080 $(DART_DEFINE_ARGS)
.PHONY: run-chrome
run-chrome: ## Run app specifically on Chrome browser
@echo "$(BLUE)Running on Chrome...$(NC)"
@cd $(APP_DIR) && flutter run -d chrome --web-port 8080 $(DART_DEFINE_ARGS)
# Fire TV Commands
.PHONY: run-firetv
run-firetv: ## Run app on Fire TV (auto-detect TV emulator/device)
@echo "$(BLUE)Running on Fire TV...$(NC)"
@cd $(APP_DIR) && flutter run -d android $(DART_DEFINE_ARGS)
.PHONY: run-firetv-emulator
run-firetv-emulator: ## Run app on Fire TV emulator by name
@echo "$(BLUE)Running on Fire TV emulator...$(NC)"
@cd $(APP_DIR) && flutter run -d "Fire_TV_Stick_4K" $(DART_DEFINE_ARGS)
.PHONY: run-androidtv
run-androidtv: ## Run app on Android TV emulator
@echo "$(BLUE)Running on Android TV...$(NC)"
@cd $(APP_DIR) && flutter run -d "Android_TV" $(DART_DEFINE_ARGS)
# Build Commands
.PHONY: build-android
build-android: ## Build Android APK (split-per-abi for smaller APKs)
@echo "$(BLUE)Building Android APK (split-per-abi)...$(NC)"
@cd $(APP_DIR) && flutter build apk --release \
--split-per-abi \
--tree-shake-icons \
--dart-define=APP_VARIANT=full \
--dart-define=APP_PLATFORM=mobileFull
@echo "$(GREEN)✓ APKs created:$(NC)"
@ls -lh $(APP_DIR)/build/app/outputs/flutter-apk/*.apk 2>/dev/null || echo " Check $(APP_DIR)/build/app/outputs/flutter-apk/"
.PHONY: build-android-fat
build-android-fat: ## Build Android APK (fat APK with all ABIs - larger size)
@echo "$(BLUE)Building Android APK (fat)...$(NC)"
@cd $(APP_DIR) && flutter build apk --release
.PHONY: build-android-bundle
build-android-bundle: ## Build Android App Bundle for Play Store
@echo "$(BLUE)Building Android App Bundle...$(NC)"
@cd $(APP_DIR) && flutter build appbundle --release \
--tree-shake-icons \
--dart-define=APP_VARIANT=full \
--dart-define=APP_PLATFORM=mobileFull
# =============================================================================
# PLATFORM-SPECIFIC BUILDS (Phase 0.5+ Multi-Platform Strategy)
# =============================================================================
.PHONY: build-tv
build-tv: ## Build Android TV APK (IPTV only, <30MB target with lightweight deps)
ifeq ($(OS),Windows_NT)
@powershell -ExecutionPolicy Bypass -File scripts/build-tv.ps1
else
@bash scripts/build-tv.sh
endif
.PHONY: build-tv-full
build-tv-full: ## Build Android TV APK with all dependencies (for testing, ~145MB)
ifeq ($(OS),Windows_NT)
@powershell -ExecutionPolicy Bypass -File scripts/build-tv.ps1 -Full
else
@bash scripts/build-tv.sh --full
endif
.PHONY: build-streaming
build-streaming: ## Build Mobile Streaming APK with lightweight deps (Music + IPTV, <50MB target)
ifeq ($(OS),Windows_NT)
@powershell -ExecutionPolicy Bypass -File scripts/build-streaming.ps1
else
@bash scripts/build-streaming.sh
endif
.PHONY: build-streaming-full
build-streaming-full: ## Build Mobile Streaming APK with full dependencies (~100MB, for testing)
@echo "$(BLUE)Building Mobile Streaming APK (full dependencies)...$(NC)"
@cd $(APP_DIR) && flutter build apk --release \
--target=lib/main_mobile_streaming.dart \
--dart-define=APP_VARIANT=streaming \
--dart-define=APP_PLATFORM=mobileStreaming \
--split-per-abi \
--tree-shake-icons
@echo "$(GREEN)✓ Streaming APK created$(NC)"
.PHONY: build-full
build-full: ## Build Mobile Full APK (all features)
@echo "$(BLUE)Building Mobile Full APK...$(NC)"
@cd $(APP_DIR) && flutter build apk --release \
--target=lib/main.dart \
--dart-define=APP_VARIANT=full \
--dart-define=APP_PLATFORM=mobileFull \
--split-per-abi \
--tree-shake-icons
@echo "$(GREEN)✓ Full APK created$(NC)"
.PHONY: build-firetv
build-firetv: ## Build Fire TV optimized APK (arm64 only)
@echo "$(BLUE)Building Fire TV APK...$(NC)"
@cd $(APP_DIR) && flutter build apk --release \
--target=lib/main_tv.dart \
--dart-define=APP_VARIANT=tv \
--dart-define=APP_PLATFORM=androidTv \
--target-platform android-arm64 \
--tree-shake-icons
.PHONY: build-androidtv
build-androidtv: build-tv ## Alias for build-tv
.PHONY: build-ios
build-ios: ## Build iOS app
@echo "$(BLUE)Building iOS app...$(NC)"
@if [ "$$(uname)" != "Darwin" ]; then \
echo "$(RED)iOS building is only available on macOS$(NC)"; \
exit 1; \
fi
@cd $(APP_DIR) && flutter build ios --release
.PHONY: build-web
build-web: ## Build web app
@echo "$(BLUE)Building web app...$(NC)"
@cd $(APP_DIR) && flutter build web --release
.PHONY: build-all
build-all: ## Build for all platforms
@echo "$(BLUE)Building for all platforms...$(NC)"
@$(MAKE) build-android
@$(MAKE) build-web
@if [ "$$(uname)" = "Darwin" ]; then \
$(MAKE) build-ios; \
fi
# Testing Commands
.PHONY: test
test: ## Run all tests
@echo "$(BLUE)Running tests...$(NC)"
@cd $(APP_DIR) && flutter test
@cd packages/airo && flutter test
@cd packages/airomoney && flutter test
.PHONY: test-coverage
test-coverage: ## Run tests with coverage and check threshold
@echo "$(BLUE)Running tests with coverage...$(NC)"
@./scripts/check-coverage.sh 60
.PHONY: test-integration
test-integration: ## Run integration tests
@echo "$(BLUE)Running integration tests...$(NC)"
@cd $(APP_DIR) && flutter test integration_test/
# =============================================================================
# E2E TESTING - Strategy: Playwright (browser) → Patrol (device) → Deploy
# =============================================================================
.PHONY: test-e2e
test-e2e: test-browser test-device ## Run all E2E tests (browser + device)
@echo "$(GREEN)✓ All E2E tests passed! Ready for deployment.$(NC)"
.PHONY: test-browser
test-browser: ## Step 1: Run Playwright browser E2E tests
@echo "$(BLUE)Running Playwright browser tests...$(NC)"
@echo "$(YELLOW)NOTE: Flutter Web must be running on port 8080$(NC)"
@echo "$(YELLOW)Run 'make run-chrome-html' in another terminal first$(NC)"
@cd e2e && npm test
.PHONY: test-browser-headless
test-browser-headless: ## Run Playwright tests headless (CI)
@cd e2e && npm test -- --project=chromium
.PHONY: test-browser-debug
test-browser-debug: ## Run Playwright tests with debug UI
@cd e2e && npm run test:debug
.PHONY: test-browser-report
test-browser-report: ## Show Playwright test report
@cd e2e && npm run report
.PHONY: test-device
test-device: ## Step 2: Run Patrol device E2E tests
@echo "$(BLUE)Running Patrol device tests...$(NC)"
@cd $(APP_DIR) && patrol test -t integration_test/patrol_test.dart
.PHONY: test-device-android
test-device-android: ## Run Patrol tests on Android
@cd $(APP_DIR) && patrol test -t integration_test/patrol_test.dart --target android
.PHONY: test-device-ios
test-device-ios: ## Run Patrol tests on iOS
@cd $(APP_DIR) && patrol test -t integration_test/patrol_test.dart --target ios
.PHONY: run-chrome-html
run-chrome-html: ## Run Flutter Web with HTML renderer for E2E testing
@echo "$(BLUE)Running Flutter Web with HTML renderer on port 8080...$(NC)"
@cd $(APP_DIR) && flutter run -d chrome --web-renderer=html --web-port=8080 $(DART_DEFINE_ARGS)
.PHONY: setup-e2e
setup-e2e: ## Setup E2E test dependencies
@echo "$(BLUE)Setting up E2E test dependencies...$(NC)"
@cd e2e && npm install && npx playwright install
@cd $(APP_DIR) && flutter pub add patrol --dev || true
@echo "$(GREEN)✓ E2E setup complete$(NC)"
.PHONY: analyze
analyze: ## Analyze code for issues
@echo "$(BLUE)Analyzing code...$(NC)"
@cd $(APP_DIR) && flutter analyze
@cd packages/airo && flutter analyze
@cd packages/airomoney && flutter analyze
.PHONY: format
format: ## Format code
@echo "$(BLUE)Formatting code...$(NC)"
@cd $(APP_DIR) && dart format .
@cd packages/airo && dart format .
@cd packages/airomoney && dart format .
# Maintenance Commands
.PHONY: clean
clean: ## Clean build artifacts
@echo "$(BLUE)Cleaning build artifacts...$(NC)"
@cd $(APP_DIR) && flutter clean
@cd packages/airo && flutter clean
@cd packages/airomoney && flutter clean
.PHONY: upgrade
upgrade: ## Upgrade Flutter and dependencies
@echo "$(BLUE)Upgrading Flutter and dependencies...$(NC)"
@flutter upgrade
@cd $(APP_DIR) && flutter pub upgrade
@cd packages/airo && flutter pub upgrade
@cd packages/airomoney && flutter pub upgrade
.PHONY: doctor
doctor: ## Run Flutter doctor
@flutter doctor -v
# Device Management
.PHONY: emulators
emulators: ## List available emulators
@flutter emulators
# Quick Development Shortcuts
.PHONY: dev-android
dev-android: install-deps run-android ## Quick start for Android development
.PHONY: dev-ios
dev-ios: install-deps run-ios ## Quick start for iOS development
.PHONY: dev-web
dev-web: install-deps run-web ## Quick start for web development
# Platform-specific optimizations
.PHONY: optimize-android
optimize-android: ## Optimize for Android (including Pixel 9)
@echo "$(BLUE)Optimizing for Android...$(NC)"
@cd $(APP_DIR) && flutter build apk --release --target-platform android-arm64 --split-per-abi
.PHONY: optimize-ios
optimize-ios: ## Optimize for iOS (including iPhone 13 Pro Max)
@echo "$(BLUE)Optimizing for iOS...$(NC)"
@if [ "$$(uname)" != "Darwin" ]; then \
echo "$(RED)iOS optimization is only available on macOS$(NC)"; \
exit 1; \
fi
@cd $(APP_DIR) && flutter build ios --release --no-codesign
.PHONY: optimize-web
optimize-web: ## Optimize for web (including Chrome)
@echo "$(BLUE)Optimizing for web...$(NC)"
@cd $(APP_DIR) && flutter build web --release --web-renderer canvaskit
# Release Commands
.PHONY: build-release-all
build-release-all: ## Build all platforms for release
@echo "$(BLUE)Building all platforms for release...$(NC)"
@$(MAKE) build-android
@$(MAKE) build-android-bundle
@$(MAKE) build-web
@if [ "$$(uname)" = "Darwin" ]; then \
$(MAKE) build-ios; \
fi
@echo "$(GREEN)✓ All release builds complete$(NC)"
.PHONY: release-patch
release-patch: ## Create a patch release (v1.0.1)
@echo "$(BLUE)Creating patch release...$(NC)"
@echo "$(YELLOW)Run: git tag -a v1.0.1 -m 'Release v1.0.1' && git push origin v1.0.1$(NC)"
.PHONY: release-minor
release-minor: ## Create a minor release (v1.1.0)
@echo "$(BLUE)Creating minor release...$(NC)"
@echo "$(YELLOW)Run: git tag -a v1.1.0 -m 'Release v1.1.0' && git push origin v1.1.0$(NC)"
.PHONY: release-major
release-major: ## Create a major release (v2.0.0)
@echo "$(BLUE)Creating major release...$(NC)"
@echo "$(YELLOW)Run: git tag -a v2.0.0 -m 'Release v2.0.0' && git push origin v2.0.0$(NC)"
.PHONY: build-windows
build-windows: ## Build Windows app
@echo "$(BLUE)Building Windows app...$(NC)"
@cd $(APP_DIR) && flutter build windows --release
.PHONY: build-linux
build-linux: ## Build Linux app
@echo "$(BLUE)Building Linux app...$(NC)"
@cd $(APP_DIR) && flutter build linux --release
# Code Quality & Security Commands
.PHONY: sonar-scan
sonar-scan: ## Run SonarQube analysis locally
@echo "$(BLUE)Running SonarQube analysis...$(NC)"
@echo "$(YELLOW)Note: Requires SONAR_TOKEN environment variable$(NC)"
@echo "$(YELLOW)Set: export SONAR_TOKEN=your_token$(NC)"
@if [ -z "$$SONAR_TOKEN" ]; then \
echo "$(RED)Error: SONAR_TOKEN not set$(NC)"; \
exit 1; \
fi
@cd $(APP_DIR) && flutter test --coverage
@echo "$(GREEN)✓ SonarQube analysis complete$(NC)"
.PHONY: snyk-scan
snyk-scan: ## Run Snyk security scan locally
@echo "$(BLUE)Running Snyk security scan...$(NC)"
@echo "$(YELLOW)Note: Requires SNYK_TOKEN environment variable$(NC)"
@echo "$(YELLOW)Set: export SNYK_TOKEN=your_token$(NC)"
@if [ -z "$$SNYK_TOKEN" ]; then \
echo "$(RED)Error: SNYK_TOKEN not set$(NC)"; \
exit 1; \
fi
@cd $(APP_DIR) && flutter pub get
@echo "$(GREEN)✓ Snyk scan complete$(NC)"
.PHONY: quality-check
quality-check: ## Run all quality checks (analyze, test, lint)
@echo "$(BLUE)Running quality checks...$(NC)"
@$(MAKE) analyze
@$(MAKE) test
@$(MAKE) lint
@echo "$(GREEN)✓ All quality checks complete$(NC)"
.PHONY: security-check
security-check: ## Run security checks (Snyk)
@echo "$(BLUE)Running security checks...$(NC)"
@$(MAKE) snyk-scan
@echo "$(GREEN)✓ Security checks complete$(NC)"
.PHONY: full-check
full-check: ## Run all checks (quality + security)
@echo "$(BLUE)Running full checks...$(NC)"
@$(MAKE) quality-check
@$(MAKE) security-check
@echo "$(GREEN)✓ All checks complete$(NC)"