Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(532)

Side by Side Diff: dart/tools/build.py

Issue 219513003: Display notification when build is done. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Add flush. Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # 2 #
3 # Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 3 # Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
4 # for details. All rights reserved. Use of this source code is governed by a 4 # for details. All rights reserved. Use of this source code is governed by a
5 # BSD-style license that can be found in the LICENSE file. 5 # BSD-style license that can be found in the LICENSE file.
6 # 6 #
7 7
8 import optparse 8 import optparse
9 import os 9 import os
10 import re 10 import re
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after
294 has_interesting_info = True 294 has_interesting_info = True
295 if has_interesting_info: 295 if has_interesting_info:
296 print '\n'.join(chunk) 296 print '\n'.join(chunk)
297 chunk = [] 297 chunk = []
298 else: 298 else:
299 chunk.append(line) 299 chunk.append(line)
300 if not is_empty_chunk(chunk): 300 if not is_empty_chunk(chunk):
301 print '\n'.join(chunk) 301 print '\n'.join(chunk)
302 302
303 303
304 def NotifyBuildDone(build_config, success):
305 if not success:
306 print "BUILD FAILED"
307
308 sys.stdout.flush()
309
310 if success:
311 message = 'Build succeeded.'
312 else:
313 message = 'Build failed.'
314 title = build_config
315
316 command = None
317 if HOST_OS == 'macos':
318 # Use AppleScript to display a UI non-modal notification.
319 script = 'display notification "%s" with title "%s" sound name "Glass"' % (
320 message, title)
321 command = "osascript -e '%s' &" % script
322 elif HOST_OS == 'linux':
323 if success:
324 icon = 'dialog-information'
325 else:
326 icon = 'dialog-error'
327 command = "notify-send -i '%s' '%s' '%s' &" % (icon, message, title)
328
329 if command:
330 # Ignore return code, if this command fails, it doesn't matter.
331 os.system(command)
332
333
304 def Main(): 334 def Main():
305 utils.ConfigureJava() 335 utils.ConfigureJava()
306 # Parse the options. 336 # Parse the options.
307 parser = BuildOptions() 337 parser = BuildOptions()
308 (options, args) = parser.parse_args() 338 (options, args) = parser.parse_args()
309 if not ProcessOptions(options, args): 339 if not ProcessOptions(options, args):
310 parser.print_help() 340 parser.print_help()
311 return 1 341 return 1
312 # Determine which targets to build. By default we build the "all" target. 342 # Determine which targets to build. By default we build the "all" target.
313 if len(args) == 0: 343 if len(args) == 0:
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
397 process = subprocess.Popen(args, 427 process = subprocess.Popen(args,
398 stdin=None, 428 stdin=None,
399 bufsize=1, # Line buffered. 429 bufsize=1, # Line buffered.
400 stdout=subprocess.PIPE, 430 stdout=subprocess.PIPE,
401 stderr=subprocess.STDOUT) 431 stderr=subprocess.STDOUT)
402 FilterEmptyXcodebuildSections(process) 432 FilterEmptyXcodebuildSections(process)
403 else: 433 else:
404 process = subprocess.Popen(args, stdin=None) 434 process = subprocess.Popen(args, stdin=None)
405 process.wait() 435 process.wait()
406 if process.returncode != 0: 436 if process.returncode != 0:
407 print "BUILD FAILED" 437 NotifyBuildDone(build_config, success=False)
408 return 1 438 return 1
439 else:
440 NotifyBuildDone(build_config, success=True)
409 441
410 return 0 442 return 0
411 443
412 444
413 if __name__ == '__main__': 445 if __name__ == '__main__':
414 sys.exit(Main()) 446 sys.exit(Main())
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698