I have searched extensively, but likely due to the newness of Android Studio and Gradle. I haven\'t found any description of how to do this. I want to do basically exactly
Define simple function in gradle file:
def getVersion(){ def out = new ByteArrayOutputStream(); exec { executable = 'git' args = ['describe', '--tags'] standardOutput = out } return out.toString().replace('\n','') }
Use it:
project.version = getVersion()