aboutsummaryrefslogtreecommitdiff
path: root/pdf-as-web
diff options
context:
space:
mode:
authorChristian Maierhofer <cmaierhofer@iaik.tugraz.at>2016-07-01 13:36:51 +0200
committerAndreas Fitzek <andreas.fitzek@iaik.tugraz.at>2016-08-17 16:55:28 +0200
commitc98ea00dffa6f8eaf7d78411435df77e64f5f2cd (patch)
tree9768d064eb9b2ec0f42ca1636dce7dae0864f977 /pdf-as-web
parentbfff992ce5e09e176b6509752e4404dd4286544b (diff)
downloadpdf-as-4-c98ea00dffa6f8eaf7d78411435df77e64f5f2cd.tar.gz
pdf-as-4-c98ea00dffa6f8eaf7d78411435df77e64f5f2cd.tar.bz2
pdf-as-4-c98ea00dffa6f8eaf7d78411435df77e64f5f2cd.zip
build tasks for pdfbox2
Diffstat (limited to 'pdf-as-web')
-rw-r--r--pdf-as-web/build.gradle216
1 files changed, 174 insertions, 42 deletions
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
+