Skip to content

Instantly share code, notes, and snippets.

@nikolauskrismer
Last active June 4, 2018 11:11
Show Gist options
  • Save nikolauskrismer/54f3c1e14f6c26ce52ca179a8ef8a876 to your computer and use it in GitHub Desktop.
Save nikolauskrismer/54f3c1e14f6c26ce52ca179a8ef8a876 to your computer and use it in GitHub Desktop.
Includes checkstyle_nkr.xml configuration file
/*
* Version handling checkstyke_nkrchecks.xml download
*/
apply plugin: 'checkstyle'
checkstyle {
configFile = file("${buildDir}/checkstyle.xml")
ignoreFailures = true
showViolations = false
toolVersion = '+'
}
tasks.withType(Checkstyle) {
it.dependsOn 'downloadCheckstyleConfig'
}
task downloadCheckstyleConfig(type: DownloadFileTask) {
description = 'Download checkstyle configuration file'
url = 'https://gist.github.com/nikolauskrismer/10e3fd728ddac0afa55405a3fa13dca9/raw/'
destinationFile = checkstyle.configFile
}
class DownloadFileTask extends DefaultTask {
@Input
String url
@OutputFile
File destinationFile
@TaskAction
def downloadFile() {
destinationFile.bytes = new URL(url).bytes
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment