Bug 745738 - Handle multiple devices on android install target. r=mfinkle
authorChris Lord <chrislord.net@gmail.com>
Mon, 16 Apr 2012 16:10:58 +0100
changeset 91765 9b1a1266c8fd93cc0993e147c0bea91cf07c031e
parent 91764 f7668b976d64c473e566d110d5bf2e820ef66382
child 91766 ef563bc49ec26fb2be3632b760b8d89793a17c9a
push id8376
push userchrislord.net@gmail.com
push dateMon, 16 Apr 2012 15:11:20 +0000
treeherdermozilla-inbound@9b1a1266c8fd [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmfinkle
bugs745738
milestone14.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 745738 - Handle multiple devices on android install target. r=mfinkle Allow specifying the install target via an environment variable. If there are multiple devices connected and the target isn't set, bail out with a helpful error message and list the devices.
mobile/android/build.mk
--- a/mobile/android/build.mk
+++ b/mobile/android/build.mk
@@ -67,19 +67,33 @@ tier_app_dirs += \
 
 
 installer: 
 	@$(MAKE) -C mobile/android/installer installer
 
 package:
 	@$(MAKE) -C mobile/android/installer
 
+ifeq ($(OS_TARGET),Android)
+ifeq ($(MOZ_ANDROID_INSTALL_TARGET),)
+# Determine if there's more than one device connected
+android_devices=$(filter device,$(shell $(ANDROID_PLATFORM_TOOLS)/adb devices))
+ifneq ($(android_devices),device)
 install::
-ifeq ($(OS_TARGET),Android)
+	@echo "Multiple devices are connected. Define MOZ_ANDROID_INSTALL_TARGET to specify the install target."
+	$(ANDROID_PLATFORM_TOOLS)/adb devices
+	@exit 1
+else
+install::
 	$(ANDROID_PLATFORM_TOOLS)/adb install -r $(DIST)/$(PKG_PATH)$(PKG_BASENAME).apk
+endif
+else
+install::
+	$(ANDROID_PLATFORM_TOOLS)/adb -s $(MOZ_ANDROID_INSTALL_TARGET) install -r $(DIST)/$(PKG_PATH)$(PKG_BASENAME).apk
+endif
 else
 	@echo "Mobile can't be installed directly."
 	@exit 1
 endif
 
 deb: package
 	@$(MAKE) -C mobile/android/installer deb