Is there a simple way to write to file the mercurial version (or similar external command) in a gradle task:
I’m not yet groovy/gradle conversant, but my current effort looks like this:
task versionInfo(type:Exec){
commandLine 'hg id -i -b -t'
ext.versionfile = new File('bin/$baseName-buildinfo.properties')
doLast {
versionfile.text = 'build.revision=' + standardOutput.toString()
}
}
There are two issues with this build script:
hg id -i -b tinstead ofhgwith argumentsid,-i,-bandtByteOutputStreamto be read laterTry this: