Created
August 26, 2018 02:09
-
-
Save undownding/0a7f135c512ca294f8f136c8147f49d4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
applicationVariants.all { variant -> | |
if (variant.buildType.name == 'release') { | |
variant.outputs.each { output -> | |
def outputFile = output.outputFile | |
if (outputFile != null && outputFile.name.endsWith('.apk') && output.zipAlign) { | |
def fileName = "ezbuy_V${defaultConfig.versionName}_${new Date().format("yyyy-MM-dd", TimeZone.getTimeZone("UTC"))}_signature.apk" | |
output.outputFile = new File(outputFile.parent, fileName) | |
} | |
} | |
} else { // buildType -> debug | |
def buildNumber = System.getenv("BUILD_NUMBER") | |
def jenkinsBuild = buildNumber != null ? buildNumber : "0" | |
if (jenkinsBuild != '0') { | |
variant.outputs.each { output -> | |
def outputFile = output.outputFile | |
if (outputFile != null && outputFile.name.endsWith('.apk') && output.zipAlign) { | |
def fileName = "ezbuy-v${defaultConfig.versionName}-${variant.buildType.name}-jenkins-${jenkinsBuild}.apk" | |
output.outputFile = new File(outputFile.parent, fileName) | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment