Bug 1274497 - Avoid running adb every time we run make on Android builds. r=gps

As seen in bug 1274273, the build system is running adb uselessly.
Moreover, on automation, adb doesn't even run, because it requires a
more recent glibc than available, adding confusing error messages to the
logs.
This commit is contained in:
Mike Hommey 2016-05-20 15:44:06 +09:00
Родитель 2d6fb1ed77
Коммит b47ba46ecf
1 изменённых файлов: 11 добавлений и 8 удалений

Просмотреть файл

@ -18,19 +18,22 @@ ifneq ($(ANDROID_SERIAL),)
export ANDROID_SERIAL
else
# Determine if there's more than one device connected
android_devices=$(filter device,$(shell $(ADB) devices))
ifeq ($(android_devices),)
install::
android_devices=$(words $(filter device,$(shell $(ADB) devices)))
define no_device
@echo 'No devices are connected. Connect a device or start an emulator.'
@exit 1
else
ifneq ($(android_devices),device)
install::
endef
define multiple_devices
@echo 'Multiple devices are connected. Define ANDROID_SERIAL to specify the install target.'
$(ADB) devices
@exit 1
endif
endif
endef
install::
@# Use foreach to avoid running adb multiple times here
$(foreach val,$(android_devices),\
$(if $(filter 0,$(val)),$(no_device),\
$(if $(filter-out 1,$(val)),$(multiple_devices))))
endif
install::