forked from ndw/xmlcalabash1-deltaxml
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
220 lines (187 loc) · 5.22 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
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath fileTree(dir: 'lib').include("*.jar")
classpath group: 'net.sf.saxon', name: 'Saxon-HE', version: saxonVersion
}
}
plugins {
id "java"
id "maven-publish"
id "signing"
}
repositories {
mavenLocal()
mavenCentral()
maven { url "https://maven.restlet.org" }
}
configurations {
localLibs
copydep {
extendsFrom implementation
}
copydep.exclude module: 'xmlcalabash'
copydep.exclude module: 'nwalsh-annotations'
copydep.exclude module: 'slf4j-api'
}
configurations.all {
resolutionStrategy {
force 'xml-apis:xml-apis:1.4.01'
}
}
dependencies {
localLibs fileTree(dir: 'lib').include("*.jar")
implementation (
[group: 'com.nwalsh', name: 'nwalsh-annotations', version: '1.0.1'],
[group: 'com.xmlcalabash', name: 'xmlcalabash', version: xmlCalabashVersion],
)
}
// Variables
project.ext.saxonRelease = saxonVersion.substring(0,5)
project.ext.saxonBranch = saxonVersion.substring(0,3).replaceAll("\\.", "")
project.ext.releaseVersion = relVersion
project.ext.distVersion = relVersion + snapshot
relVersion = project.ext.distVersion // - gets turned into . in some contexts
compileJava {
classpath += configurations.localLibs
options.deprecation = true
options.compilerArgs += ['-Xlint:deprecation']
options.annotationProcessorPath = configurations.compileClasspath
}
javadoc {
classpath += configurations.localLibs
}
task copyLib(type: Copy) {
FileCollection lib = configurations.copydep
String path = ""
lib.each {
File file -> path += " lib/" + file.name
}
project.ext.runtimeClasspath = path.trim()
from lib
into { "build/dist/lib" }
}
jar {
archiveBaseName = "xmlcalabash1-deltaxml-" + relVersion
manifest {
attributes 'Built-By': builtBy
attributes 'Implementation-Vendor': 'Norman Walsh'
attributes 'Implementation-Title': 'XML Calabash DeltaXML extension step'
attributes 'Implementation-Version': distVersion
attributes 'Bundle-SymbolicName': 'com.xmlcalabash.extensions.deltaxml'
attributes 'Bundle-RequiredExecutionEnvironment': 'J2SE-1.7'
attributes 'Export-Package': '*, etc'
attributes 'Import-Package': 'net.sf.saxon.*;version=' + project.ext.saxonRelease + ',\
javax.crypto.*,\
javax.xml.*,\
org.apache.commons.httpclient.*,\
org.xml.sax.*,\
*;resolution:=optional'
attributes 'DynamicImport-Package': '*'
attributes 'Class-Path': project.ext.runtimeClasspath + " lib"
}
}
task copyNotices(type: Copy) {
from 'resources/notices'
into 'build/dist/docs/notices'
}
jar.dependsOn copyNotices
task copyStuff(type: Copy) {
from 'README.md'
from 'LICENSE.md'
into 'build/dist'
}
task copyToDist(dependsOn: [copyLib,copyStuff]) {
// nop
}
jar.dependsOn copyToDist
task javadocJar(type: Jar, dependsOn: javadoc) {
from tasks.javadoc.destinationDir
classifier = 'javadoc'
}
task sourcesJar(type: Jar) {
from sourceSets.main.allSource
classifier = 'sources'
}
task copyJar(dependsOn: jar, type: Copy) {
from "build/libs/xmlcalabash1-deltaxml-" + distVersion + ".jar"
into "build/dist"
}
task copyJavaDoc(dependsOn: javadoc, type: Copy) {
from "build/docs"
into "build/dist/docs"
}
task testStep() {
doLast {
println("testStep fails on Travis CI; run localTestStep by hand")
}
}
task localTestStep(type: JavaExec) {
classpath = configurations.localLibs + configurations.runtimeClasspath + sourceSets.main.output
main = 'com.xmlcalabash.drivers.Main'
maxHeapSize = "1024m"
args('-D', '-a', 'src/test/resources/test-pipeline.xpl')
}
task makeDist(dependsOn: [ build, copyJar, copyLib ]) {
doLast {
println("Created distribution in build/dist")
}
}
task zipDist(dependsOn: makeDist, type: Zip) {
archiveFileName = 'xmlcalabash1-deltaxml-' + distVersion + ".zip"
from('build/dist')
into 'xmlcalabash1-deltaxml-' + distVersion
}
task dist(dependsOn: [testStep, zipDist]) {
// nop
}
signing {
sign publishing.publications
}
publishing {
publications {
mavenJava(MavenPublication) {
pom {
name = 'XML Calabash DeltaXML extension step'
packaging = 'jar'
description = 'XML Calabash support for printing with FO and CSS'
url = 'https://github.com/ndw/xmlcalabash1-deltaxml'
scm {
url = 'scm:git@github.com:ndw/xmlcalabash1-deltaxml.git'
connection = 'scm:git@github.com:ndw/xmlcalabash1-deltaxml.git'
developerConnection = 'scm:git@github.com:ndw/xmlcalabash1-deltaxml.git'
}
licenses {
license {
name = 'The Apache Software License, Version 2.0'
url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
distribution = 'repo'
}
}
developers {
developer {
id = 'ndw'
name = 'Norman Walsh'
}
}
}
groupId = "com.xmlcalabash"
artifactId = "xmlcalabash1-deltaxml"
version = relVersion
from components.java
artifact javadocJar
artifact sourcesJar
}
}
repositories {
maven {
url = "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
credentials {
username = sonatypeUsername
password = sonatypePassword
}
}
}
}