Last active
August 4, 2016 21:15
-
-
Save Mistic92/bc3d6a39701d145f650de94cdcd9e282 to your computer and use it in GitHub Desktop.
Script to copy .apk and mapping file to /deploy/v+versionCode+versionName location. Helps to save apk with corresponding mapping file.
This file contains hidden or 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
android { | |
applicationVariants.all { variant -> | |
def apk | |
def deployPath | |
variant.outputs.each { output -> | |
if (output.outputFile?.name?.contains('release')) { | |
apk = output.outputFile | |
} | |
} | |
if (variant.getBuildType().isMinifyEnabled()) { | |
variant.assemble.doLast { | |
copy { | |
from variant.mappingFile | |
from apk | |
deployPath = "${rootDir}/deploy/v" + variant.versionCode + '_' + variant.versionName | |
println deployPath | |
into deployPath | |
} | |
if (System.properties['os.name'].toLowerCase().contains('windows')) { | |
deployPath = deployPath.replaceAll("/", "\\\\") | |
Runtime.getRuntime().exec("explorer.exe " + deployPath); | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment