Chromium Code Reviews| Index: dart/tools/build.py |
| diff --git a/dart/tools/build.py b/dart/tools/build.py |
| index 7fc3187af93e25e2aae19a9f0e6f2c460871b7b4..9cd8b36529d44ae396dda7a1f45ee2f8342d7523 100755 |
| --- a/dart/tools/build.py |
| +++ b/dart/tools/build.py |
| @@ -301,6 +301,34 @@ PhaseScriptExecution "Action \"upload_sdk_py\"" xcodebuild/dart.build/... |
| print '\n'.join(chunk) |
| +def NotifyBuildDone(build_config, success): |
| + if not success: |
| + print "BUILD FAILED" |
| + |
|
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
|
| + if success: |
| + message = 'Build succeeded.' |
| + else: |
| + message = 'Build failed.' |
| + 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
|
| + |
| + command = None |
| + if HOST_OS == 'macos': |
| + # Use AppleScript to display a UI non-modal notification. |
| + script = 'display notification "%s" with title "%s" sound name "Glass"' % ( |
| + message, title) |
| + 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
|
| + elif HOST_OS == 'linux': |
| + if success: |
| + icon = 'dialog-information' |
| + else: |
| + icon = 'dialog-error' |
| + command = "notify-send -i '%s' '%s' '%s' &" % (icon, message, title) |
| + |
| + if command: |
| + # Ignore return code, if this command fails, it doesn't matter. |
| + os.system(command) |
| + |
| + |
| def Main(): |
| utils.ConfigureJava() |
| # Parse the options. |
| @@ -404,8 +432,10 @@ def Main(): |
| process = subprocess.Popen(args, stdin=None) |
| process.wait() |
| if process.returncode != 0: |
| - print "BUILD FAILED" |
| + NotifyBuildDone(build_config, success=False) |
| return 1 |
| + else: |
| + NotifyBuildDone(build_config, success=True) |
| return 0 |