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

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: Add flush. 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..d65bb985a343d0dc37cf3371843bc9ac554ddafc 100755
--- a/dart/tools/build.py
+++ b/dart/tools/build.py
@@ -301,6 +301,36 @@ PhaseScriptExecution "Action \"upload_sdk_py\"" xcodebuild/dart.build/...
print '\n'.join(chunk)
+def NotifyBuildDone(build_config, success):
+ if not success:
+ print "BUILD FAILED"
+
+ sys.stdout.flush()
+
+ if success:
+ message = 'Build succeeded.'
+ else:
+ message = 'Build failed.'
+ title = build_config
+
+ 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
+ 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 +434,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