Factor out recurring pattern of MD5 checksum + stamp file

This commit is contained in:
Ben Liblit 2018-01-17 21:36:53 -06:00
parent 2c1bc5c52c
commit 60870d7231
7 changed files with 26 additions and 27 deletions

2
.gitignore vendored
View File

@ -1,3 +1,4 @@
**/.gradle/
*.DS_Store
*.class
*.out
@ -10,7 +11,6 @@
.metadata/
.project
/*/.settings/org.eclipse.buildship.core.prefs
/.gradle/
/.settings/org.eclipse.buildship.core.prefs
/build/
com.ibm.wala.cast.java.jdt.test/

View File

@ -5,7 +5,7 @@
plugins {
id 'com.github.hauner.jarTest' version '1.0.1' apply false
id 'de.undercouch.download' version '3.3.0' apply false
id 'de.undercouch.download' apply false
id 'nebula.lint' version '8.3.1'
}

7
buildSrc/build.gradle Normal file
View File

@ -0,0 +1,7 @@
repositories {
mavenCentral()
}
dependencies {
compile 'de.undercouch:gradle-download-task:3.3.0'
}

View File

@ -0,0 +1,12 @@
////////////////////////////////////////////////////////////////////////
//
// helper task for checksum-verified downloads
//
class VerifyWithStamp extends de.undercouch.gradle.tasks.download.Verify {
VerifyWithStamp() {
def stamp = new File(temporaryDir, 'stamp')
outputs.file stamp
doLast { stamp.text = '' }
}
}

View File

@ -17,13 +17,9 @@ task downloadJLex(type: Download) {
overwrite false
}
task verifyJLex(type: Verify, dependsOn: downloadJLex) {
// TODO: refactor this logic into a reusable custom task class
task verifyJLex(type: VerifyWithStamp, dependsOn: downloadJLex) {
src downloadJLex.dest
checksum 'fe0cff5db3e2f0f5d67a153cf6c783af'
def stamp = new File(temporaryDir, 'stamp')
outputs.file stamp
doLast { stamp.text = '' }
}
clean {

View File

@ -12,13 +12,9 @@ task downloadAjaxslt(type: Download) {
overwrite false
}
task verifyAjaxslt(type: Verify, dependsOn: downloadAjaxslt) {
// TODO: refactor this logic into a reusable custom task class
task verifyAjaxslt(type: VerifyWithStamp, dependsOn: downloadAjaxslt) {
src files(downloadAjaxslt)[0]
checksum 'c995abe3310a401bb4db7f28a6409756'
def stamp = new File(temporaryDir, 'stamp')
outputs.file stamp
doLast { stamp.text = '' }
}
task unpackAjaxslt(type: Sync, dependsOn: verifyAjaxslt) {

View File

@ -27,13 +27,9 @@ task downloadBcel(type: Download) {
overwrite false
}
task verifyBcel(type: Verify, dependsOn: downloadBcel) {
// TODO: refactor this logic into a reusable custom task class
task verifyBcel(type: VerifyWithStamp, dependsOn: downloadBcel) {
src files(downloadBcel)[0]
checksum '19bffd7f217b0eae415f1ef87af2f0bc'
def stamp = new File(temporaryDir, 'stamp')
outputs.file stamp
doLast { stamp.text = '' }
}
task extractBcel(type: Sync, dependsOn: verifyBcel) {
@ -63,13 +59,9 @@ task downloadJavaCup(type: Download) {
clean { delete downloadJavaCup }
}
task verifyJavaCup(type: Verify, dependsOn: downloadJavaCup) {
// TODO: refactor this logic into a reusable custom task class
task verifyJavaCup(type: VerifyWithStamp, dependsOn: downloadJavaCup) {
src files(downloadJavaCup)[0]
checksum '2bda8c40abd0cbc295d3038643d6e4ec'
def stamp = new File(temporaryDir, 'stamp')
outputs.file stamp
doLast { stamp.text = '' }
}
extraBundledJars.dependsOn verifyJavaCup
@ -106,13 +98,9 @@ task downloadOcamlJava(type: Download) {
overwrite false
}
task verifyOcamlJava(type: Verify, dependsOn: downloadOcamlJava) {
// TODO: refactor this logic into a reusable custom task class
task verifyOcamlJava(type: VerifyWithStamp, dependsOn: downloadOcamlJava) {
src downloadOcamlJava.outputFiles[0]
checksum '45feec6e3889f5073a39c2c4c84878d1'
def stamp = new File(temporaryDir, 'stamp')
outputs.file stamp
doLast { stamp.text = '' }
}
task unpackOcamlJava(type: Sync, dependsOn: verifyOcamlJava) {