ぼくのビルドはにゃあとなく

potatotips7で「ぼくのビルドはにゃあとなく」というタイトルでLTしました。

私以外の発表スライドはこちらから見れます... potatotips 7 · potatotips/potatotips Wiki
https://github.com/potatotips/potatotips/wiki/potatotips-7

http://www.slideshare.net/tomorrowkey/ss-34718053

時間がない人向けに簡単に説明すると

Gradleビルドの完了をフックして、ネコの鳴き声を再生するというデモでした。 これを使えばいつもマルチタスクで忙しいあなたもビルド完了に気づくことができます!

android.applicationVariants.all { variant ->
  if (variant.install != null) {
    variant.install.doLast {
      String url = "http://example.com/meow.mp3";
      String path = "${project.buildDir}/finish_sound"
 
      def file = new File(path)
      if(!file.exists()) {
          new URL(url).withInputStream { input ->
          file.bytes = input.bytes
        }
      }
      
      ['afplay', path].execute()
    }
  }
}

※ネコの鳴き声は別途ダウンロードしてきてください。

ネコの鳴き声が嫌だったらビープ音にすることもできるので、職場でネコの鳴き声が聞こえるなんて恥ずかしい!!って人でも安心です。

ぜひご活用ください。