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
--- 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')