Created
June 7, 2017 16:00
-
-
Save tsengvn/0e299c324c2e3325ef0bde723d8b6c38 to your computer and use it in GitHub Desktop.
custom output file
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
def getCommitId = { -> | |
def hashStdOut = new ByteArrayOutputStream() | |
exec { | |
commandLine "git", "rev-parse", "--short", "HEAD" | |
standardOutput = hashStdOut | |
} | |
return hashStdOut.toString().trim() | |
} | |
task createReleaseBuild { | |
doLast{ | |
def outputFolder = new File(rootDir.absolutePath, "output") | |
// def tag = rootProject.ext.get("version_name") | |
def tag = getCommitId() | |
println outputFolder.absolutePath | |
delete fileTree(outputFolder.absolutePath) { | |
include '**/*.apk' | |
} | |
copy { | |
into(outputFolder.absolutePath) | |
from(projectDir.absolutePath+'/build/outputs/apk/app-prod-normal-release.apk') { | |
rename 'app-prod-normal-release.apk', 'taus_prod_'+ tag +'.apk' | |
} | |
} | |
copy { | |
into(outputFolder.absolutePath) | |
from(projectDir.absolutePath+'/build/outputs/apk/app-prod-proof-release.apk') { | |
rename 'app-prod-proof-release.apk', 'taus_prod_proof_'+ tag +'.apk' | |
} | |
} | |
} | |
} | |
tasks.whenTaskAdded { task -> | |
if (task.name == 'assembleRelease') { | |
createReleaseBuild.dependsOn task | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment