Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Gradle: packs the project
task copyApkForZip(type: Copy) {
from 'build/outputs/apk'
into '../apk'
include '**/app-release.apk'
task zipBackup(type: Zip) {
dependsOn "copyApkForZip"
exclude "**/build"
exclude "**/.gradle"
exclude "**/gradle"
exclude "**/captures"
exclude "**/backups"
exclude "**/*backupzip*"
baseName = "backupzip" + getDate()
task moveBackup(type: Copy) {
dependsOn "zipBackup"
from 'build/distributions'
into '../backups'
include '**/backupzip*'
doLast {
project.delete "build/distributions"
project.delete "../apk"
task moveBackup(type: Copy) {
description "Reduces in size and packs the project"
tasks = [":moveBackup"]
def getDate() {
def date = new Date()
def formattedDate = date.format('yyyyMMddHHmmss')
return formattedDate
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment