2017-04-22 45 views
2

当编译准备就绪时,如何使sbt响铃(或播放声音,或执行某些系统命令,shell命令)?汇编小睡 - 编译准备就绪时如何让铃声响起?

编译通常需要40秒或更长时间,所以我想在等待时小睡一下,100次编译已经是一个小时的睡眠。

+2

我不知道你必须输入准确的巫术话,但你可以依赖于编译任务,并执行任何你喜欢后一个自定义任务。 –

+0

谢谢,我读了这个...像这样:http://www.scala-sbt.org/0.12.2/docs/Getting-Started/Custom-Settings.html – jhegedus

回答

3

取代你可能想留在温暖的JVM,并留在SBT控制台,

有一个SBT插件,你在找什么: https://github.com/orrsella/sbt-sound

它配备了一些不错的配置选项:

sound.play(compile in Compile, Sounds.Basso) // play the 'Basso' sound whenever compile completes (successful or not) 

sound.play(compile in Compile, Sounds.None, Sounds.Pop) // play the 'Pop' sound only when compile fails 

sound.play(test in Test, Sounds.Purr, "/Users/me/Sounds/my-sound.wav") // play 'Purr' when test completes successfully 
                     // or the wav file 'my-sound' when it fails 
1

有一个growler plugin它调用与测试结果的咆哮/通知。这会让你知道该怎么做。否则,自定义任务也会起作用。

1

我用简单的bash命令:

sbt compile && say "Finish" 

如果你想通知,即使失败了,通过

sbt compile; say "Finish" 
+4

这个优点是你可以再睡一会儿,因为每次都会让你的启动延迟:p –