Skip to content

Instantly share code, notes, and snippets.

@EminYahyayev
Created August 31, 2015 21:50
Show Gist options
  • Save EminYahyayev/9e63de9c96e4cd097dbc to your computer and use it in GitHub Desktop.
Save EminYahyayev/9e63de9c96e4cd097dbc to your computer and use it in GitHub Desktop.
Gradle: packs the project
task copyApkForZip(type: Copy) {
from 'build/outputs/apk'
into '../apk'
include '**/app-release.apk'
}
task zipBackup(type: Zip) {
dependsOn "copyApkForZip"
from('../'){
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