Skip to content

Instantly share code, notes, and snippets.

@sergii-frost
Created December 9, 2014 09:26
Show Gist options
  • Save sergii-frost/4249ad9f011646bc6d8c to your computer and use it in GitHub Desktop.
Save sergii-frost/4249ad9f011646bc6d8c to your computer and use it in GitHub Desktop.
build.grade file with HockeyApp plugin configuration and helpful groovy method to get git notes
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:1.0.0'
classpath 'de.felixschulze.gradle:gradle-hockeyapp-plugin:2.4'
}
}
/**
* Get latest notes from git to use for build upload
* By default if not specified, last 3 commits log will be used
*
* @return String If param -PuploadNotes is present then return String values or default value
*/
def getUploadNotesParam = { ->
//Default value: prettified last 3 commits log
def git_notes = ['git', 'log', '-3' ,'--pretty=format:\"%h by %an, %aD %n| Message: >>%s<<%n\"']
def notes = project.hasProperty('uploadNotes') ? uploadNotes : git_notes.execute().in.text
println "Upload Notes are set to $notes"
return notes
}
apply plugin: 'com.android.application'
apply plugin: 'hockeyApp'
hockeyapp {
apiToken = "YOUR_HOCKEY_APP_TOKEN"
notify = 1 //to notify all testers that can install this app
status = 2 //to make the version available for download
tags = 'your-project-tag'
notes = getUploadNotesParam()
}
============
//Gradle then gets additional tasks like:
//HockeyApp tasks
//---------------
//uploadDebugToHockeyApp - Upload 'debug' to HockeyApp
//uploadReleaseToHockeyApp - Upload 'release' to HockeyApp
//FurtherUsage from command line will be like:
//./gradlew clean build uploadDebugToHockeyApp
//./gradlew clean build uploadDebugToHockeyApp -PuploadNotes="Foo Bar"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment