Bug 1249166 - Part 1: Add post-build mach commands to mozharness. r?jlund draft
authorNick Alexander <nalexander@mozilla.com>
Wed, 17 Feb 2016 19:58:35 -0800
changeset 334030 1c5629be18b888d0b565578cb4fde70354be15e1
parent 334029 6d468959d97a8e8aa4cd2d0f0dcb14decb41a2cd
child 334031 6087386a01ee3eb8a7a0644c5e7f86be14cfd264
child 334207 5ac84aa4f98a15bb2178c9a91370aac0efb922ec
push id11431
push usernalexander@mozilla.com
push dateWed, 24 Feb 2016 07:57:54 +0000
reviewersjlund
bugs1249166
milestone47.0a1
Bug 1249166 - Part 1: Add post-build mach commands to mozharness. r?jlund This allows to run |mach gradle COMMAND| after the initial |mach build|. MozReview-Commit-ID: 8XrTopFvLl0
testing/mozharness/configs/builds/releng_sub_android_configs/64_api_15_frontend.py
testing/mozharness/mozharness/mozilla/building/buildbase.py
--- a/testing/mozharness/configs/builds/releng_sub_android_configs/64_api_15_frontend.py
+++ b/testing/mozharness/configs/builds/releng_sub_android_configs/64_api_15_frontend.py
@@ -1,8 +1,12 @@
 config = {
     'base_name': 'Android armv7 API 15+ frontend %(branch)s',
     'stage_platform': 'android-api-15-frontend',
     'build_type': 'api-15-opt',
     'src_mozconfig': 'mobile/android/config/mozconfigs/android-api-15-frontend/nightly',
     'tooltool_manifest_src': 'mobile/android/config/tooltool-manifests/android-frontend/releng.manifest',
     'multi_locale_config_platform': 'android',
+    'postflight_build_mach_commands': [
+        ['gradle', 'app:lintAutomationDebug'],
+        ['gradle', 'app:testAutomationDebugUnitTest'],
+    ],
 }
--- a/testing/mozharness/mozharness/mozilla/building/buildbase.py
+++ b/testing/mozharness/mozharness/mozilla/building/buildbase.py
@@ -1876,16 +1876,36 @@ or run without that action (ie: --no-{ac
 
     def postflight_build(self, console_output=True):
         """grabs properties from post build and calls ccache -s"""
         self.generate_build_props(console_output=console_output,
                                   halt_on_failure=True)
         if self.config.get('enable_ccache'):
             self._ccache_s()
 
+        # A list of argument lists.  Better names gratefully accepted!
+        mach_commands = self.config.get('postflight_build_mach_commands', [])
+        for mach_command in mach_commands:
+            self._execute_postflight_build_mach_command(mach_command)
+
+    def _execute_postflight_build_mach_command(self, mach_command_args):
+        env = self.query_build_env()
+        env.update(self.query_mach_build_env())
+        python = self.query_exe('python2.7')
+
+        command = [python, 'mach', '--log-no-times']
+        command.extend(mach_command_args)
+
+        self.run_command_m(
+            command=command,
+            cwd=self.query_abs_dirs()['abs_src_dir'],
+            env=env, output_timeout=self.config.get('max_build_output_timeout', 60 * 20),
+            halt_on_failure=True,
+        )
+
     def preflight_package_source(self):
         self._get_mozconfig()
 
     def package_source(self):
         """generates source archives and uploads them"""
         env = self.query_build_env()
         env.update(self.query_mach_build_env())
         python = self.query_exe('python2.7')