Build a properties file from command line

(Ameiurus Melas) #1

I’d like to make a task that creates a build properties file from command line utilities. This is my best attempt:

task versionInfo(type:Exec){
    def props = new Properties()
    File propsFile = new File('assets/')
    commandLine 'hg id -i -b -t'.split()
    standardOutput = new ByteArrayOutputStream()
    props.setProperty('build.revision', standardOutput.toString() )
    commandLine 'powershell get-date'.split() // -format "{dd-MM-yyyy HH:mm}"'
    props.setProperty('', standardOutput.toString() ), null)
    /*ext.versionfile = new File('assets/')

    doLast {
        versionfile.text = 'build.revision=' + standardOutput.toString() + ''

Which don’t work as intented… Any help is appreciated, thanks! :slight_smile: