Bug 1565634 - mach install should install GVE as default. r?nalexander draft
authorMakoto Kato <m_kato@ga2.so-net.ne.jp>
Fri, 11 Oct 2019 08:13:40 +0000
changeset 2376608 1b019b114668bc1f97cd6564204668e244c52024
parent 2374482 cad27f93a9869351457fc5d5290777420068e173
child 2376609 31b05909f8573c21063ecee35363a95c30a247ee
push id434092
push userreviewbot
push dateFri, 11 Oct 2019 08:13:57 +0000
treeherdertry@31b05909f857 [default view] [failures only]
reviewersnalexander
bugs1565634
milestone71.0a1
Bug 1565634 - mach install should install GVE as default. r?nalexander Fennec is removed, but mach install still tries to install Fennec. It should install GVE instead. Differential Revision: https://phabricator.services.mozilla.com/D48811 Differential Diff: PHID-DIFF-kyqkoahgkjsteqcs73uy
mobile/android/build.mk
python/mozbuild/mozbuild/mach_commands.py
--- a/mobile/android/build.mk
+++ b/mobile/android/build.mk
@@ -9,49 +9,16 @@ installer:
 
 package:
 	# Setting MOZ_GECKOVIEW_JAR makes the installer generate a separate GeckoView JAR
 	@$(MAKE) MOZ_GECKOVIEW_JAR=1 -C mobile/android/installer
 
 stage-package:
 	$(MAKE) MOZ_GECKOVIEW_JAR=1 -C mobile/android/installer stage-package
 
-ifeq ($(OS_TARGET),Android)
-ifneq ($(MOZ_ANDROID_INSTALL_TARGET),)
-ANDROID_SERIAL = $(MOZ_ANDROID_INSTALL_TARGET)
-endif
-ifneq ($(ANDROID_SERIAL),)
-export ANDROID_SERIAL
-else
-# Determine if there's more than one device connected
-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
-endef
-define multiple_devices
-	@echo 'Multiple devices are connected. Define ANDROID_SERIAL to specify the install target.'
-	$(ADB) devices
-	@exit 1
-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::
-	$(ADB) install -r $(DIST)/$(PKG_PATH)$(PKG_BASENAME).apk
-else
-	@echo 'Mobile can't be installed directly.'
-	@exit 1
-endif
-
 deb: package
 	@$(MAKE) -C mobile/android/installer deb
 
 upload::
 	@$(MAKE) -C mobile/android/installer upload
 
 wget-en-US:
 	@$(MAKE) -C mobile/android/locales $@
--- a/python/mozbuild/mozbuild/mach_commands.py
+++ b/python/mozbuild/mozbuild/mach_commands.py
@@ -667,31 +667,48 @@ class Package(MachCommandBase):
     def package(self, verbose=False):
         ret = self._run_make(directory=".", target='package',
                              silent=not verbose, ensure_exit_code=False)
         if ret == 0:
             self.notify('Packaging complete')
         return ret
 
 
+def _get_android_install_parser():
+    parser = argparse.ArgumentParser()
+    parser.add_argument('--app', default='org.mozilla.geckoview_example',
+                        help='Android package to run '
+                             '(default: org.mozilla.geckoview_example)')
+    parser.add_argument('--verbose', '-v', action='store_true',
+                        help='Print verbose output when installing.')
+    return parser
+
+
+def setup_install_parser():
+    build = MozbuildObject.from_environment(cwd=here)
+    if conditions.is_android(build):
+        return _get_android_install_parser()
+    return argparse.ArgumentParser()
+
+
 @CommandProvider
 class Install(MachCommandBase):
     """Install a package."""
 
     @Command('install', category='post-build',
              conditions=[conditions.has_build],
+             parser=setup_install_parser,
              description='Install the package on the machine (or device in the case of Android).')
-    @CommandArgument('--verbose', '-v', action='store_true',
-                     help='Print verbose output when installing.')
-    def install(self, verbose=False):
+    def install(self, **kwargs):
         if conditions.is_android(self):
             from mozrunner.devices.android_device import verify_android_device
-            verify_android_device(self, verbose=verbose)
+            ret = not verify_android_device(self, install=True, **kwargs)
+        else:
+            ret = self._run_make(directory=".", target='install', ensure_exit_code=False)
 
-        ret = self._run_make(directory=".", target='install', ensure_exit_code=False)
         if ret == 0:
             self.notify('Install complete')
         return ret
 
 
 @SettingsProvider
 class RunSettings():
     config_settings = [