├── settings.gradle ├── .gitignore ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── plugin ├── src │ ├── main │ │ ├── resources │ │ │ └── META-INF │ │ │ │ └── gradle-plugins │ │ │ │ └── notifier-plugin.properties │ │ └── groovy │ │ │ └── jp │ │ │ └── tomorrowkey │ │ │ └── gradle │ │ │ └── notifier │ │ │ ├── Notifier.groovy │ │ │ ├── BeepNotifier.groovy │ │ │ ├── Commander.groovy │ │ │ ├── VoiceNotifier.groovy │ │ │ ├── NotificationCenterNotifier.groovy │ │ │ ├── NotifierPlugin.groovy │ │ │ ├── SoundNotifier.groovy │ │ │ └── NotifiersFactory.groovy │ └── test │ │ └── groovy │ │ └── jp │ │ └── tomorrowkey │ │ └── gradle │ │ └── notifier │ │ └── VoiceNotifierTest.groovy └── build.gradle ├── notifier.properties ├── example ├── src │ ├── main │ │ └── java │ │ │ └── com │ │ │ └── example │ │ │ └── Main.java │ └── test │ │ └── java │ │ └── com │ │ └── example │ │ └── MainTest.java └── build.gradle ├── CHANGES.md ├── gradle.properties ├── gradlew.bat ├── gradlew ├── README.md └── LICENSE /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':plugin' 2 | include ':example' 3 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .gradle 2 | local.properties 3 | .idea 4 | .DS_Store 5 | build/ 6 | *.iml -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tomorrowkey/notifier-plugin/HEAD/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /plugin/src/main/resources/META-INF/gradle-plugins/notifier-plugin.properties: -------------------------------------------------------------------------------- 1 | implementation-class=jp.tomorrowkey.gradle.notifier.NotifierPlugin 2 | -------------------------------------------------------------------------------- /plugin/src/test/groovy/jp/tomorrowkey/gradle/notifier/VoiceNotifierTest.groovy: -------------------------------------------------------------------------------- 1 | package jp.tomorrowkey.gradle.notifier 2 | 3 | public class VoiceNotifierTest { 4 | 5 | } 6 | -------------------------------------------------------------------------------- /plugin/src/main/groovy/jp/tomorrowkey/gradle/notifier/Notifier.groovy: -------------------------------------------------------------------------------- 1 | package jp.tomorrowkey.gradle.notifier 2 | 3 | public interface Notifier { 4 | void performNotify(task, state) 5 | } 6 | -------------------------------------------------------------------------------- /notifier.properties: -------------------------------------------------------------------------------- 1 | voice.enabled=true 2 | voice.name=Alex 3 | notificationCenter.enabled=true 4 | sound.enabled=false 5 | sound.url=http://example.com/sound.mp3 6 | beep.enabled=true 7 | beep.count=5 8 | -------------------------------------------------------------------------------- /example/src/main/java/com/example/Main.java: -------------------------------------------------------------------------------- 1 | package com.example; 2 | 3 | public class Main { 4 | 5 | public static void main(String... args) { 6 | System.out.println("Hello, World."); 7 | } 8 | 9 | } 10 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Thu May 22 20:30:26 JST 2014 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-1.12-bin.zip 7 | -------------------------------------------------------------------------------- /example/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'java' 2 | apply plugin: 'notifier-plugin' 3 | 4 | sourceCompatibility = 1.7 5 | version = '1.0' 6 | 7 | repositories { 8 | mavenCentral() 9 | } 10 | 11 | dependencies { 12 | testCompile group: 'junit', name: 'junit', version: '4.11' 13 | } 14 | -------------------------------------------------------------------------------- /example/src/test/java/com/example/MainTest.java: -------------------------------------------------------------------------------- 1 | package com.example; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.hamcrest.CoreMatchers.is; 6 | import static org.junit.Assert.assertThat; 7 | 8 | public class MainTest { 9 | 10 | @Test 11 | public void test() { 12 | assertThat("Hello", is("Hello")); 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /plugin/src/main/groovy/jp/tomorrowkey/gradle/notifier/BeepNotifier.groovy: -------------------------------------------------------------------------------- 1 | package jp.tomorrowkey.gradle.notifier 2 | 3 | import java.awt.* 4 | 5 | class BeepNotifier implements Notifier { 6 | 7 | int count; 8 | 9 | public BeepNotifier(int count) { 10 | this.count = count; 11 | } 12 | 13 | @Override 14 | void performNotify(Object task, Object state) { 15 | def toolkit = Toolkit.getDefaultToolkit(); 16 | count.times { 17 | toolkit.beep() 18 | sleep(100) 19 | } 20 | } 21 | } -------------------------------------------------------------------------------- /CHANGES.md: -------------------------------------------------------------------------------- 1 | # The revision history of notifier-plugin 2 | 3 | ## v1.0.1 - 2015-08-14 4 | 5 | - Prevent crash when config file missing 6 | 7 | ## v1.0.0 - 2015-05-09 8 | 9 | - Support Java8 10 | - Config file name changed from `notifier.groovy` to `notifier.properties` 11 | 12 | ## v0.0.5 - 2014-11-22 13 | 14 | - Remove unused dependency 15 | 16 | ## v0.0.4 - 2014-05-25 17 | 18 | - Improvement codes 19 | 20 | ## v0.0.3 - 2014-05-23 21 | 22 | - Add an ability of ringing beep 23 | 24 | ## v0.0.2 - 2014-05-21 25 | 26 | - Fix crash when notifier.groovy file is missing 27 | 28 | ## v0.0.1 - 2014-05-20 29 | 30 | - Initial Release 31 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | 3 | # IDE (e.g. Android Studio) users: 4 | # Settings specified in this file will override any Gradle settings 5 | # configured through the IDE. 6 | 7 | # For more details on how to configure your build environment visit 8 | # http://www.gradle.org/docs/current/userguide/build_environment.html 9 | 10 | # Specifies the JVM arguments used for the daemon process. 11 | # The setting is particularly useful for tweaking memory settings. 12 | # Default value: -Xmx10248m -XX:MaxPermSize=256m 13 | org.gradle.jvmargs=-Dfile.encoding=UTF-8 -Xms512m -Xmx512m -XX:PermSize=256m -XX:MaxPermSize=256m 14 | org.gradle.daemon=true 15 | -------------------------------------------------------------------------------- /plugin/src/main/groovy/jp/tomorrowkey/gradle/notifier/Commander.groovy: -------------------------------------------------------------------------------- 1 | package jp.tomorrowkey.gradle.notifier 2 | 3 | import org.gradle.api.logging.Logger 4 | 5 | public class Commander { 6 | 7 | private Logger logger; 8 | 9 | public Commander(Logger logger) { 10 | this.logger = logger; 11 | } 12 | 13 | public void execute(String... commands) { 14 | if(commands == null) { 15 | throw new IllegalArgumentException("commands must not be null"); 16 | } 17 | 18 | logger.info("commands") 19 | commands.each() { command -> 20 | logger.info(" command=" + command) 21 | } 22 | commands.execute() 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /plugin/src/main/groovy/jp/tomorrowkey/gradle/notifier/VoiceNotifier.groovy: -------------------------------------------------------------------------------- 1 | package jp.tomorrowkey.gradle.notifier 2 | 3 | public class VoiceNotifier implements Notifier { 4 | 5 | Commander commander; 6 | 7 | String voice 8 | 9 | public VoiceNotifier(voice) { 10 | this.voice = voice 11 | } 12 | 13 | public void performNotify(task, state) { 14 | commander = new Commander(task.logger) 15 | 16 | def command 17 | if (state.failure) { 18 | commander.execute("say", "-v", "$voice", "'$task.name task is failed'") 19 | } else { 20 | commander.execute("say", "-v", "$voice", "'$task.name task is finished'") 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /plugin/src/main/groovy/jp/tomorrowkey/gradle/notifier/NotificationCenterNotifier.groovy: -------------------------------------------------------------------------------- 1 | package jp.tomorrowkey.gradle.notifier 2 | 3 | public class NotificationCenterNotifier implements Notifier { 4 | 5 | Commander commander; 6 | 7 | public void performNotify(task, state) { 8 | commander = new Commander(task.logger) 9 | 10 | def title = "Gradle task" 11 | 12 | if (state.failure) { 13 | growl(title, "$task.name task is failed") 14 | } else { 15 | growl(title, "$task.name task is finished") 16 | } 17 | } 18 | 19 | void growl(String title, String message) { 20 | commander.execute("osascript", "-e", "display notification \"${message}\" with title \"${title}\"") 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /plugin/src/main/groovy/jp/tomorrowkey/gradle/notifier/NotifierPlugin.groovy: -------------------------------------------------------------------------------- 1 | package jp.tomorrowkey.gradle.notifier 2 | 3 | import org.gradle.api.Plugin 4 | import org.gradle.api.Project 5 | 6 | // see http://www.gradle.org/docs/current/userguide/custom_plugins.html 7 | 8 | public class NotifierPlugin implements Plugin { 9 | 10 | def notifiers = [] 11 | 12 | @Override 13 | void apply(Project project) { 14 | notifiers = NotifiersFactory.create(project) 15 | 16 | project.gradle.taskGraph.afterTask { task, state -> 17 | def tasks = project.gradle.taskGraph.allTasks 18 | 19 | if (tasks.isEmpty()) { 20 | return; 21 | } 22 | 23 | def lastTask = tasks.last() 24 | if (!lastTask.equals(task)) { 25 | return; 26 | } 27 | 28 | performNotify(task, state) 29 | } 30 | } 31 | 32 | void performNotify(task, state){ 33 | notifiers.each() { notifier -> 34 | notifier.performNotify(task, state) 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /plugin/src/main/groovy/jp/tomorrowkey/gradle/notifier/SoundNotifier.groovy: -------------------------------------------------------------------------------- 1 | package jp.tomorrowkey.gradle.notifier 2 | 3 | public class SoundNotifier implements Notifier { 4 | 5 | Commander commander 6 | 7 | def downloadFilePath 8 | 9 | def url 10 | 11 | public SoundNotifier(project, url) { 12 | this.downloadFilePath = "${project.buildDir}/notify_sound" 13 | this.url = url 14 | } 15 | 16 | public void performNotify(task, state) { 17 | commander = new Commander(task.logger) 18 | 19 | def url = new URL(this.url) 20 | def filePath 21 | 22 | if (url.protocol == "file") { 23 | filePath = url.path 24 | } else { 25 | filePath = download(url, downloadFilePath) 26 | } 27 | 28 | play(filePath) 29 | } 30 | 31 | def download(url, filePath) { 32 | def file = new File(filePath) 33 | file.parentFile.mkdirs() 34 | 35 | if(!file.exists()) { 36 | url.withInputStream { input -> 37 | file.bytes = input.bytes 38 | } 39 | } 40 | 41 | return filePath 42 | } 43 | 44 | def play(filePath) { 45 | commander.execute("afplay", filePath) 46 | } 47 | 48 | } 49 | -------------------------------------------------------------------------------- /plugin/src/main/groovy/jp/tomorrowkey/gradle/notifier/NotifiersFactory.groovy: -------------------------------------------------------------------------------- 1 | package jp.tomorrowkey.gradle.notifier 2 | 3 | import org.gradle.api.Project 4 | 5 | public class NotifiersFactory { 6 | 7 | private static final String CONFIG_FILE_PATH = "notifier.properties"; 8 | 9 | public static Notifier[] create(Project project) { 10 | Map config = getDefaultConfig() 11 | config.putAll(getConfig(new File(CONFIG_FILE_PATH))) 12 | create(project, config) 13 | } 14 | 15 | static Map getDefaultConfig() { 16 | def Map map = new HashMap() 17 | map.put('voice.enabled', false) 18 | map.put('voice.name', 'Alex') 19 | map.put('notificationCenter.enabled', false) 20 | map.put('sound.enabled', false) 21 | map.put('beep.enabled', false) 22 | map.put('beep.count', 3) 23 | return map 24 | } 25 | 26 | static Map getConfig(File configFile) { 27 | def props = new Properties(); 28 | if(configFile.exists()) { 29 | configFile.withInputStream { 30 | stream -> props.load(stream) 31 | } 32 | } 33 | return props 34 | } 35 | 36 | static Notifier[] create(Project project, Map config) { 37 | def notifiers = [] 38 | 39 | if (config.get('voice.enabled').toBoolean()) { 40 | notifiers.add(new VoiceNotifier(config.get('voice.name'))) 41 | } 42 | 43 | if (config.get('notificationCenter.enabled').toBoolean()) { 44 | notifiers.add(new NotificationCenterNotifier()) 45 | } 46 | 47 | if (config.get('sound.enabled').toBoolean()) { 48 | notifiers.add(new SoundNotifier(project, config.get('sound.url'))) 49 | } 50 | 51 | if (config.get('beep.enabled').toBoolean()) { 52 | notifiers.add(new BeepNotifier(config.get('beep.count').toInteger())); 53 | } 54 | 55 | return notifiers; 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /plugin/build.gradle: -------------------------------------------------------------------------------- 1 | final REPOSITORY_URL = 'https://github.com/tomorrowkey/notifier-plugin' 2 | 3 | final GROUP_ID = 'jp.tomorrowkey.gradle.notifier' 4 | final ARTIFACT_ID = 'notifier-plugin' 5 | final VERSION = '1.0.1' 6 | 7 | buildscript { 8 | repositories { 9 | mavenCentral() 10 | } 11 | dependencies { 12 | classpath 'org.gradle.api.plugins:gradle-nexus-plugin:0.+' 13 | } 14 | } 15 | 16 | apply plugin: 'groovy' 17 | apply plugin: 'maven' 18 | apply plugin: 'nexus' 19 | 20 | repositories { 21 | mavenCentral() 22 | } 23 | 24 | dependencies { 25 | compile gradleApi() 26 | compile localGroovy() 27 | testCompile 'junit:junit:4.11' 28 | testCompile 'org.hamcrest:hamcrest-all:1.3' 29 | testCompile 'org.mockito:mockito-core:1.9.5' 30 | } 31 | 32 | // artifact settings 33 | 34 | String git(String command) { 35 | println "git $command" 36 | def process = ["sh", "-c", "cd ${project.rootDir} ; git $command"].execute() 37 | if (process.waitFor() != 0) { 38 | throw new GradleException(process.err.text) 39 | } 40 | return process.in.text 41 | } 42 | 43 | task('releng') { 44 | doLast { 45 | def gitStatus = git("status --porcelain") 46 | if (gitStatus.trim()) { 47 | throw new GradleException("Changes found:\n$gitStatus") 48 | } 49 | 50 | println git("tag v$VERSION") 51 | println git("push origin v$VERSION") 52 | } 53 | } 54 | 55 | configurations { 56 | mavenDeployer 57 | } 58 | 59 | artifacts { 60 | archives jar 61 | archives javadocJar 62 | archives sourcesJar 63 | } 64 | 65 | uploadArchives { 66 | repositories.mavenDeployer { 67 | pom.groupId = GROUP_ID 68 | pom.artifactId = ARTIFACT_ID 69 | pom.version = VERSION 70 | } 71 | } 72 | 73 | modifyPom { 74 | project { 75 | name 'Notifier Plugin' 76 | description 'Ring sound when last task is finished' 77 | url REPOSITORY_URL 78 | inceptionYear '2014' 79 | 80 | scm { 81 | url REPOSITORY_URL 82 | } 83 | 84 | licenses { 85 | license { 86 | name 'The Apache Software License, Version 2.0' 87 | url 'http://www.apache.org/licenses/LICENSE-2.0.txt' 88 | distribution 'repo' 89 | } 90 | } 91 | 92 | developers { 93 | developer { 94 | id 'tomorrowkey' 95 | name 'Tomoki Yamashita' 96 | email 'tomorrowkey@gmail.com' 97 | } 98 | } 99 | } 100 | } 101 | -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 12 | set DEFAULT_JVM_OPTS= 13 | 14 | set DIRNAME=%~dp0 15 | if "%DIRNAME%" == "" set DIRNAME=. 16 | set APP_BASE_NAME=%~n0 17 | set APP_HOME=%DIRNAME% 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windowz variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | if "%@eval[2+2]" == "4" goto 4NT_args 53 | 54 | :win9xME_args 55 | @rem Slurp the command line arguments. 56 | set CMD_LINE_ARGS= 57 | set _SKIP=2 58 | 59 | :win9xME_args_slurp 60 | if "x%~1" == "x" goto execute 61 | 62 | set CMD_LINE_ARGS=%* 63 | goto execute 64 | 65 | :4NT_args 66 | @rem Get arguments from the 4NT Shell from JP Software 67 | set CMD_LINE_ARGS=%$ 68 | 69 | :execute 70 | @rem Setup the command line 71 | 72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if "%ERRORLEVEL%"=="0" goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 85 | exit /b 1 86 | 87 | :mainEnd 88 | if "%OS%"=="Windows_NT" endlocal 89 | 90 | :omega 91 | -------------------------------------------------------------------------------- /gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ############################################################################## 4 | ## 5 | ## Gradle start up script for UN*X 6 | ## 7 | ############################################################################## 8 | 9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 10 | DEFAULT_JVM_OPTS="" 11 | 12 | APP_NAME="Gradle" 13 | APP_BASE_NAME=`basename "$0"` 14 | 15 | # Use the maximum available, or set MAX_FD != -1 to use that value. 16 | MAX_FD="maximum" 17 | 18 | warn ( ) { 19 | echo "$*" 20 | } 21 | 22 | die ( ) { 23 | echo 24 | echo "$*" 25 | echo 26 | exit 1 27 | } 28 | 29 | # OS specific support (must be 'true' or 'false'). 30 | cygwin=false 31 | msys=false 32 | darwin=false 33 | case "`uname`" in 34 | CYGWIN* ) 35 | cygwin=true 36 | ;; 37 | Darwin* ) 38 | darwin=true 39 | ;; 40 | MINGW* ) 41 | msys=true 42 | ;; 43 | esac 44 | 45 | # For Cygwin, ensure paths are in UNIX format before anything is touched. 46 | if $cygwin ; then 47 | [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"` 48 | fi 49 | 50 | # Attempt to set APP_HOME 51 | # Resolve links: $0 may be a link 52 | PRG="$0" 53 | # Need this for relative symlinks. 54 | while [ -h "$PRG" ] ; do 55 | ls=`ls -ld "$PRG"` 56 | link=`expr "$ls" : '.*-> \(.*\)$'` 57 | if expr "$link" : '/.*' > /dev/null; then 58 | PRG="$link" 59 | else 60 | PRG=`dirname "$PRG"`"/$link" 61 | fi 62 | done 63 | SAVED="`pwd`" 64 | cd "`dirname \"$PRG\"`/" >&- 65 | APP_HOME="`pwd -P`" 66 | cd "$SAVED" >&- 67 | 68 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 69 | 70 | # Determine the Java command to use to start the JVM. 71 | if [ -n "$JAVA_HOME" ] ; then 72 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 73 | # IBM's JDK on AIX uses strange locations for the executables 74 | JAVACMD="$JAVA_HOME/jre/sh/java" 75 | else 76 | JAVACMD="$JAVA_HOME/bin/java" 77 | fi 78 | if [ ! -x "$JAVACMD" ] ; then 79 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 80 | 81 | Please set the JAVA_HOME variable in your environment to match the 82 | location of your Java installation." 83 | fi 84 | else 85 | JAVACMD="java" 86 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 87 | 88 | Please set the JAVA_HOME variable in your environment to match the 89 | location of your Java installation." 90 | fi 91 | 92 | # Increase the maximum file descriptors if we can. 93 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then 94 | MAX_FD_LIMIT=`ulimit -H -n` 95 | if [ $? -eq 0 ] ; then 96 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 97 | MAX_FD="$MAX_FD_LIMIT" 98 | fi 99 | ulimit -n $MAX_FD 100 | if [ $? -ne 0 ] ; then 101 | warn "Could not set maximum file descriptor limit: $MAX_FD" 102 | fi 103 | else 104 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 105 | fi 106 | fi 107 | 108 | # For Darwin, add options to specify how the application appears in the dock 109 | if $darwin; then 110 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 111 | fi 112 | 113 | # For Cygwin, switch paths to Windows format before running java 114 | if $cygwin ; then 115 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 116 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 117 | 118 | # We build the pattern for arguments to be converted via cygpath 119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 120 | SEP="" 121 | for dir in $ROOTDIRSRAW ; do 122 | ROOTDIRS="$ROOTDIRS$SEP$dir" 123 | SEP="|" 124 | done 125 | OURCYGPATTERN="(^($ROOTDIRS))" 126 | # Add a user-defined pattern to the cygpath arguments 127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 129 | fi 130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 131 | i=0 132 | for arg in "$@" ; do 133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 135 | 136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 138 | else 139 | eval `echo args$i`="\"$arg\"" 140 | fi 141 | i=$((i+1)) 142 | done 143 | case $i in 144 | (0) set -- ;; 145 | (1) set -- "$args0" ;; 146 | (2) set -- "$args0" "$args1" ;; 147 | (3) set -- "$args0" "$args1" "$args2" ;; 148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;; 149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 154 | esac 155 | fi 156 | 157 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules 158 | function splitJvmOpts() { 159 | JVM_OPTS=("$@") 160 | } 161 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS 162 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" 163 | 164 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" 165 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Notifier Plugin 2 | ================= 3 | 4 | Notifier Plugin is a plugin for gradle. 5 | This plugin provides an ability of notifying you that gradle task is finished. 6 | 7 | # It supports only Mac 8 | Sorry for other platform users... 9 | Because it uses `afplay` command for playing sound, Notification Center via apple script and `say` command for talking. 10 | Beep may work on other platform. 11 | 12 | I'll be happy, if you give me a PullRequest! 13 | 14 | # Quick Start 15 | 16 | ## build.gradle 17 | ``` 18 | buildscript { 19 | repositories { 20 | mavenCentral() 21 | } 22 | dependencies { 23 | classpath 'jp.tomorrowkey.gradle.notifier:notifier-plugin:1.0.1' 24 | } 25 | } 26 | ``` 27 | ## app/build.gradle 28 | ``` 29 | apply plugin: 'notifier-plugin' 30 | ``` 31 | 32 | # Configuration 33 | To use this plugin, you have to make a configuration file. 34 | 35 | notifier.properties 36 | 37 | ``` 38 | voice.enabled=false 39 | voice.name=Alex 40 | 41 | notificationCenter.enabled=true 42 | 43 | sound.enabled=true 44 | sound.url=file:///Users/tomorrowkey/Desktop/meow.mp3 45 | 46 | beep.enabled=true 47 | beep.count=5 48 | ``` 49 | 50 | ##voice 51 | ### enabled 52 | If set true, your computer talks when gradle task is finished. 53 | default value is `false` 54 | 55 | ### name 56 | name of voice. default value is `Alex`. You can use following names on OSX Yosemite. 57 | 58 | ``` 59 | Agnes en_US # Isn't it nice to have a computer that will talk to you? 60 | Albert en_US # I have a frog in my throat. No, I mean a real frog! 61 | Alex en_US # Most people recognize me by my voice. 62 | Alice it_IT # Salve, mi chiamo Alice e sono una voce italiana. 63 | Alva sv_SE # Hej, jag heter Alva. Jag är en svensk röst. 64 | Amelie fr_CA # Bonjour, je m’appelle Amelie. Je suis une voix canadienne. 65 | Anna de_DE # Hallo, ich heiße Anna und ich bin eine deutsche Stimme. 66 | Bad News en_US # The light you see at the end of the tunnel is the headlamp of a fast approaching train. 67 | Bahh en_US # Do not pull the wool over my eyes. 68 | Bells en_US # Time flies when you are having fun. 69 | Boing en_US # Spring has sprung, fall has fell, winter's here and it's colder than usual. 70 | Bruce en_US # I sure like being inside this fancy computer 71 | Bubbles en_US # Pull the plug! I'm drowning! 72 | Carmit he_IL # שלום. קוראים לי כרמית, ואני קול בשפה העברית. 73 | Cellos en_US # Doo da doo da dum dee dee doodly doo dum dum dum doo da doo da doo da doo da doo da doo da doo 74 | Damayanti id_ID # Halo, nama saya Damayanti. Saya berbahasa Indonesia. 75 | Daniel en_GB # Hello, my name is Daniel. I am a British-English voice. 76 | Deranged en_US # I need to go on a really long vacation. 77 | Diego es_AR # Hola, me llamo Diego y soy una voz española. 78 | Ellen nl_BE # Hallo, mijn naam is Ellen. Ik ben een Belgische stem. 79 | Fiona en-scotland # Hello, my name is Fiona. I am a Scottish-English voice. 80 | Fred en_US # I sure like being inside this fancy computer 81 | Good News en_US # Congratulations you just won the sweepstakes and you don't have to pay income tax again. 82 | Hysterical en_US # Please stop tickling me! 83 | Ioana ro_RO # Bună, mă cheamă Ioana . Sunt o voce românească. 84 | Joana pt_PT # Olá, chamo-me Joana e dou voz ao português falado em Portugal. 85 | Junior en_US # My favorite food is pizza. 86 | Kanya th_TH # สวัสดีค่ะ ดิฉันชื่อKanya 87 | Karen en_AU # Hello, my name is Karen. I am an Australian-English voice. 88 | Kathy en_US # Isn't it nice to have a computer that will talk to you? 89 | Kyoko ja_JP # こんにちは、私の名前はKyokoです。日本語の音声をお届けします。 90 | Laura sk_SK # Ahoj. Volám sa Laura . Som hlas v slovenskom jazyku. 91 | Lekha hi_IN # नमस्कार, मेरा नाम लेखा है.Lekha[[FEMALE_NAME]]मै हिंदी मे बोलने वाली आवाज़ हूँ. 92 | Luciana pt_BR # Olá, o meu nome é Luciana e a minha voz corresponde ao português que é falado no Brasil 93 | Mariska hu_HU # Üdvözlöm! Mariska vagyok. Én vagyok a magyar hang. 94 | Mei-Jia zh_TW # 您好,我叫美佳。我說國語。 95 | Melina el_GR # Γεια σας, ονομάζομαι Melina. Είμαι μια ελληνική φωνή. 96 | Milena ru_RU # Здравствуйте, меня зовут Milena. Я – русский голос системы. 97 | Moira en_IE # Hello, my name is Moira. I am an Irish-English voice. 98 | Monica es_ES # Hola, me llamo Monica y soy una voz española. 99 | Nora nb_NO # Hei, jeg heter Nora. Jeg er en norsk stemme. 100 | Paulina es_MX # Hola, me llamo Paulina y soy una voz mexicana. 101 | Pipe Organ en_US # We must rejoice in this morbid voice. 102 | Princess en_US # When I grow up I'm going to be a scientist. 103 | Ralph en_US # The sum of the squares of the legs of a right triangle is equal to the square of the hypotenuse. 104 | Samantha en_US # Hello, my name is Samantha. I am an American-English voice. 105 | Sara da_DK # Hej, jeg hedder Sara. Jeg er en dansk stemme. 106 | Satu fi_FI # Hei, minun nimeni on Satu. Olen suomalainen ääni. 107 | Sin-ji zh_HK # 您好,我叫 Sin-ji。我講廣東話。 108 | Tarik ar_SA # مرحبًا اسمي Tarik. أنا عربي من السعودية. 109 | Tessa en_ZA # Hello, my name is Tessa. I am a South African-English voice. 110 | Thomas fr_FR # Bonjour, je m’appelle Thomas. Je suis une voix française. 111 | Ting-Ting zh_CN # 您好,我叫Ting-Ting。我讲中文普通话。 112 | Trinoids en_US # We cannot communicate with these carbon units. 113 | Veena en_IN # Hello, my name is Veena. I am an Indian-English voice. 114 | Vicki en_US # Isn't it nice to have a computer that will talk to you? 115 | Victoria en_US # Isn't it nice to have a computer that will talk to you? 116 | Whisper en_US # Pssssst, hey you, Yeah you, Who do ya think I'm talking to, the mouse? 117 | Xander nl_NL # Hallo, mijn naam is Xander. Ik ben een Nederlandse stem. 118 | Yelda tr_TR # Merhaba, benim adım Yelda. Ben Türkçe bir sesim. 119 | Yuna ko_KR # 안녕하세요. 제 이름은 Yuna입니다. 저는 한국어 음성입니다. 120 | Zarvox en_US # That looks like a peaceful planet. 121 | Zosia pl_PL # Witaj. Mam na imię Zosia, jestem głosem kobiecym dla języka polskiego. 122 | Zuzana cs_CZ # Dobrý den, jmenuji se Zuzana. Jsem český hlas. 123 | ``` 124 | 125 | You can also get the above list by run `say -v "?"` on your terminal. 126 | 127 | ## notificationCenter 128 | ### enabled 129 | If set true, Notification appeared when gradle task is finished. 130 | default value is `false` 131 | 132 | ## sound 133 | ### enabled 134 | If set true, play sound when gradle task is finished. 135 | you need to set url property, if it is true. 136 | 137 | ### url 138 | location of sound file. 139 | When use a sound file on online. just write like this. 140 | ``` 141 | url="http://example.com/sound.mp3" 142 | ``` 143 | When use a sound file on local. just write like this. 144 | ``` 145 | url="file:///Users/tomorrowkey/sound.mp3" 146 | ``` 147 | 148 | ## beep 149 | ### enabled 150 | If set true, ring beep when gradle task is finished. 151 | default value is false 152 | 153 | ### count 154 | count of beeps for ringing 155 | default value is 3 156 | 157 | # Open Source License 158 | 159 | This plugin made with [gradle-plugin-template](https://github.com/gfx/gradle-plugin-template) 160 | 161 | # License 162 | ``` 163 | Copyright 2014 tomorrowkey 164 | 165 | Licensed under the Apache License, Version 2.0 (the "License"); 166 | you may not use this file except in compliance with the License. 167 | You may obtain a copy of the License at 168 | 169 | http://www.apache.org/licenses/LICENSE-2.0 170 | 171 | Unless required by applicable law or agreed to in writing, software 172 | distributed under the License is distributed on an "AS IS" BASIS, 173 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 174 | See the License for the specific language governing permissions and 175 | limitations under the License. 176 | ``` 177 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | 2 | Apache License 3 | Version 2.0, January 2004 4 | http://www.apache.org/licenses/ 5 | 6 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 7 | 8 | 1. Definitions. 9 | 10 | "License" shall mean the terms and conditions for use, reproduction, 11 | and distribution as defined by Sections 1 through 9 of this document. 12 | 13 | "Licensor" shall mean the copyright owner or entity authorized by 14 | the copyright owner that is granting the License. 15 | 16 | "Legal Entity" shall mean the union of the acting entity and all 17 | other entities that control, are controlled by, or are under common 18 | control with that entity. For the purposes of this definition, 19 | "control" means (i) the power, direct or indirect, to cause the 20 | direction or management of such entity, whether by contract or 21 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 22 | outstanding shares, or (iii) beneficial ownership of such entity. 23 | 24 | "You" (or "Your") shall mean an individual or Legal Entity 25 | exercising permissions granted by this License. 26 | 27 | "Source" form shall mean the preferred form for making modifications, 28 | including but not limited to software source code, documentation 29 | source, and configuration files. 30 | 31 | "Object" form shall mean any form resulting from mechanical 32 | transformation or translation of a Source form, including but 33 | not limited to compiled object code, generated documentation, 34 | and conversions to other media types. 35 | 36 | "Work" shall mean the work of authorship, whether in Source or 37 | Object form, made available under the License, as indicated by a 38 | copyright notice that is included in or attached to the work 39 | (an example is provided in the Appendix below). 40 | 41 | "Derivative Works" shall mean any work, whether in Source or Object 42 | form, that is based on (or derived from) the Work and for which the 43 | editorial revisions, annotations, elaborations, or other modifications 44 | represent, as a whole, an original work of authorship. For the purposes 45 | of this License, Derivative Works shall not include works that remain 46 | separable from, or merely link (or bind by name) to the interfaces of, 47 | the Work and Derivative Works thereof. 48 | 49 | "Contribution" shall mean any work of authorship, including 50 | the original version of the Work and any modifications or additions 51 | to that Work or Derivative Works thereof, that is intentionally 52 | submitted to Licensor for inclusion in the Work by the copyright owner 53 | or by an individual or Legal Entity authorized to submit on behalf of 54 | the copyright owner. For the purposes of this definition, "submitted" 55 | means any form of electronic, verbal, or written communication sent 56 | to the Licensor or its representatives, including but not limited to 57 | communication on electronic mailing lists, source code control systems, 58 | and issue tracking systems that are managed by, or on behalf of, the 59 | Licensor for the purpose of discussing and improving the Work, but 60 | excluding communication that is conspicuously marked or otherwise 61 | designated in writing by the copyright owner as "Not a Contribution." 62 | 63 | "Contributor" shall mean Licensor and any individual or Legal Entity 64 | on behalf of whom a Contribution has been received by Licensor and 65 | subsequently incorporated within the Work. 66 | 67 | 2. Grant of Copyright License. Subject to the terms and conditions of 68 | this License, each Contributor hereby grants to You a perpetual, 69 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 70 | copyright license to reproduce, prepare Derivative Works of, 71 | publicly display, publicly perform, sublicense, and distribute the 72 | Work and such Derivative Works in Source or Object form. 73 | 74 | 3. Grant of Patent License. Subject to the terms and conditions of 75 | this License, each Contributor hereby grants to You a perpetual, 76 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 77 | (except as stated in this section) patent license to make, have made, 78 | use, offer to sell, sell, import, and otherwise transfer the Work, 79 | where such license applies only to those patent claims licensable 80 | by such Contributor that are necessarily infringed by their 81 | Contribution(s) alone or by combination of their Contribution(s) 82 | with the Work to which such Contribution(s) was submitted. If You 83 | institute patent litigation against any entity (including a 84 | cross-claim or counterclaim in a lawsuit) alleging that the Work 85 | or a Contribution incorporated within the Work constitutes direct 86 | or contributory patent infringement, then any patent licenses 87 | granted to You under this License for that Work shall terminate 88 | as of the date such litigation is filed. 89 | 90 | 4. Redistribution. You may reproduce and distribute copies of the 91 | Work or Derivative Works thereof in any medium, with or without 92 | modifications, and in Source or Object form, provided that You 93 | meet the following conditions: 94 | 95 | (a) You must give any other recipients of the Work or 96 | Derivative Works a copy of this License; and 97 | 98 | (b) You must cause any modified files to carry prominent notices 99 | stating that You changed the files; and 100 | 101 | (c) You must retain, in the Source form of any Derivative Works 102 | that You distribute, all copyright, patent, trademark, and 103 | attribution notices from the Source form of the Work, 104 | excluding those notices that do not pertain to any part of 105 | the Derivative Works; and 106 | 107 | (d) If the Work includes a "NOTICE" text file as part of its 108 | distribution, then any Derivative Works that You distribute must 109 | include a readable copy of the attribution notices contained 110 | within such NOTICE file, excluding those notices that do not 111 | pertain to any part of the Derivative Works, in at least one 112 | of the following places: within a NOTICE text file distributed 113 | as part of the Derivative Works; within the Source form or 114 | documentation, if provided along with the Derivative Works; or, 115 | within a display generated by the Derivative Works, if and 116 | wherever such third-party notices normally appear. The contents 117 | of the NOTICE file are for informational purposes only and 118 | do not modify the License. You may add Your own attribution 119 | notices within Derivative Works that You distribute, alongside 120 | or as an addendum to the NOTICE text from the Work, provided 121 | that such additional attribution notices cannot be construed 122 | as modifying the License. 123 | 124 | You may add Your own copyright statement to Your modifications and 125 | may provide additional or different license terms and conditions 126 | for use, reproduction, or distribution of Your modifications, or 127 | for any such Derivative Works as a whole, provided Your use, 128 | reproduction, and distribution of the Work otherwise complies with 129 | the conditions stated in this License. 130 | 131 | 5. Submission of Contributions. Unless You explicitly state otherwise, 132 | any Contribution intentionally submitted for inclusion in the Work 133 | by You to the Licensor shall be under the terms and conditions of 134 | this License, without any additional terms or conditions. 135 | Notwithstanding the above, nothing herein shall supersede or modify 136 | the terms of any separate license agreement you may have executed 137 | with Licensor regarding such Contributions. 138 | 139 | 6. Trademarks. This License does not grant permission to use the trade 140 | names, trademarks, service marks, or product names of the Licensor, 141 | except as required for reasonable and customary use in describing the 142 | origin of the Work and reproducing the content of the NOTICE file. 143 | 144 | 7. Disclaimer of Warranty. Unless required by applicable law or 145 | agreed to in writing, Licensor provides the Work (and each 146 | Contributor provides its Contributions) on an "AS IS" BASIS, 147 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 148 | implied, including, without limitation, any warranties or conditions 149 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 150 | PARTICULAR PURPOSE. You are solely responsible for determining the 151 | appropriateness of using or redistributing the Work and assume any 152 | risks associated with Your exercise of permissions under this License. 153 | 154 | 8. Limitation of Liability. In no event and under no legal theory, 155 | whether in tort (including negligence), contract, or otherwise, 156 | unless required by applicable law (such as deliberate and grossly 157 | negligent acts) or agreed to in writing, shall any Contributor be 158 | liable to You for damages, including any direct, indirect, special, 159 | incidental, or consequential damages of any character arising as a 160 | result of this License or out of the use or inability to use the 161 | Work (including but not limited to damages for loss of goodwill, 162 | work stoppage, computer failure or malfunction, or any and all 163 | other commercial damages or losses), even if such Contributor 164 | has been advised of the possibility of such damages. 165 | 166 | 9. Accepting Warranty or Additional Liability. While redistributing 167 | the Work or Derivative Works thereof, You may choose to offer, 168 | and charge a fee for, acceptance of support, warranty, indemnity, 169 | or other liability obligations and/or rights consistent with this 170 | License. However, in accepting such obligations, You may act only 171 | on Your own behalf and on Your sole responsibility, not on behalf 172 | of any other Contributor, and only if You agree to indemnify, 173 | defend, and hold each Contributor harmless for any liability 174 | incurred by, or claims asserted against, such Contributor by reason 175 | of your accepting any such warranty or additional liability. 176 | 177 | END OF TERMS AND CONDITIONS 178 | 179 | APPENDIX: How to apply the Apache License to your work. 180 | 181 | To apply the Apache License to your work, attach the following 182 | boilerplate notice, with the fields enclosed by brackets "[]" 183 | replaced with your own identifying information. (Don't include 184 | the brackets!) The text should be enclosed in the appropriate 185 | comment syntax for the file format. We also recommend that a 186 | file or class name and description of purpose be included on the 187 | same "printed page" as the copyright notice for easier 188 | identification within third-party archives. 189 | 190 | Copyright 2014 tomorrowkey 191 | 192 | Licensed under the Apache License, Version 2.0 (the "License"); 193 | you may not use this file except in compliance with the License. 194 | You may obtain a copy of the License at 195 | 196 | http://www.apache.org/licenses/LICENSE-2.0 197 | 198 | Unless required by applicable law or agreed to in writing, software 199 | distributed under the License is distributed on an "AS IS" BASIS, 200 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 201 | See the License for the specific language governing permissions and 202 | limitations under the License. 203 | --------------------------------------------------------------------------------