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

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: Bells and whistles. 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
ricow1 2014/04/01 07:59:49 this may be a good place to do a sys.stdout.flush(
ahe 2014/04/01 12:11:07 Done. I agree this is a good place, just as a prec
308 if success:
309 message = 'Build succeeded.'
310 else:
311 message = 'Build failed.'
312 title = build_config
ricow1 2014/04/01 07:59:49 why do we put this into a local variable?
ahe 2014/04/01 12:11:07 Because it more clearly describes that this will b
313
314 command = None
315 if HOST_OS == 'macos':
316 # Use AppleScript to display a UI non-modal notification.
317 script = 'display notification "%s" with title "%s" sound name "Glass"' % (
318 message, title)
319 command = "osascript -e '%s' &" % script
ricow1 2014/04/01 07:59:49 I would just remove the command variable and branc
ahe 2014/04/01 12:11:07 I had that originally, but then I had to repeat th
320 elif HOST_OS == 'linux':
321 if success:
322 icon = 'dialog-information'
323 else:
324 icon = 'dialog-error'
325 command = "notify-send -i '%s' '%s' '%s' &" % (icon, message, title)
326
327 if command:
328 # Ignore return code, if this command fails, it doesn't matter.
329 os.system(command)
330
331
304 def Main(): 332 def Main():
305 utils.ConfigureJava() 333 utils.ConfigureJava()
306 # Parse the options. 334 # Parse the options.
307 parser = BuildOptions() 335 parser = BuildOptions()
308 (options, args) = parser.parse_args() 336 (options, args) = parser.parse_args()
309 if not ProcessOptions(options, args): 337 if not ProcessOptions(options, args):
310 parser.print_help() 338 parser.print_help()
311 return 1 339 return 1
312 # Determine which targets to build. By default we build the "all" target. 340 # Determine which targets to build. By default we build the "all" target.
313 if len(args) == 0: 341 if len(args) == 0:
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
397 process = subprocess.Popen(args, 425 process = subprocess.Popen(args,
398 stdin=None, 426 stdin=None,
399 bufsize=1, # Line buffered. 427 bufsize=1, # Line buffered.
400 stdout=subprocess.PIPE, 428 stdout=subprocess.PIPE,
401 stderr=subprocess.STDOUT) 429 stderr=subprocess.STDOUT)
402 FilterEmptyXcodebuildSections(process) 430 FilterEmptyXcodebuildSections(process)
403 else: 431 else:
404 process = subprocess.Popen(args, stdin=None) 432 process = subprocess.Popen(args, stdin=None)
405 process.wait() 433 process.wait()
406 if process.returncode != 0: 434 if process.returncode != 0:
407 print "BUILD FAILED" 435 NotifyBuildDone(build_config, success=False)
408 return 1 436 return 1
437 else:
438 NotifyBuildDone(build_config, success=True)
409 439
410 return 0 440 return 0
411 441
412 442
413 if __name__ == '__main__': 443 if __name__ == '__main__':
414 sys.exit(Main()) 444 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