chore: better Makefile
This commit is contained in:
@@ -1,6 +1,8 @@
|
|||||||
.PHONY: android desktop android-usb android-emulator
|
.PHONY: android desktop android-usb android-emulator
|
||||||
|
|
||||||
ADB := $(shell command -v adb 2>/dev/null || echo "$(HOME)/Library/Android/sdk/platform-tools/adb")
|
ADB := $(shell command -v adb 2>/dev/null || echo "$(HOME)/Library/Android/sdk/platform-tools/adb")
|
||||||
|
EMULATOR := $(shell command -v emulator 2>/dev/null || echo "$(HOME)/Library/Android/sdk/emulator/emulator")
|
||||||
|
AVD := $(firstword $(shell $(EMULATOR) -list-avds 2>/dev/null))
|
||||||
APK := composeApp/build/outputs/apk/debug/composeApp-debug.apk
|
APK := composeApp/build/outputs/apk/debug/composeApp-debug.apk
|
||||||
|
|
||||||
android:
|
android:
|
||||||
@@ -13,4 +15,15 @@ android-usb: android
|
|||||||
$(ADB) -d install -r $(APK)
|
$(ADB) -d install -r $(APK)
|
||||||
|
|
||||||
android-emulator: android
|
android-emulator: android
|
||||||
|
@if ! $(ADB) devices | grep -q '^emulator'; then \
|
||||||
|
echo "Aucun émulateur en cours — lancement de $(AVD)…"; \
|
||||||
|
$(EMULATOR) -avd $(AVD) -no-snapshot-load >/dev/null 2>&1 & \
|
||||||
|
echo "En attente du démarrage…"; \
|
||||||
|
$(ADB) -e wait-for-device; \
|
||||||
|
while [ "$$($(ADB) -e shell getprop sys.boot_completed 2>/dev/null | tr -d '\r')" != "1" ]; do \
|
||||||
|
sleep 2; \
|
||||||
|
done; \
|
||||||
|
echo "Émulateur prêt."; \
|
||||||
|
fi
|
||||||
$(ADB) -e install -r $(APK)
|
$(ADB) -e install -r $(APK)
|
||||||
|
$(ADB) -e shell am start -n ch.parano.myicek/.MainActivity
|
||||||
|
|||||||
Reference in New Issue
Block a user