Skip to content

Instantly share code, notes, and snippets.

@efwe
Forked from cybo42/init.gradle
Created June 19, 2012 11:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save efwe/2953595 to your computer and use it in GitHub Desktop.
Save efwe/2953595 to your computer and use it in GitHub Desktop.
Gradle Growl Notifications
// File: ~/.gradle/init.gradle
class GrowlNotifyListener extends BuildAdapter {
void buildFinished(BuildResult result) {
def projectName = result?.gradle?.rootProject?.project?.name
// skip buildSrc
if (!projectName.equals("buildSrc")) {
if (result.failure) {
growlNotify "Gradle [$projectName]: failure", result.failure.message, true
} else {
growlNotify "Gradle [$projectName]: finished", 'Build successful'
}
}
}
void growlNotify(title, message = 'No message', sticky = false) {
def cmd = [
'growlnotify', // Replace with your local path.
"--image",
"gradle.png", // Replace with your local path.
"-t",
title,
"-m",
message,
sticky ? '-s' : ''
]
cmd.execute()
}
}
def listener = new GrowlNotifyListener()
gradle.addBuildListener listener
@efwe
Copy link
Author

efwe commented Jun 19, 2012

  • skip buildSrc
  • display image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment