forked from DefiFundr-Labs/defifundr_mobile
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmakefile
More file actions
272 lines (219 loc) · 9.47 KB
/
makefile
File metadata and controls
272 lines (219 loc) · 9.47 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
# Flutter Project Makefile
# ===========================================
# A comprehensive set of commands for Flutter development workflow
.PHONY: all run_dev_web run_dev_mobile run_stg_mobile run_prd_mobile \
run_unit test test_coverage clean upgrade lint format format_check \
build_dev_mobile build_stg_mobile build_prd_mobile help watch gen \
get commit build_apk_dev build_apk_stg build_apk_prd build_ios_dev \
build_ios_stg build_ios_prd build purge build_runner ios \
deploy-android deploy-ios deploy fix localization doctor outdated \
update_pods firebase_setup install_all update_all setup default_notification \
bootstrap check_quality
# Define terminal colors
BLUE=\033[0;34m
GREEN=\033[0;32m
YELLOW=\033[0;33m
RED=\033[0;31m
NC=\033[0m # No Color
# Default target when just running 'make'
all: lint format run_dev_mobile
# ===========================================
# Development Workflow
# ===========================================
help: ## Show this help
@echo "${BLUE}Flutter Project Makefile${NC}"
@echo "${YELLOW}Available commands:${NC}"
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "${GREEN}make %-20s${NC} %s\n", $$1, $$2}'
bootstrap: ## Set up the project from scratch (first-time setup)
@echo "${BLUE}╔════════════════════════════════════════════╗${NC}"
@echo "${BLUE}║ Setting up project... ║${NC}"
@echo "${BLUE}╚════════════════════════════════════════════╝${NC}"
@flutter pub get
@flutter pub run flutter_native_splash:create
@flutter pub run build_runner build --delete-conflicting-outputs
@make ios
@echo "${GREEN}Project setup complete!${NC}"
run_dev_web: ## Run the web application in development mode
@echo "${BLUE}╠ Running web app (development)${NC}"
@flutter run -d chrome --dart-define=ENVIRONMENT=dev
run_dev_mobile: ## Run the mobile application in development mode
@echo "${BLUE}╠ Running mobile app (development)${NC}"
@flutter run --flavor development -t lib/main_development.dart
run_stg_mobile: ## Run the mobile application in staging mode
@echo "${BLUE}╠ Running mobile app (staging)${NC}"
@flutter run --flavor staging -t lib/main_staging.dart
run_prd_mobile: ## Run the mobile application in production mode
@echo "${BLUE}╠ Running mobile app (production)${NC}"
@flutter run --flavor production -t lib/main_production.dart
# ===========================================
# Testing Commands
# ===========================================
run_unit: ## Run unit tests
@echo "${BLUE}╠ Running unit tests${NC}"
@flutter test || (echo "${RED}Error while running tests${NC}"; exit 1)
test: ## Run all tests
@echo "${BLUE}╠ Running all tests${NC}"
@flutter test
test_coverage: ## Run tests with coverage
@echo "${BLUE}╠ Running tests with coverage${NC}"
@flutter test --coverage
@genhtml coverage/lcov.info -o coverage/html
@echo "${GREEN}Coverage report generated at coverage/html/index.html${NC}"
# ===========================================
# Code Quality Commands
# ===========================================
lint: ## Lint the code
@echo "${BLUE}╠ Linting code...${NC}"
@dart analyze . || (echo "${RED}Linting errors found${NC}"; exit 1)
format: ## Format the code
@echo "${BLUE}╠ Formatting code...${NC}"
@dart fix --apply
@flutter format lib .
@flutter pub run import_sorter:main
@flutter format lib
@echo "${GREEN}Code formatting complete${NC}"
format_check: ## Check if code is formatted correctly
@echo "${BLUE}╠ Checking code format...${NC}"
@flutter format --set-exit-if-changed lib
fix: ## Apply dart fixes
@echo "${BLUE}╠ Applying dart fixes...${NC}"
@dart fix --apply
check_quality: lint format_check ## Check code quality (lint + format check)
@echo "${GREEN}Code quality check passed${NC}"
# ===========================================
# Build Commands
# ===========================================
build_apk_dev: ## Build APK in development mode
@echo "${BLUE}╠ Building APK (development)${NC}"
@flutter clean
@flutter pub get
@flutter build apk --flavor development -t lib/main_development.dart
@echo "${GREEN}Development APK build complete${NC}"
build_apk_stg: ## Build APK in staging mode
@echo "${BLUE}╠ Building APK (staging)${NC}"
@flutter clean
@flutter pub get
@flutter build apk --flavor staging -t lib/main_staging.dart
@echo "${GREEN}Staging APK build complete${NC}"
build_apk_prd: ## Build APK in production mode
@echo "${BLUE}╠ Building APK (production)${NC}"
@flutter clean
@flutter pub get
@flutter build apk --release --flavor production -t lib/main_production.dart
@echo "${GREEN}Production APK build complete${NC}"
build_ios_dev: ## Build iOS in development mode
@echo "${BLUE}╠ Building iOS (development)${NC}"
@flutter clean
@flutter pub get
@flutter build ios --flavor development -t lib/main_development.dart --no-codesign
@echo "${GREEN}Development iOS build complete${NC}"
build_ios_stg: ## Build iOS in staging mode
@echo "${BLUE}╠ Building iOS (staging)${NC}"
@flutter clean
@flutter pub get
@flutter build ios --flavor staging -t lib/main_staging.dart --no-codesign
@echo "${GREEN}Staging iOS build complete${NC}"
build_ios_prd: ## Build iOS in production mode
@echo "${BLUE}╠ Building iOS (production)${NC}"
@flutter clean
@flutter pub get
@flutter build ios --flavor production -t lib/main_production.dart --no-codesign
@echo "${GREEN}Production iOS build complete${NC}"
# ===========================================
# Code Generation Commands
# ===========================================
watch: ## Watch files and run build_runner when changes detected
@echo "${BLUE}╠ Watching for changes...${NC}"
@flutter pub run build_runner watch --delete-conflicting-outputs
gen: ## Generate code once with build_runner
@echo "${BLUE}╠ Generating code...${NC}"
@flutter pub run build_runner build --delete-conflicting-outputs
@echo "${GREEN}Code generation complete${NC}"
build_runner: gen ## Alias for gen
localization: ## Generate localization files
@echo "${BLUE}╠ Generating localization files...${NC}"
@flutter gen-l10n
@echo "${GREEN}Localization files generated${NC}"
# ===========================================
# Dependency Management
# ===========================================
get: ## Get dependencies
@echo "${BLUE}╠ Getting dependencies...${NC}"
@flutter pub get
@echo "${GREEN}Dependencies fetched${NC}"
upgrade: clean ## Upgrade dependencies
@echo "${BLUE}╠ Upgrading dependencies...${NC}"
@flutter pub upgrade
@echo "${GREEN}Dependencies upgraded${NC}"
outdated: ## Check for outdated packages
@echo "${BLUE}╠ Checking for outdated packages...${NC}"
@flutter pub outdated
update_pods: ## Update iOS pods
@echo "${BLUE}╠ Updating iOS pods...${NC}"
@cd ios && arch -x86_64 pod update
@echo "${GREEN}iOS pods updated${NC}"
# ===========================================
# Project Maintenance
# ===========================================
clean: ## Clean the project
@echo "${BLUE}╠ Cleaning project...${NC}"
@rm -rf pubspec.lock
@flutter clean
@flutter pub get
@echo "${GREEN}Project cleaned${NC}"
purge: ## Deep clean the project, including pods
@echo "${BLUE}╠ Purging project...${NC}"
@pod deintegrate || true
@flutter clean
@flutter pub get
@echo "${GREEN}Project purged${NC}"
ios: ## Set up iOS project
@echo "${BLUE}╠ Setting up iOS project...${NC}"
@cd ios && arch -x86_64 pod install --repo-update
@cd ..
@rm -rf pubspec.lock
@flutter clean
@flutter pub get
@echo "${GREEN}iOS setup complete${NC}"
doctor: ## Run Flutter doctor
@echo "${BLUE}╠ Running Flutter doctor...${NC}"
@flutter doctor -v
# ===========================================
# Deployment Commands
# ===========================================
deploy-android: ## Deploy Android app to Google Play
@echo "${BLUE}╠ Deploying Android app...${NC}"
@cd android/fastlane && bundle install --path vendor/bundle && bundle exec fastlane deploy
@echo "${GREEN}Android deployment complete${NC}"
deploy-ios: ## Deploy iOS app to TestFlight
@echo "${BLUE}╠ Deploying iOS app...${NC}"
@cd ios/fastlane && bundle install --path vendor/bundle && bundle exec fastlane deploy
@echo "${GREEN}iOS deployment complete${NC}"
deploy: deploy-android deploy-ios ## Deploy to both platforms
# ===========================================
# Utility Commands
# ===========================================
commit: format lint run_unit ## Format, lint, test, then commit changes
@echo "${BLUE}╠ Committing changes...${NC}"
@git add .
@git commit
default_notification: ## Test notifications on iOS simulator
@echo "${BLUE}╠ Sending test notification...${NC}"
@xcrun simctl push booted com.synergyng.synergy pushes/push1.json
@echo "${GREEN}Test notification sent${NC}"
firebase_setup: ## Set up Firebase
@echo "${BLUE}╠ Setting up Firebase...${NC}"
@flutterfire configure
@echo "${GREEN}Firebase setup complete${NC}"
install_all: ## Install all project dependencies and tools
@echo "${BLUE}╠ Installing all dependencies and tools...${NC}"
@flutter pub get
@cd ios && arch -x86_64 pod install --repo-update
@cd ..
@gem install bundler
@cd android/fastlane && bundle install --path vendor/bundle
@cd ios/fastlane && bundle install --path vendor/bundle
@echo "${GREEN}All dependencies and tools installed${NC}"
update_all: upgrade update_pods ## Update all dependencies
@echo "${GREEN}All dependencies updated${NC}"
setup: bootstrap ## Alias for bootstrap