Created
July 5, 2013 07:39
-
-
Save aliencode/5932715 to your computer and use it in GitHub Desktop.
Gradle - 解析Exec的输出结果
Exec DSL调用方法
This file contains 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
task svninfo << { | |
new ByteArrayOutputStream().withStream { os -> | |
def result = exec { | |
executable = 'svn' | |
args = ['info'] | |
standardOutput = os | |
} | |
def outputAsString = os.toString() | |
def matchLastChangedRev = outputAsString =~ /Last Changed Rev: (\d+)/ | |
println "Latest Changed Revision #: ${matchLastChangedRev[0][1]}" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment