2017-04-22 40 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 –