diff options
author | Christian Maierhofer <cmaierhofer@iaik.tugraz.at> | 2016-07-01 13:36:51 +0200 |
---|---|---|
committer | Andreas Fitzek <andreas.fitzek@iaik.tugraz.at> | 2016-08-17 16:55:28 +0200 |
commit | c98ea00dffa6f8eaf7d78411435df77e64f5f2cd (patch) | |
tree | 9768d064eb9b2ec0f42ca1636dce7dae0864f977 | |
parent | bfff992ce5e09e176b6509752e4404dd4286544b (diff) | |
download | pdf-as-4-c98ea00dffa6f8eaf7d78411435df77e64f5f2cd.tar.gz pdf-as-4-c98ea00dffa6f8eaf7d78411435df77e64f5f2cd.tar.bz2 pdf-as-4-c98ea00dffa6f8eaf7d78411435df77e64f5f2cd.zip |
build tasks for pdfbox2
-rw-r--r-- | pdf-as-cli/build.gradle | 90 | ||||
-rw-r--r-- | pdf-as-lib/src/configuration/cfg/advancedconfig.properties | 3 | ||||
-rw-r--r-- | pdf-as-lib/src/main/resources/config/config.zip | bin | 1276515 -> 1276538 bytes | |||
-rw-r--r-- | pdf-as-pdfbox-2/build.gradle | 11 | ||||
-rw-r--r-- | pdf-as-web/build.gradle | 216 |
5 files changed, 271 insertions, 49 deletions
diff --git a/pdf-as-cli/build.gradle b/pdf-as-cli/build.gradle index 8cc9ef0f..51bdbe13 100644 --- a/pdf-as-cli/build.gradle +++ b/pdf-as-cli/build.gradle @@ -15,17 +15,29 @@ task releases(type: Copy) { into rootDir.toString() + "/releases/" + version } -releases.dependsOn jar -releases.dependsOn sourcesJar -releases.dependsOn distZip -releases.dependsOn distTar +configurations { + pdfBox2Compile + pdfBox1Compile + } +sourceSets{ + pdfBox2{ + compileClasspath = configurations.pdfBox2Compile + runtimeClasspath= configurations.pdfBox2Compile + } + pdfBox1{ + compileClasspath = configurations.pdfBox1Compile + runtimeClasspath= configurations.pdfBox1Compile + } +} + dependencies { compile project (':pdf-as-lib') compile project (':signature-standards:sigs-pkcs7detached') compile project (':signature-standards:sigs-pades') compile project (':pdf-as-moa') - compile project (':pdf-as-pdfbox') + pdfBox1Compile project (':pdf-as-pdfbox') + pdfBox2Compile project (':pdf-as-pdfbox-2') compile group: 'commons-collections', name: 'commons-collections', version: '3.2' compile group: 'commons-cli', name: 'commons-cli', version: '1.2' compile 'ch.qos.logback:logback-classic:1.1.2' @@ -33,6 +45,74 @@ dependencies { testCompile group: 'junit', name: 'junit', version: '4.+' } + +startScripts{ + classpath+=sourceSets.pdfBox1.compileClasspath +} + +compileJava{ + classpath=sourceSets.main.compileClasspath + classpath+=sourceSets.pdfBox1.compileClasspath + classpath+=sourceSets.pdfBox2.compileClasspath +} + + +task pdfbox2Startscript(type: CreateStartScripts) { + description "Creates OS specific scripts to call the 'other' entry point" + + classpath = startScripts.classpath.minus(configurations.pdfBox1Compile) + sourceSets.pdfBox2.compileClasspath + outputDir = startScripts.outputDir + mainClassName = startScripts.mainClassName + applicationName = startScripts.applicationName+"-pdfbox2" +} + +distZip { + + doFirst{ + baseName = archivesBaseName + duplicatesStrategy = DuplicatesStrategy.EXCLUDE + + into("${baseName}-${version}/lib") { + from startScripts.classpath + } + into("${baseName}-${version}/lib") { + from pdfbox2Startscript.classpath + } + into("${baseName}-${version}/bin") { + from pdfbox2Startscript + } + } +} + +distTar { + doFirst{ + baseName = archivesBaseName + duplicatesStrategy = DuplicatesStrategy.EXCLUDE + + into("${baseName}-${version}/lib") { + from startScripts.classpath + } + into("${baseName}-${version}/lib") { + from pdfbox2Startscript.classpath + } + into("${baseName}-${version}/bin") { + from pdfbox2Startscript + } + } +} + + +releases.dependsOn jar +releases.dependsOn sourcesJar +releases.dependsOn distZip +releases.dependsOn distTar + +distZip.dependsOn startScripts +startScripts.dependsOn pdfbox2Startscript + + + test { systemProperties 'property': 'value' } + diff --git a/pdf-as-lib/src/configuration/cfg/advancedconfig.properties b/pdf-as-lib/src/configuration/cfg/advancedconfig.properties index 7cdb87b2..89e9ed1e 100644 --- a/pdf-as-lib/src/configuration/cfg/advancedconfig.properties +++ b/pdf-as-lib/src/configuration/cfg/advancedconfig.properties @@ -97,4 +97,5 @@ default.verifier.01=at.gv.egiz.pdfas.sigs.pades.PAdESVerifier #Enable background color detection
#sigblock.placement.bgcolor.detection.enabled=true
-#sigblock.placement.debug.file=/home/cmaierhofer/temp/debugImg.png
\ No newline at end of file +#sigblock.placement.debug.file=/home/cmaierhofer/temp/debugImg.png
+#runtime.backend=PDFBOX_2_BACKEND
\ No newline at end of file diff --git a/pdf-as-lib/src/main/resources/config/config.zip b/pdf-as-lib/src/main/resources/config/config.zip Binary files differindex 37416895..fb9dd1c6 100644 --- a/pdf-as-lib/src/main/resources/config/config.zip +++ b/pdf-as-lib/src/main/resources/config/config.zip diff --git a/pdf-as-pdfbox-2/build.gradle b/pdf-as-pdfbox-2/build.gradle index f62604a3..c4e51f5c 100644 --- a/pdf-as-pdfbox-2/build.gradle +++ b/pdf-as-pdfbox-2/build.gradle @@ -5,7 +5,15 @@ jar { manifest { attributes 'Implementation-Title': 'PDF-AS-4 PDFBOX 2 Backend' } -} + +// from { +// configurations.compile.collect{it} + +// }{ +// include "pdfbox*" +// } + } + repositories { mavenCentral() @@ -14,6 +22,7 @@ repositories { task releases(type: Copy) { from jar.outputs into rootDir.toString() + "/releases/" + version + } releases.dependsOn jar diff --git a/pdf-as-web/build.gradle b/pdf-as-web/build.gradle index f8e33ba0..de3cb96b 100644 --- a/pdf-as-web/build.gradle +++ b/pdf-as-web/build.gradle @@ -17,10 +17,16 @@ buildscript { apply plugin: 'org.akhikhl.gretty' +configurations { providedCompile + pdfbox2 + pdfbox1 + } + jar { manifest { attributes 'Implementation-Title': 'PDF-AS-WEB' } + } repositories { @@ -28,18 +34,18 @@ repositories { mavenCentral() } -configurations { providedCompile } sourceSets.main.compileClasspath += configurations.providedCompile sourceSets.test.compileClasspath += configurations.providedCompile sourceSets.test.runtimeClasspath += configurations.providedCompile + dependencies { compile project (':pdf-as-lib') compile project (':pdf-as-moa') compile project (':signature-standards:sigs-pkcs7detached') compile project (':signature-standards:sigs-pades') - compile project (':pdf-as-pdfbox-2') + pdfbox1 project (':pdf-as-pdfbox') compile project (':pdf-as-web-status') compile project (':pdf-as-web-statistic-api') compile group: 'commons-fileupload', name: 'commons-fileupload', version: '1.3.1' @@ -53,6 +59,8 @@ dependencies { compile 'ch.qos.logback:logback-core:1.1.3' compile 'org.json:json:20160212' + pdfbox2 project (':pdf-as-pdfbox-2') + providedCompile 'javax.servlet:javax.servlet-api:3.0.1' testCompile group: 'junit', name: 'junit', version: '4.+' } @@ -71,6 +79,10 @@ test { } task downloadTomcat << { + 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"; @@ -105,46 +117,72 @@ task extractTomcat(dependsOn: downloadTomcat, type: Copy) { into outputDir } -task cleanWebAppsInTomcat(dependsOn: extractTomcat) << { - String targetDir = project.buildDir.toString() + "/tomcat-##VERSION##/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() +def deployVersions=['','-pdfbox2'] + +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 putTemplateIntoTomcat(dependsOn: cleanWebAppsInTomcat, type: Copy) { - String source = project.projectDir.toString() + "/"; - - String targetDir = "build/tomcat-##VERSION##/apache-tomcat-##VERSION##"; - targetDir = targetDir.replaceAll("##VERSION##", project.tomcatVersion); - - from 'src/main/assembly/tomcat' - 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 putConfigIntoTomcat(dependsOn: putTemplateIntoTomcat, type: Copy) { - String source = "../pdf-as-lib/build/resources/main/config/config.zip"; - - String targetDir = "build/tomcat-##VERSION##/apache-tomcat-##VERSION##/conf/pdf-as"; - targetDir = targetDir.replaceAll("##VERSION##", project.tomcatVersion); - - from zipTree(source) - into targetDir +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 putWebConfigIntoTomcat(dependsOn: putConfigIntoTomcat, type: Copy) { - String targetDir = "build/tomcat-##VERSION##/apache-tomcat-##VERSION##/conf/pdf-as"; - targetDir = targetDir.replaceAll("##VERSION##", project.tomcatVersion); - - from 'src/main/configuration/' - 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 putWebConfigIntoTomcat(dependsOn: putConfigIntoTomcat)<<{ + deployVersions.each{ + String targetDir = "build/tomcat-##VERSION##/apache-tomcat-##VERSION##/conf/pdf-as"; + targetDir = targetDir.replaceAll("##VERSION##", project.tomcatVersion); + + copy{ + from 'src/main/configuration/' + into targetDir + } + } } task injectPdfAsWebApp(dependsOn: putWebConfigIntoTomcat, type: Copy) { @@ -157,9 +195,34 @@ task injectPdfAsWebApp(dependsOn: putWebConfigIntoTomcat, type: Copy) { into targetDir rename '.*.war', 'pdf-as-web.war' } - injectPdfAsWebApp.dependsOn war +task createPdfbox2War(type:War){ + destinationDir = file("$buildDir/libs/pdfbox2") + + doFirst{ + sourceSets.main.compileClasspath -= configurations.pdfbox1 + sourceSets.test.compileClasspath -= configurations.pdfbox1 + sourceSets.main.compileClasspath += configurations.pdfbox2 + sourceSets.test.compileClasspath += configurations.pdfbox2 + classpath=sourceSets.main.compileClasspath + } +} + + + +task injectPdfAsWebAppPdfbox2(dependsOn: putWebConfigIntoTomcat, type: Copy) { + //war.execute(); + + String targetDir = project.buildDir.toString() + "/tomcat-##VERSION##"+deployVersions[1]+"/apache-tomcat-##VERSION##/webapps/"; + targetDir = targetDir.replaceAll("##VERSION##", project.tomcatVersion); + + from createPdfbox2War.outputs + into targetDir + rename '.*.war', 'pdf-as-web.war' +} +injectPdfAsWebAppPdfbox2.dependsOn createPdfbox2War + task buildTomcat(dependsOn: injectPdfAsWebApp, type: Zip) { String targetDir = project.buildDir.toString() + "/tomcat-##VERSION##/apache-tomcat-##VERSION##"; targetDir = targetDir.replaceAll("##VERSION##", project.tomcatVersion); @@ -172,8 +235,21 @@ task buildTomcat(dependsOn: injectPdfAsWebApp, type: Zip) { archiveName archive destinationDir project.buildDir } +task buildTomcatPdfbox2(dependsOn: injectPdfAsWebAppPdfbox2, type: Zip) { + String targetDir = project.buildDir.toString() + "/tomcat-##VERSION##"+deployVersions[1]+"/apache-tomcat-##VERSION##"; + targetDir = targetDir.replaceAll("##VERSION##", project.tomcatVersion); + + String archive = "apache-tomcat-##VERSION##"+deployVersions[1]+"-pdf-as-web-##PVERSION##.zip"; + archive = archive.replaceAll("##VERSION##", project.tomcatVersion); + archive = archive.replaceAll("##PVERSION##", project.version); + + from targetDir + archiveName archive + destinationDir project.buildDir +} task buildTomcatTar(dependsOn: injectPdfAsWebApp, type: Tar) { + String targetDir = project.buildDir.toString() + "/tomcat-##VERSION##/apache-tomcat-##VERSION##"; targetDir = targetDir.replaceAll("##VERSION##", project.tomcatVersion); @@ -186,6 +262,40 @@ task buildTomcatTar(dependsOn: injectPdfAsWebApp, type: Tar) { destinationDir project.buildDir } +task buildTomcatTarPdfbox2(dependsOn: injectPdfAsWebAppPdfbox2, type: Tar) { + + String targetDir = project.buildDir.toString() + "/tomcat-##VERSION##"+deployVersions[1]+"/apache-tomcat-##VERSION##"; + targetDir = targetDir.replaceAll("##VERSION##", project.tomcatVersion); + + String archive = "apache-tomcat-##VERSION##"+deployVersions[1]+"-pdf-as-web-##PVERSION##.tar"; + archive = archive.replaceAll("##VERSION##", project.tomcatVersion); + archive = archive.replaceAll("##PVERSION##", project.version); + + from targetDir + archiveName archive + destinationDir project.buildDir +} + + + +task releaseConfig(type: Copy) { + from 'src/main/configuration/pdf-as-web.properties' + into rootDir.toString() + "/releases/" + version + "/cfg" +} + + + + +war{ + doFirst{ + sourceSets.main.compileClasspath -= configurations.pdfbox2 + sourceSets.test.compileClasspath -= configurations.pdfbox2 + sourceSets.main.compileClasspath += configurations.pdfbox1 + sourceSets.test.compileClasspath += configurations.pdfbox1 + classpath=sourceSets.main.compileClasspath + } +} + task releases(dependsOn: buildTomcat, type: Copy) { String archive = project.buildDir.toString() + "/apache-tomcat-##VERSION##-pdf-as-web-##PVERSION##.zip"; archive = archive.replaceAll("##VERSION##", project.tomcatVersion); @@ -195,19 +305,41 @@ task releases(dependsOn: buildTomcat, type: Copy) { tararchive = tararchive.replaceAll("##VERSION##", project.tomcatVersion); tararchive = tararchive.replaceAll("##PVERSION##", project.version); - from war.outputs + + from war from archive - from tararchive + from tararchive into rootDir.toString() + "/releases/" + version + + + } -task releaseConfig(type: Copy) { - from 'src/main/configuration/pdf-as-web.properties' - into rootDir.toString() + "/releases/" + version + "/cfg" +task releaseCopyPdfbox2(type: Copy){ + String archive = project.buildDir.toString() + "/apache-tomcat-##VERSION##"+deployVersions[1]+"-pdf-as-web-##PVERSION##.zip"; + archive = archive.replaceAll("##VERSION##", project.tomcatVersion); + archive = archive.replaceAll("##PVERSION##", project.version); + + String tararchive = project.buildDir.toString() + "/apache-tomcat-##VERSION##"+deployVersions[1]+"-pdf-as-web-##PVERSION##.tar"; + tararchive = tararchive.replaceAll("##VERSION##", project.tomcatVersion); + tararchive = tararchive.replaceAll("##PVERSION##", project.version); + + from archive + from tararchive + from createPdfbox2War + into rootDir.toString() + "/releases/" + version+"/pdf-as-web-pdfbox2" } + releases.dependsOn jar releases.dependsOn sourcesJar releases.dependsOn war releases.dependsOn releaseConfig releases.dependsOn buildTomcatTar +releases.dependsOn createPdfbox2War +releases.dependsOn releaseCopyPdfbox2 +releases.dependsOn buildTomcatPdfbox2 +releases.dependsOn buildTomcatTarPdfbox2 + +war.dependsOn createPdfbox2War + |