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

Unified 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, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« 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