Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@brettwold
Last active June 15, 2016 12:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save brettwold/89939fe171e8698a65ca95365a806f1e to your computer and use it in GitHub Desktop.
Save brettwold/89939fe171e8698a65ca95365a806f1e to your computer and use it in GitHub Desktop.
Add SemVer version number to main android artifact
android.libraryVariants.all { variant ->
def appName
if (project.hasProperty("applicationName")) {
appName = applicationName
} else {
appName = parent.name
}
variant.outputs.each { output ->
def newApkName = "${appName}-${output.baseName}-${version}.aar"
output.outputFile = new File(output.outputFile.parent, newApkName)
}
}
android.applicationVariants.all { variant ->
def appName
if (project.hasProperty("applicationName")) {
appName = applicationName
} else {
appName = parent.name
}
variant.outputs.each { output ->
def newApkName
if (output.zipAlign) {
newApkName = "${appName}-${output.baseName}-${variant.versionName}.apk"
} else {
newApkName = "${appName}-${output.baseName}-${variant.versionName}-unaligned.apk"
}
output.outputFile = new File(output.outputFile.parent, newApkName)
}
}
apply from: "../artifacts.gradle"
ext.applicationName="MyAwesomeApplication"
group = "com.awesome"
version = "1.2.3"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment