From b2d145df57a10699b722d8fe84a759e43f0375c7 Mon Sep 17 00:00:00 2001 From: Yves Fischer Date: Tue, 22 Dec 2015 16:34:33 +0100 Subject: use org.xapek.yvesf : gradle-download-task --- build.gradle | 36 ++++++++++--- buildSrc/build.gradle | 7 --- .../src/main/groovy/buildSrc/DownloadTask.groovy | 61 ---------------------- packages/grails3/build.gradle | 4 +- packages/gwt-chromium/build.gradle | 8 +-- packages/idea-iu/build.gradle | 4 +- packages/scheme2ddl/build.gradle | 4 +- 7 files changed, 42 insertions(+), 82 deletions(-) delete mode 100644 buildSrc/build.gradle delete mode 100644 buildSrc/src/main/groovy/buildSrc/DownloadTask.groovy diff --git a/build.gradle b/build.gradle index 816e98a..a57e331 100644 --- a/build.gradle +++ b/build.gradle @@ -1,3 +1,13 @@ +buildscript { + repositories { + mavenLocal() + mavenCentral() + } + dependencies { + classpath 'org.xapek.yvesf:gradle-download-task:0.1-SNAPSHOT' + } +} + plugins { id "nebula.ospackage" version "3.2.0" } @@ -12,25 +22,26 @@ ext { } allprojects { - configurations { sshAntTask } + configurations { + sshAntTask + } repositories { + mavenLocal() mavenCentral() } - dependencies { sshAntTask 'org.apache.ant:ant-jsch:1.9.2' } + dependencies { + sshAntTask 'org.apache.ant:ant-jsch:1.9.2' + } +} - ant.taskdef( - name: 'scp', - classname: 'org.apache.tools.ant.taskdefs.optional.ssh.Scp', - classpath: configurations.sshAntTask.asPath) +task rebuildRepositoryIndex() << { ant.taskdef( name: 'ssh', classname: 'org.apache.tools.ant.taskdefs.optional.ssh.SSHExec', classpath: configurations.sshAntTask.asPath) -} -task rebuildRepositoryIndex() << { ant.ssh(host: sshHost, username: sshUser, keyfile: file(sshKeyfile), @@ -47,6 +58,11 @@ subprojects { def buildDeb = project.getTasks().getByName('buildDeb') task upload() << { + ant.taskdef( + name: 'scp', + classname: 'org.apache.tools.ant.taskdefs.optional.ssh.Scp', + classpath: configurations.sshAntTask.asPath) + ant.scp(file: new File(project.buildDir, "distributions/${buildDeb.assembleArchiveName()}"), todir: "${sshUser}@${sshHost}:${sshTargetDir}", keyfile: file(sshKeyfile), @@ -54,4 +70,8 @@ subprojects { verbose: true) } upload.dependsOn(buildDeb) + + ospackage { + release new Date().format("yMd-hms") + } } diff --git a/buildSrc/build.gradle b/buildSrc/build.gradle deleted file mode 100644 index 17d9385..0000000 --- a/buildSrc/build.gradle +++ /dev/null @@ -1,7 +0,0 @@ -repositories { - mavenCentral() -} - -dependencies { - compile 'commons-codec:commons-codec:1.10' -} diff --git a/buildSrc/src/main/groovy/buildSrc/DownloadTask.groovy b/buildSrc/src/main/groovy/buildSrc/DownloadTask.groovy deleted file mode 100644 index 1a49dd5..0000000 --- a/buildSrc/src/main/groovy/buildSrc/DownloadTask.groovy +++ /dev/null @@ -1,61 +0,0 @@ -package buildSrc - -import org.apache.commons.codec.binary.Hex -import org.gradle.api.DefaultTask -import org.gradle.api.tasks.* - -import java.security.MessageDigest - -class DownloadTask extends DefaultTask { - @OutputFile - File destFile - - @Input - URL source - - String sha256sum - - void setSource(URL url) { - this.@source = url - if (destFile == null) { - final basename = url.path.substring(url.path.lastIndexOf('/') + 1) - destFile = new File(project.buildDir, basename) - } - } - - void source(URL url) { - setSource(url) - } - - void source(String sourceUrl) { - source new URL(sourceUrl) - } - - void sha256sum(String sha256sum) { - this.@sha256sum = sha256sum - } - - private void checkSha256Sum(File file, String sum) { - final md = MessageDigest.getInstance('SHA-256') - final digestBytes = md.digest(file.bytes) - final digestHex = Hex.encodeHexString(digestBytes) - if (digestHex != sum) { - throw new TaskExecutionException(this, - new Exception("Checksum mismatch, expected ${sum} got ${digestHex}")) - } - } - - @TaskAction - void doExecute() { - final tempFile = new File(destFile.path + '_download') - project.logger.info("Download ${source} to ${tempFile}") - ant.get(src: source, dest: tempFile, verbose: true) - - if (sha256sum) { - checkSha256Sum(tempFile, sha256sum) - } - - project.logger.info("Rename downloaded ${tempFile} to ${destFile}") - ant.rename(src: tempFile, dest: destFile) - } -} \ No newline at end of file diff --git a/packages/grails3/build.gradle b/packages/grails3/build.gradle index 60473e0..c120cda 100644 --- a/packages/grails3/build.gradle +++ b/packages/grails3/build.gradle @@ -1,6 +1,8 @@ +import org.xapek.yvesf.gradle.DownloadTask + version '3.0.10' -task download(type: buildSrc.DownloadTask) { +task download(type: DownloadTask) { source "https://github.com/grails/grails-core/releases/download/v${project.version}/grails-${project.version}.zip" sha256sum '5ee27a571bee73072505f2c3af52a8c12f2749113e9791cbc1c695ecb7a8ec2d' } diff --git a/packages/gwt-chromium/build.gradle b/packages/gwt-chromium/build.gradle index 5b3c467..ce0ec6a 100644 --- a/packages/gwt-chromium/build.gradle +++ b/packages/gwt-chromium/build.gradle @@ -1,8 +1,10 @@ +import org.xapek.yvesf.gradle.DownloadTask + //chrome nightly build, one of the last with npapi final revision = '242519' version "34-r${revision}" -task downloadChrome(type: buildSrc.DownloadTask) { +task downloadChrome(type: DownloadTask) { source "http://gsdview.appspot.com/chromium-browser-continuous/Linux_x64/${revision}/chrome-linux.zip" sha256sum '7269d35b51fb16ebd11af92cdaba933fb73f8984949952888e30fab63dc78df8' } @@ -13,14 +15,14 @@ task unpackChrome(type: Copy) { } unpackChrome.dependsOn(downloadChrome) -task downloadGwtPlugin(type: buildSrc.DownloadTask) { +task downloadGwtPlugin(type: DownloadTask) { source 'https://clients2.googleusercontent.com/crx/blobs/QgAAAC6zw0qH2DJtnXe8Z7rUJP3brylTnXsqSLH8EJLp' + 'Cpq2560pdQWMapnnCQsWYAxwMN2Pa2mZkH4aA9in1i3WTJKG0OUyFhe7lScnMNxhS1yjAMZSmuVxRW6MIEDyZkO8bJcfTSNy6GZA2g/' + 'extension_1_0_11357.crx' sha256sum '5716f39ca4dadb47f571f65f631a00854487971f42ad24aa3a36a99e78d33134' } -task downloadPdfPlugin(type: buildSrc.DownloadTask) { +task downloadPdfPlugin(type: DownloadTask) { source 'https://clients2.googleusercontent.com/crx/blobs/QgAAAC6zw0qH2DJtnXe8Z7rUJP2i3UKpz0eTiopC2Qlk_FXWm-wYwG' + 'N2MPtjDt7LaoCfAScKzPva1bZi2q-9pYXZOibTl1nwFns1ZGCCvKGnyPQ0AMZSmuVlD6-IvZI2Yaw8Sj800M072EC85w/'+ 'extension_1_1_527.crx' diff --git a/packages/idea-iu/build.gradle b/packages/idea-iu/build.gradle index 5ea9000..74c51d8 100644 --- a/packages/idea-iu/build.gradle +++ b/packages/idea-iu/build.gradle @@ -1,6 +1,8 @@ +import org.xapek.yvesf.gradle.DownloadTask + version '14.1.5' -task download(type: buildSrc.DownloadTask) { +task download(type: DownloadTask) { source "https://download.jetbrains.com/idea/ideaIU-${project.version}.tar.gz" sha256sum '1a7a07871e31f8628e17be2b066665a596e758f8' } diff --git a/packages/scheme2ddl/build.gradle b/packages/scheme2ddl/build.gradle index 6ab84aa..a5d9bda 100644 --- a/packages/scheme2ddl/build.gradle +++ b/packages/scheme2ddl/build.gradle @@ -1,6 +1,8 @@ +import org.xapek.yvesf.gradle.DownloadTask + version '2.3.12' -task downloadFiles(type: buildSrc.DownloadTask) { +task downloadFiles(type: DownloadTask) { source "https://bintray.com/artifact/download/qwazer/maven/com/googlecode/" + "scheme2ddl/${project.version}/scheme2ddl-${project.version}.jar" sha256sum '31b0627cfabca76cc38a4f32f5e7e1cc31979ec9e9eaf45243514d1306e96ccd' -- cgit v1.2.1