Bug 854611 - Notification Center notification when a long build completes; r=ted

DONTBUILD (NPOTB)
This commit is contained in:
Gregory Szorc 2013-08-22 12:48:18 -07:00
parent bea62d67bd
commit 0b5f94b524
2 changed files with 20 additions and 1 deletions

View File

@ -201,6 +201,7 @@ class OSXBootstrapper(BaseBootstrapper):
('git', 'git'),
('yasm', 'yasm'),
('autoconf213', HOMEBREW_AUTOCONF213),
('terminal-notifier', 'terminal-notifier'),
]
printed = False

View File

@ -289,6 +289,7 @@ class Build(MachCommandBase):
@CommandArgument('-v', '--verbose', action='store_true',
help='Verbose output for what commands the build is running.')
def build(self, what=None, disable_extra_make_dependencies=None, jobs=0, verbose=False):
import which
from mozbuild.controller.building import BuildMonitor
from mozbuild.util import resolve_target_to_make
@ -373,11 +374,28 @@ class Build(MachCommandBase):
if high_finder:
print(FINDER_SLOW_MESSAGE % finder_percent)
long_build = monitor.elapsed > 600
if monitor.elasped > 300:
# Display a notification when the build completes.
# This could probably be uplifted into the mach core or at least
# into a helper API. It is here as an experimentation to see how it
# is received.
try:
if sys.platform.startswith('darwin'):
notifier = which.which('terminal-notifier')
self.run_process([notifier, '-title',
'Mozilla Build System', '-group', 'mozbuild',
'-message', 'Build complete'], ensure_exit_code=False)
except which.WhichError:
pass
except Exception as e:
self.log(logging.WARNING, 'notifier-failed', {'error':
e.message}, 'Notification center failed: {error}')
if status:
return status
long_build = monitor.elapsed > 600
if long_build:
print('We know it took a while, but your build finally finished successfully!')
else: