Jisort/artifacts.gradle

27 строки
1.1 KiB
Groovy

android.applicationVariants.all { variant ->
def appName
//Check if an applicationName property is supplied; if not use the name of the parent project.
if (project.hasProperty("applicationName")) {
appName = applicationName
} else {
appName = parent.name
}
variant.outputs.each { output ->
def newApkName
// Removes the -unaligned tag from the APK file name if ZipAlign is enabled
if (variant.buildType.zipAlignEnabled) {
newApkName = "${appName}-${output.baseName}-${variant.versionName}.apk"
} else {
newApkName = "${appName}-${output.baseName}-${variant.versionName}-unaligned.apk"
}
// Remove versioning information if the build type is "latest"
// Used for Travis & S3 deployment, it prevents us from having to
// clean up old builds on S3 by just overwriting the same file name.
if (output.baseName.equals("latest")) {
newApkName = "${appName}-${output.baseName}.apk"
}
output.outputFile = new File(output.outputFile.parent, newApkName)
}
}