Skip to content

Instantly share code, notes, and snippets.

@vcarmen
Created November 26, 2018 21:39
Show Gist options
  • Save vcarmen/6d5cdc8fc2de4b7ada25d6795cebe995 to your computer and use it in GitHub Desktop.
Save vcarmen/6d5cdc8fc2de4b7ada25d6795cebe995 to your computer and use it in GitHub Desktop.
//task to update file content
task updateBuildNum {
def productVersion="1.2.3.0"
def buildNum="1.2.3.4521"
String contents = new File( '/tmp/dir/BuildNum.plist' ).getText( 'UTF-8' )
contents = contents.replaceAll( 'version = "0.0.0.0"', 'version = '+'"'+"${productVersion}"+'"')
contents = contents.replaceAll( 'buildNum = "0.0.0.0"', 'buildNum = '+'"'+"${buildNum}"+'"')
new File( 'build/BuildNum.plist' ).write( contents, 'UTF-8' )
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment