Created
June 16, 2011 19:23
-
-
Save cybo42/1030021 to your computer and use it in GitHub Desktop.
Gradle Growl Notifications
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// File: ~/.gradle/init.gradle | |
class GrowlNotifyListener extends BuildAdapter { | |
void buildFinished(BuildResult result) { | |
if (result.failure) { | |
growlNotify "Gradle [${result?.gradle?.rootProject?.project?.name}]: failure", result.failure.message, true | |
} else { | |
growlNotify "Gradle [${result?.gradle?.rootProject?.project?.name}]: finished", 'Build successful' | |
} | |
} | |
void growlNotify(title, message = 'No message', sticky = false) { | |
def cmd = [ | |
'growlnotify', // Replace with your local path. | |
"-t", | |
title, | |
"-m", | |
message, | |
sticky ? '-s' : '' | |
] | |
cmd.execute() | |
} | |
} | |
def listener = new GrowlNotifyListener() | |
gradle.addBuildListener listener |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment