forked from mapfish/mapfish-print
-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.gradle
206 lines (164 loc) · 6.16 KB
/
build.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
import com.camptocamp.gradle.plugin.*
import com.camptocamp.gradle.*
group = 'org.mapfish.print'
version = '1.2-SNAPSHOT'
apply plugin: 'java'
apply plugin: 'war'
apply plugin: 'jetty'
apply plugin: 'eclipse'
apply plugin: 'maven'
apply plugin: 'project-report'
defaultTasks 'jar', 'war', 'standalone'
MAPFISH_REPO='http://dev.mapfish.org/maven/repository'
repositories {
mavenRepo urls: MAPFISH_REPO
mavenRepo urls: ["http://www.ibiblio.org/maven2", "http://download.osgeo.org/webdav/geotools"]
mavenCentral()
}
configurations {
deployerJars
compile.transitive = true
deployerJars.transitive = true
}
dependencies {
compile ('com.lowagie:itext:2.1.5', 'xerces:xercesImpl:2.4.0', 'org.json:json:20080701', 'org.jyaml:jyaml:1.3',
'ch.thus:pvalsecc:0.9.2', 'xalan:xalan:2.7.0', 'log4j:log4j:1.2.14', 'com.vividsolutions:jts:1.8',
"org.mapfish.geo:mapfish-geo-lib:1.2-SNAPSHOT", 'commons-httpclient:commons-httpclient:3.1',
'org.geotools:gt-epsg-hsql:2.6.5','org.apache.pdfbox:pdfbox:1.6.0', 'javax.media:jai_core:1.1.3',
'javax.media:jai_imageio:1.1', 'javax.media:jai_codec:1.1.3')
compile ('org.apache.xmlgraphics:batik-transcoder:1.7'){
exclude module: 'fop'
}
providedCompile 'javax.servlet:servlet-api:2.5'
testCompile 'junit:junit:4.7'
deployerJars "org.apache.maven.wagon:wagon-ssh:1.0-beta-2"
}
manifest.mainAttributes('Main-Class':'org.mapfish.print.ShellMapPrinter', 'Build-Time': new Date().getDateTimeString())
sourceCompatibility = 1.6
targetCompatibility = 1.6
jar {
enabled = true
baseName = "print-lib"
}
war {
baseName = "print-servlet"
manifest.mainAttributes('Build-Time': new Date().getDateTimeString())
}
task standalone (type: Jar) {
baseName = "print-standalone"
manifest = jar.manifest
from sourceSets.main.output
def dependencies = configurations.compile.resolve().findAll{ file ->
return !file.name.contains("servlet-api")
}
def serviceDir = new File("$buildDir/META-INF/services")
serviceDir.deleteDir()
serviceDir.mkdirs()
for(file in dependencies) {
def files = zipTree(file).matching {
exclude 'META-INF/**'
exclude 'LICENSE'
}
zipTree(file).matching {include 'META-INF/services/*'}.each {f ->
new File(serviceDir,f.name) << f.getText("UTF-8")
}
from files
}
from fileTree(buildDir).matching{include 'META-INF/services/*'}
into ""
}
task show {
// sourceSets.main.classes.asFileTree.each {println it}
}
artifacts {
archives jar, war, standalone
}
configure(install.repositories.mavenInstaller) {
addFilter('lib') { artifact, file ->
artifact.name.contains 'print-lib'
}
addFilter('standalone') { artifact, file ->
artifact.name.contains 'print-standalone'
}
addFilter('war') { artifact, file ->
artifact.name.contains 'print-servlet'
}
}
/*
uploadArchives << {
def ssl = new SSL()
repositories.mavenDeployer {
pom.project {
licenses {
license {
name 'GNU General Public License V3'
url 'http://www.gnu.org/licenses/'
}
}
}
name = 'dev.mapfish.org deployer'
configuration = configurations.deployerJars
logger.debug("Using ${ssl.privateKey()} for privateKey file")
logger.debug("Using ${ssl.passphrase()} for privateKey passphrase")
repository(url: "scp://dev.mapfish.org/var/www/dev.mapfish.org/htdocs/maven/repository") {
authentication( userName: "admin", privateKey: ssl.privateKey(), passphrase: ssl.passphrase())
}
snapshotRepository(url: "scp://dev.mapfish.org/var/www/dev.mapfish.org/htdocs/maven/repository") {
authentication( userName: "admin", privateKey: ssl.privateKey(), passphrase: ssl.passphrase())
uniqueVersion = false
}
}
}*/
def prop(key) {
return System.getProperty(key) == null ? null : "--${key}=${System.getProperty(key)}"
}
task run(dependesOn: compileJava) << {
String warning = """[WARNING] config parameter is required.
Usage:
gradle run -Dconfig={value} [-Dspec={value}] [-Dverbose={value}] [-Doutput={value}] [-DclientConfig] [-Dreferer={value}] [-Dlog4jConfig={value}]
Params:
-Dconfig={String}: Filename for the configuration (templates&CO)
-Dspec={String}: The location of the description of what has to be printed. By default, STDIN (defaults to [null])
-Dverbose={int}: Used only if log4jConfig is not specified. 3 if you want everything, 2 if you want the debug information (stacktraces are shown), 1 for infos and 0 for only warnings and errors (defaults to [1])
-Doutput={String}: The destination file. By default, STDOUT (defaults to [null])
-DclientConfig={on|off}: Get the config for the client form. Doesn't generate a PDF (defaults to [off])
-Dreferer={String}: Referer address to use when doing queries (defaults to [null])
-Dlog4jConfig={String}: Property file for the log4j configuration (defaults to [null])
Example:
gradle run -Dconfig=samples/config.yaml -Dspec=samples/spec.json -Doutput=/tmp/print-out.pdf
"""
args = [prop("config"),prop("spec"),prop("output"),prop("verbose"),prop("clientConfig"),prop("referer"),prop("log4jConfig")]
if(prop("config") == null) {
println(warning)
} else {
ant.java(classname: 'org.mapfish.print.ShellMapPrinter', fork: false, logError: false,
classpath: "${sourceSets.main.runtimeClasspath.asPath}") {
for(a in args.findAll {it!=null}){
arg(value: a)
}
}
}
}
jettyRun {
httpPort = 8080
scanTargets = (fileTree("src/main/").include("webapp/WEB-INF/**") + fileTree(compileJava.destinationDir)).files
reload = 'manual'
}
/*
This task is not ready for prime time. I do not know what parameters the class expects
task runWarTest(dependsOn: jettyRunWar) << {
description = "run load test on embedded jetty"
try {
testServer = System.properties('testServer') :?
def constructor
ant.java(
classname: 'integration.HeavyLoad', fork:false,
classpath: "${configurations.testCompile.asPath}")
{
arg(value: "http://localhost:$httpPort/print")
arg(value: "samples/spec.json")
}
} finally {
jettyStop.execute()
}
}*/