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
This commit is contained in:
Nick Alexander 2016-02-17 19:58:35 -08:00
parent f05a9d7aa5
commit 661bd6e008
2 changed files with 24 additions and 0 deletions

View File

@ -5,4 +5,8 @@ config = {
'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'],
],
}

View File

@ -1881,6 +1881,26 @@ or run without that action (ie: --no-{action})"
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()