Skip to content

Instantly share code, notes, and snippets.

@raphiz
Created February 10, 2024 20:33
Show Gist options
  • Save raphiz/882784be7c3243ab7b30d7c1944f5d4e to your computer and use it in GitHub Desktop.
Save raphiz/882784be7c3243ab7b30d7c1944f5d4e to your computer and use it in GitHub Desktop.
Gradle build sound
# ~/.gradle/init.d/build-sound.gradle
allprojects { project ->
project.gradle.buildFinished { result ->
if (result.failure != null) {
project.exec {
# Notification sounds from here: https://github.com/jamesshore/livestream/tree/rot13-cli%2Bservice/build/sounds
commandLine 'sh', '-c', 'mpg123 /home/raphiz/music/notifications/fail.mp3 > /dev/null 2>&1'
}
} else {
project.exec {
commandLine 'sh', '-c', 'mpg123 /home/raphiz/music/notifications/success.mp3 > /dev/null 2>&1'
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment