From 5d32950cd5ce133843c591690143b67e5d6eb64f Mon Sep 17 00:00:00 2001 From: Thomas Lenz Date: Wed, 15 Apr 2020 12:39:00 +0200 Subject: update gradle to 5.6.4 and update some build steps to this new version --- pdf-as-web/build.gradle | 134 ++++++++++++++++++++++++++---------------------- 1 file changed, 73 insertions(+), 61 deletions(-) (limited to 'pdf-as-web') diff --git a/pdf-as-web/build.gradle b/pdf-as-web/build.gradle index 164925ad..19b7c73b 100644 --- a/pdf-as-web/build.gradle +++ b/pdf-as-web/build.gradle @@ -85,25 +85,27 @@ test { systemProperties 'pdf-as-web.conf': System.getProperty("user.home") + '/.pdfas/pdf-as-web.properties' } -task downloadTomcat << { - if(!project.buildDir.exists()){ - project.buildDir.mkdirs() - } +task downloadTomcat { + doLast { + if(!project.buildDir.exists()){ + project.buildDir.mkdirs() + } - String url = "http://repo1.maven.org/maven2/org/apache/tomcat/tomcat/##VERSION##/tomcat-##VERSION##.zip" - String filename = project.buildDir.toString() + "/tomcat-##VERSION##.zip"; + String url = "http://repo1.maven.org/maven2/org/apache/tomcat/tomcat/##VERSION##/tomcat-##VERSION##.zip" + String filename = project.buildDir.toString() + "/tomcat-##VERSION##.zip"; - url = url.replaceAll("##VERSION##", project.tomcatVersion); - filename = filename.replaceAll("##VERSION##", project.tomcatVersion); + url = url.replaceAll("##VERSION##", project.tomcatVersion); + filename = filename.replaceAll("##VERSION##", project.tomcatVersion); - println "Tomcat Version: " + url + println "Tomcat Version: " + url - println "Tomcat file: " + filename + println "Tomcat file: " + filename - def f = new File(filename) - if (!f.exists()) { - println "Downloading Tomcat ..." - new URL(url).withInputStream{ i -> f.withOutputStream{ it << i }} + def f = new File(filename) + if (!f.exists()) { + println "Downloading Tomcat ..." + new URL(url).withInputStream{ i -> f.withOutputStream{ it << i }} + } } } @@ -126,68 +128,78 @@ task extractTomcat(dependsOn: downloadTomcat, type: Copy) { def deployVersions=['','-pdfbox1'] -task copyTomcat(dependsOn: extractTomcat)<<{ - deployVersions.each{ - String targetDir = project.buildDir.toString() + "/tomcat-##VERSION##"+it; - targetDir = targetDir.replaceAll("##VERSION##", project.tomcatVersion); - println "copiing to "+targetDir - copy{ - with extractTomcat - into targetDir +task copyTomcat(dependsOn: extractTomcat) { + doLast { + deployVersions.each{ + String targetDir = project.buildDir.toString() + "/tomcat-##VERSION##"+it; + targetDir = targetDir.replaceAll("##VERSION##", project.tomcatVersion); + println "copiing to "+targetDir + copy{ + with extractTomcat + into targetDir + } } } } -task cleanWebAppsInTomcat(dependsOn: copyTomcat) << { - deployVersions.each{ - String targetDir = project.buildDir.toString() + "/tomcat-##VERSION##"+it+"/apache-tomcat-##VERSION##/webapps/"; - targetDir = targetDir.replaceAll("##VERSION##", project.tomcatVersion); - - def webappDir = new File(targetDir); - println "Removing: " + webappDir.toString() - def result = webappDir.deleteDir() // Returns true if all goes well, false otherwise. - println result.toString() - - assert result - - webappDir.mkdirs() +task cleanWebAppsInTomcat(dependsOn: copyTomcat) { + doLast { + deployVersions.each{ + String targetDir = project.buildDir.toString() + "/tomcat-##VERSION##"+it+"/apache-tomcat-##VERSION##/webapps/"; + targetDir = targetDir.replaceAll("##VERSION##", project.tomcatVersion); + + def webappDir = new File(targetDir); + println "Removing: " + webappDir.toString() + def result = webappDir.deleteDir() // Returns true if all goes well, false otherwise. + println result.toString() + + assert result + + webappDir.mkdirs() + } } } -task putTemplateIntoTomcat(dependsOn: cleanWebAppsInTomcat)<<{ - deployVersions.each{ - String source = project.projectDir.toString() + "/"; - - String targetDir = "build/tomcat-##VERSION##"+it+"/apache-tomcat-##VERSION##"; - targetDir = targetDir.replaceAll("##VERSION##", project.tomcatVersion); - copy{ - from "src/main/assembly/tomcat" - into targetDir +task putTemplateIntoTomcat(dependsOn: cleanWebAppsInTomcat) { + doLast { + deployVersions.each{ + String source = project.projectDir.toString() + "/"; + + String targetDir = "build/tomcat-##VERSION##"+it+"/apache-tomcat-##VERSION##"; + targetDir = targetDir.replaceAll("##VERSION##", project.tomcatVersion); + copy{ + from "src/main/assembly/tomcat" + into targetDir + } } } } -task putConfigIntoTomcat(dependsOn: putTemplateIntoTomcat)<<{ - deployVersions.each{ - String source = "../pdf-as-lib/build/resources/main/config/config.zip"; - - String targetDir = "build/tomcat-##VERSION##"+it+"/apache-tomcat-##VERSION##/conf/pdf-as"; - targetDir = targetDir.replaceAll("##VERSION##", project.tomcatVersion); - copy{ - from zipTree(source) - into targetDir +task putConfigIntoTomcat(dependsOn: putTemplateIntoTomcat) { + doLast { + deployVersions.each{ + String source = "../pdf-as-lib/build/resources/main/config/config.zip"; + + String targetDir = "build/tomcat-##VERSION##"+it+"/apache-tomcat-##VERSION##/conf/pdf-as"; + targetDir = targetDir.replaceAll("##VERSION##", project.tomcatVersion); + copy{ + from zipTree(source) + into targetDir + } } } } -task putWebConfigIntoTomcat(dependsOn: putConfigIntoTomcat)<<{ - deployVersions.each{ - String targetDir = "build/tomcat-##VERSION##"+it+"/apache-tomcat-##VERSION##/conf/pdf-as"; - targetDir = targetDir.replaceAll("##VERSION##", project.tomcatVersion); - - copy{ - from 'src/main/configuration/' - into targetDir +task putWebConfigIntoTomcat(dependsOn: putConfigIntoTomcat) { + doLast { + deployVersions.each{ + String targetDir = "build/tomcat-##VERSION##"+it+"/apache-tomcat-##VERSION##/conf/pdf-as"; + targetDir = targetDir.replaceAll("##VERSION##", project.tomcatVersion); + + copy{ + from 'src/main/configuration/' + into targetDir + } } } } -- cgit v1.2.3