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 --- build.gradle | 95 +++++++++-------- gradle/wrapper/gradle-wrapper.jar | Bin 51017 -> 55627 bytes gradle/wrapper/gradle-wrapper.properties | 3 +- gradlew | 78 +++++++------- gradlew.bat | 14 +-- pdf-as-cli/build.gradle | 55 +++++----- pdf-as-lib/src/main/resources/config/config.zip | Bin 1276622 -> 1276718 bytes pdf-as-tests/build.gradle | 16 +-- pdf-as-web/build.gradle | 134 +++++++++++++----------- 9 files changed, 208 insertions(+), 187 deletions(-) diff --git a/build.gradle b/build.gradle index b7a6111d..04f71de0 100644 --- a/build.gradle +++ b/build.gradle @@ -5,16 +5,18 @@ buildscript { } dependencies { - classpath 'com.github.ben-manes:gradle-versions-plugin:0.11.3' + classpath "com.github.ben-manes:gradle-versions-plugin:0.28.0" } } +/* task wrapper(type: Wrapper) { - gradleVersion = '2.5' + gradleVersion = '5.6.4' } +*/ allprojects { - apply plugin: 'com.github.ben-manes.versions' + apply plugin: "com.github.ben-manes.versions" repositories { mavenCentral() } version = '4.1.6-RC' } @@ -27,19 +29,21 @@ dependencies { cveCheck 'org.owasp:dependency-check-ant:1.2.5' } -task checkCVE << { - // Redefine checkCVEAnt Ant task, with the classpath property set to our newly defined - // cveCheck configuration classpath. - ant.taskdef(name: 'checkCVEAnt', classname: 'org.owasp.dependencycheck.taskdefs.DependencyCheckTask', - classpath: configurations.cveCheck.asPath) +task checkCVE { + doLast { + // Redefine checkCVEAnt Ant task, with the classpath property set to our newly defined + // cveCheck configuration classpath. + ant.taskdef(name: 'checkCVEAnt', classname: 'org.owasp.dependencycheck.taskdefs.DependencyCheckTask', + classpath: configurations.cveCheck.asPath) - // executing checkCVEAnt Task - ant.checkCVEAnt( - applicationname: "PDF-AS", - reportoutputdirectory: (new File(rootDir, 'releases/cvecheck/' + project.name)).toString(), - reportformat: "ALL") { - fileset(dir: (new File(rootDir, 'build/alldependencies')).toString()) { - include(name: '**/**') + // executing checkCVEAnt Task + ant.checkCVEAnt( + applicationname: "PDF-AS", + reportoutputdirectory: (new File(rootDir, 'releases/cvecheck/' + project.name)).toString(), + reportformat: "ALL") { + fileset(dir: (new File(rootDir, 'build/alldependencies')).toString()) { + include(name: '**/**') + } } } } @@ -81,7 +85,7 @@ subprojects { revision = getCheckedOutGitCommitHash() //tomcatVersion = '7.0.54'; tomcatVersion = '8.0.36'; - slf4jVersion = '1.7.7' + slf4jVersion = '1.7.30' cxfVersion = '3.0.1' } @@ -99,19 +103,21 @@ subprojects { rootProject.checkCVE.dependsOn copyDeps - task checkCVELocal << { - // Redefine checkCVEAnt Ant task, with the classpath property set to our newly defined - // cveCheck configuration classpath. - ant.taskdef(name: 'checkCVEAnt', classname: 'org.owasp.dependencycheck.taskdefs.DependencyCheckTask', - classpath: configurations.cveCheck.asPath) - - // executing checkCVEAnt Task - ant.checkCVEAnt( - applicationname: project.name, - reportoutputdirectory: (new File(rootDir, 'releases/' + version + '/cvecheck/' + project.name)).toString(), - reportformat: "ALL") { - fileset(dir: 'build/alldependencies') { - include(name: '**/**') + task checkCVELocal { + doLast { + // Redefine checkCVEAnt Ant task, with the classpath property set to our newly defined + // cveCheck configuration classpath. + ant.taskdef(name: 'checkCVEAnt', classname: 'org.owasp.dependencycheck.taskdefs.DependencyCheckTask', + classpath: configurations.cveCheck.asPath) + + // executing checkCVEAnt Task + ant.checkCVEAnt( + applicationname: project.name, + reportoutputdirectory: (new File(rootDir, 'releases/' + version + '/cvecheck/' + project.name)).toString(), + reportformat: "ALL") { + fileset(dir: 'build/alldependencies') { + include(name: '**/**') + } } } } @@ -125,7 +131,10 @@ subprojects { } } - task(internalRelease) << { + task(internalRelease) { + doLast { + + } } internalRelease.dependsOn jar @@ -143,22 +152,24 @@ subprojects { } -task(doFullRelease) << { - println "done building all distribution stuff for " + project.version +task(doFullRelease) { + doLast { + println "done building all distribution stuff for " + project.version + } } -task copyLicenses<<{ - mkdir("releases/"+ version +"/licenses"); - def target = project.projectDir.toString() + "/releases/" + version + "/licenses" - subprojects{ - def src=project.projectDir.toString() + "/licenses" - copy{ - from src - into target +task copyLicenses { + doLast { + mkdir("releases/"+ version +"/licenses"); + def target = project.projectDir.toString() + "/releases/" + version + "/licenses" + subprojects{ + def src=project.projectDir.toString() + "/licenses" + copy{ + from src + into target + } } } - - } task releases(type: Copy) { diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index b7612167..a1347e58 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index b39c395a..4c463175 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,5 @@ -#Mon Jul 25 10:14:49 CEST 2016 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-2.5-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-bin.zip diff --git a/gradlew b/gradlew index 91a7e269..cccdd3d5 100755 --- a/gradlew +++ b/gradlew @@ -1,4 +1,4 @@ -#!/usr/bin/env bash +#!/usr/bin/env sh ############################################################################## ## @@ -6,20 +6,38 @@ ## ############################################################################## -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS="" +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >/dev/null +APP_HOME="`pwd -P`" +cd "$SAVED" >/dev/null APP_NAME="Gradle" APP_BASE_NAME=`basename "$0"` +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS="" + # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD="maximum" -warn ( ) { +warn () { echo "$*" } -die ( ) { +die () { echo echo "$*" echo @@ -30,6 +48,7 @@ die ( ) { cygwin=false msys=false darwin=false +nonstop=false case "`uname`" in CYGWIN* ) cygwin=true @@ -40,31 +59,11 @@ case "`uname`" in MINGW* ) msys=true ;; + NONSTOP* ) + nonstop=true + ;; esac -# For Cygwin, ensure paths are in UNIX format before anything is touched. -if $cygwin ; then - [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"` -fi - -# Attempt to set APP_HOME -# Resolve links: $0 may be a link -PRG="$0" -# Need this for relative symlinks. -while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG=`dirname "$PRG"`"/$link" - fi -done -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >&- -APP_HOME="`pwd -P`" -cd "$SAVED" >&- - CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar # Determine the Java command to use to start the JVM. @@ -90,7 +89,7 @@ location of your Java installation." fi # Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then +if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then MAX_FD_LIMIT=`ulimit -H -n` if [ $? -eq 0 ] ; then if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then @@ -114,6 +113,7 @@ fi if $cygwin ; then APP_HOME=`cygpath --path --mixed "$APP_HOME"` CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + JAVACMD=`cygpath --unix "$JAVACMD"` # We build the pattern for arguments to be converted via cygpath ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` @@ -154,11 +154,19 @@ if $cygwin ; then esac fi -# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules -function splitJvmOpts() { - JVM_OPTS=("$@") +# Escape application args +save () { + for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done + echo " " } -eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS -JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" +APP_ARGS=$(save "$@") + +# Collect all arguments for the java command, following the shell quoting and substitution rules +eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" + +# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong +if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then + cd "$(dirname "$0")" +fi -exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" +exec "$JAVACMD" "$@" diff --git a/gradlew.bat b/gradlew.bat index aec99730..e95643d6 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -8,14 +8,14 @@ @rem Set local scope for the variables with windows NT shell if "%OS%"=="Windows_NT" setlocal -@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS= - set DIRNAME=%~dp0 if "%DIRNAME%" == "" set DIRNAME=. set APP_BASE_NAME=%~n0 set APP_HOME=%DIRNAME% +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS= + @rem Find java.exe if defined JAVA_HOME goto findJavaFromJavaHome @@ -46,10 +46,9 @@ echo location of your Java installation. goto fail :init -@rem Get command-line arguments, handling Windowz variants +@rem Get command-line arguments, handling Windows variants if not "%OS%" == "Windows_NT" goto win9xME_args -if "%@eval[2+2]" == "4" goto 4NT_args :win9xME_args @rem Slurp the command line arguments. @@ -60,11 +59,6 @@ set _SKIP=2 if "x%~1" == "x" goto execute set CMD_LINE_ARGS=%* -goto execute - -:4NT_args -@rem Get arguments from the 4NT Shell from JP Software -set CMD_LINE_ARGS=%$ :execute @rem Setup the command line diff --git a/pdf-as-cli/build.gradle b/pdf-as-cli/build.gradle index fcde3b78..4f443d40 100644 --- a/pdf-as-cli/build.gradle +++ b/pdf-as-cli/build.gradle @@ -16,9 +16,9 @@ task releases(type: Copy) { } configurations { - pdfBox2Compile - pdfBox1Compile - } + pdfBox2Compile + pdfBox1Compile +} sourceSets{ pdfBox2{ @@ -67,37 +67,32 @@ task pdfbox1Startscript(type: CreateStartScripts) { } distZip { + baseName = archivesBaseName + duplicatesStrategy = DuplicatesStrategy.EXCLUDE - doFirst{ - baseName = archivesBaseName - duplicatesStrategy = DuplicatesStrategy.EXCLUDE - - into("${baseName}-${version}/lib") { - from startScripts.classpath - } - into("${baseName}-${version}/lib") { - from pdfbox1Startscript.classpath - } - into("${baseName}-${version}/bin") { - from pdfbox1Startscript - } - } + into("${baseName}-${version}/lib") { + from startScripts.classpath + } + into("${baseName}-${version}/lib") { + from pdfbox1Startscript.classpath + } + into("${baseName}-${version}/bin") { + from pdfbox1Startscript + } } distTar { - doFirst{ - baseName = archivesBaseName - duplicatesStrategy = DuplicatesStrategy.EXCLUDE - - into("${baseName}-${version}/lib") { - from startScripts.classpath - } - into("${baseName}-${version}/lib") { - from pdfbox1Startscript.classpath - } - into("${baseName}-${version}/bin") { - from pdfbox1Startscript - } + baseName = archivesBaseName + duplicatesStrategy = DuplicatesStrategy.EXCLUDE + + into("${baseName}-${version}/lib") { + from startScripts.classpath + } + into("${baseName}-${version}/lib") { + from pdfbox1Startscript.classpath + } + into("${baseName}-${version}/bin") { + from pdfbox1Startscript } } diff --git a/pdf-as-lib/src/main/resources/config/config.zip b/pdf-as-lib/src/main/resources/config/config.zip index 24a534e8..865662e7 100644 Binary files a/pdf-as-lib/src/main/resources/config/config.zip and b/pdf-as-lib/src/main/resources/config/config.zip differ diff --git a/pdf-as-tests/build.gradle b/pdf-as-tests/build.gradle index beba0afd..8d5129ff 100644 --- a/pdf-as-tests/build.gradle +++ b/pdf-as-tests/build.gradle @@ -144,14 +144,16 @@ suiteDir.eachDir { File subDir -> delete fileTree (dir: subDir.absolutePath, include: "**/test_result.html") } - task "cleanOutFolders${dirname.capitalize()}"() << { - subDir.eachDir { File tcDir -> - File outDir = new File(tcDir, "out"); - if(outDir.exists() && outDir.isDirectory()) { - outDir.eachFileRecurse { File mfile -> - mfile.delete() + task "cleanOutFolders${dirname.capitalize()}"() { + doLast { + subDir.eachDir { File tcDir -> + File outDir = new File(tcDir, "out"); + if(outDir.exists() && outDir.isDirectory()) { + outDir.eachFileRecurse { File mfile -> + mfile.delete() + } + outDir.delete() } - outDir.delete() } } } 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