79 lines
3.7 KiB
Makefile
79 lines
3.7 KiB
Makefile
# --- Mobile App Development ---
|
|
|
|
.PHONY: mobile-install mobile-install-ci mobile-info mobile-analyze mobile-client-dev-android mobile-staff-dev-android mobile-client-build mobile-staff-build mobile-hot-reload mobile-hot-restart
|
|
|
|
MOBILE_DIR := apps/mobile
|
|
|
|
# Device ID for running mobile apps (override with DEVICE=<id>)
|
|
# Find your device ID with: flutter devices
|
|
DEVICE ?= android
|
|
|
|
# --- General ---
|
|
mobile-install: install-melos dataconnect-generate-sdk
|
|
@echo "--> Bootstrapping mobile workspace (Melos)..."
|
|
@cd $(MOBILE_DIR) && melos bootstrap
|
|
@echo "--> Generating localization files..."
|
|
@cd $(MOBILE_DIR) && melos run gen:l10n
|
|
|
|
mobile-install-ci: install-melos dataconnect-generate-sdk-ci
|
|
@echo "--> Bootstrapping mobile workspace for CI (Melos)..."
|
|
@cd $(MOBILE_DIR) && melos bootstrap
|
|
@echo "--> Generating localization files..."
|
|
@cd $(MOBILE_DIR) && melos run gen:l10n
|
|
@echo "✅ CI mobile setup complete"
|
|
|
|
mobile-info:
|
|
@echo "--> Fetching mobile command info..."
|
|
@cd $(MOBILE_DIR) && melos run info
|
|
|
|
mobile-analyze:
|
|
@echo "--> Analyzing mobile workspace for compile-time errors..."
|
|
@cd $(MOBILE_DIR) && flutter analyze
|
|
|
|
# --- Hot Reload & Restart ---
|
|
mobile-hot-reload:
|
|
@echo "--> Triggering hot reload for running Flutter app..."
|
|
@cd $(MOBILE_DIR) && echo "r" | nc localhost 54321 2>/dev/null || \
|
|
(cd apps/client && flutter attach --pid-file /tmp/flutter_client.pid && echo "r") || \
|
|
(cd apps/staff && flutter attach --pid-file /tmp/flutter_staff.pid && echo "r") || \
|
|
echo "❌ No running Flutter app found. Start an app first with mobile-client-dev-android or mobile-staff-dev-android"
|
|
|
|
mobile-hot-restart:
|
|
@echo "--> Triggering hot restart for running Flutter app..."
|
|
@cd $(MOBILE_DIR) && echo "R" | nc localhost 54321 2>/dev/null || \
|
|
(cd apps/client && flutter attach --pid-file /tmp/flutter_client.pid && echo "R") || \
|
|
(cd apps/staff && flutter attach --pid-file /tmp/flutter_staff.pid && echo "R") || \
|
|
echo "❌ No running Flutter app found. Start an app first with mobile-client-dev-android or mobile-staff-dev-android"
|
|
|
|
# --- Client App ---
|
|
mobile-client-dev-android: dataconnect-generate-sdk
|
|
@echo "--> Running client app on Android (device: $(DEVICE))..."
|
|
@cd $(MOBILE_DIR) && melos run start:client -- -d $(DEVICE) --dart-define-from-file=../../config.dev.json
|
|
|
|
mobile-client-build: dataconnect-generate-sdk
|
|
@if [ -z "$(PLATFORM)" ]; then \
|
|
echo "ERROR: PLATFORM is required (e.g. make mobile-client-build PLATFORM=apk)"; exit 1; \
|
|
fi
|
|
$(eval MODE ?= release)
|
|
@echo "--> Building client app for $(PLATFORM) in $(MODE) mode..."
|
|
@cd $(MOBILE_DIR) && \
|
|
melos exec --scope="core_localization" -- "dart run slang" && \
|
|
melos exec --scope="core_localization" -- "dart run build_runner build --delete-conflicting-outputs" && \
|
|
melos exec --scope="krowwithus_client" -- "flutter build $(PLATFORM) --$(MODE) --dart-define-from-file=../../config.dev.json"
|
|
|
|
# --- Staff App ---
|
|
mobile-staff-dev-android: dataconnect-generate-sdk
|
|
@echo "--> Running staff app on Android (device: $(DEVICE))..."
|
|
@cd $(MOBILE_DIR) && melos run start:staff -- -d $(DEVICE) --dart-define-from-file=../../config.dev.json
|
|
|
|
mobile-staff-build: dataconnect-generate-sdk
|
|
@if [ -z "$(PLATFORM)" ]; then \
|
|
echo "ERROR: PLATFORM is required (e.g. make mobile-staff-build PLATFORM=apk)"; exit 1; \
|
|
fi
|
|
$(eval MODE ?= release)
|
|
@echo "--> Building staff app for $(PLATFORM) in $(MODE) mode..."
|
|
@cd $(MOBILE_DIR) && \
|
|
melos exec --scope="core_localization" -- "dart run slang" && \
|
|
melos exec --scope="core_localization" -- "dart run build_runner build --delete-conflicting-outputs" && \
|
|
melos exec --scope="krowwithus_staff" -- "flutter build $(PLATFORM) --$(MODE) --dart-define-from-file=../../config.dev.json"
|