Created
June 5, 2012 06:14
-
-
Save kyonmm/2873062 to your computer and use it in GitHub Desktop.
Gradle + Mercurial + Windowsな環境で保存->ビルド->コミットまでこなします。 基本的には「トピックブランチに移動->本スクリプトを起動->開発->本スクリプトを終了->コミットを整理->ブランチをマージ」とします。gradleのタスク実行はdefaultTaskが実行されるようになっているので、build.gradleのdefaultTasksを設定するか、def p = "cmd /c gradle"のあとに起動したいタスクを指定します。基本的にはUnit Testなタスク
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def root = new File("./src/") | |
println root.absolutePath | |
lastmodified = [:] | |
current = [:] | |
while(true){ | |
current.clear() | |
root.eachFileRecurse { | |
current << ["${it.absolutePath}":it.lastModified()] | |
} | |
if(!current.equals(lastmodified)){ | |
println "build" | |
def p = "cmd /c gradle".execute() | |
p.inputStream.eachLine("UTF-8"){ | |
println it | |
} | |
int i = p.waitFor() | |
if(i == 0){ | |
green = "cmd /c hg ci -A -m build_success".execute() | |
green.inputStream.eachLine("SJIS"){ | |
println it | |
} | |
green.errorStream.eachLine("SJIS"){ | |
println it | |
} | |
greeni = green.waitFor() | |
} | |
else{ | |
red = "cmd /c hg ci -A -m build_fail".execute() | |
red.inputStream.eachLine("SJIS"){ | |
println it | |
} | |
red.errorStream.eachLine("SJIS"){ | |
println it | |
} | |
redi = red.waitFor() | |
} | |
lastmodified.putAll(current) | |
} | |
sleep(1000) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment