-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
260 lines (244 loc) · 8.18 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
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
/**
* Gradle 1.5 build script.
*
* Custom gradle tasks:
* zip - Builds the BeanIO zip distribution
* site - Builds the BeanIO site distribution
*
* See the following URL for instructions regarding deployment to the Sonatype Maven repo:
* https://docs.sonatype.org/display/Repository/Sonatype+OSS+Maven+Repository+Usage+Guide
*
* BeanIO is built using JDK1.6 or higher. If using JDK1.5, the following additional
* dependencies may be necessary:
* - jsr173 1.0 API (required for compilation and test execution)
* - sjsxp 1.0.x or equivalent JSR-173 implementation (required for test execution)
*
* To execute the 'uploadArchives' task, the following properties must be specified
* in an external 'gradle.properties' file:
* - (signing properties, see http://www.gradle.org/docs/current/userguide/signing_plugin.html)
* - sonatypeUsername
* - sonatypePassword
*/
apply plugin: 'java'
apply plugin: 'groovy'
apply plugin: 'maven'
apply plugin: 'signing'
apply from: 'https://raw.github.com/breskeby/gradleplugins/master/emmaPlugin/emma.gradle'
version = "2.1.0.SNAPSHOT"
group = "org.beanio"
sourceCompatibility = 1.5
targetCompatibility = 1.5
ext.artifactId = "beanio"
ext.isReleaseVersion = !version.endsWith("SNAPSHOT")
repositories {
mavenCentral()
}
configurations {
jarjar
}
dependencies {
compile group: 'org.springframework.batch', name: 'spring-batch-core', version: '2.1.9.RELEASE'
compile group: 'org.ow2.asm', name: 'asm', version: '4.0'
testCompile group: 'junit', name: 'junit', version: '4.11'
testCompile group: 'org.codehaus.groovy', name: 'groovy-all', version: '1.8.9'
testRuntime group: 'commons-logging', name: 'commons-logging', version: '1.1.2'
jarjar group:'com.googlecode.jarjar', name: 'jarjar', version: '1.3'
emma group: 'emma', name: 'emma', version: '2.0.5312'
emma group: 'emma', name: 'emma', version: '2.0.5312'
}
sourceSets {
main {
java {
srcDir 'src'
}
resources {
srcDir 'src'
exclude '**/*.java'
exclude '**/package.html'
}
}
test {
java {
srcDir 'test'
include '**/*.java'
}
groovy {
srcDir 'test'
include '**/*.groovy'
}
resources {
srcDir 'test'
exclude '**/*.java'
exclude '**/*.groovy'
}
}
}
javadoc {
options.header = "BeanIO $version"
options.docTitle = "<h2>BeanIO 2.1 API</h2>"
options.footer = "<i>Copyright © 2010-2013 Kevin Seim</i>"
options.links = [
"http://download.oracle.com/javase/6/docs/api/",
"http://static.springsource.org/spring-batch/apidocs/",
"http://static.springsource.org/spring/docs/2.5.x/api/"
]
}
jar {
baseName = "$artifactId"
includeEmptyDirs = false
ext.metaInfDir = "$buildDir/tmp/jar"
// create a list of exported packages for OSGi
ant.dirset(id:"osgi.dirs", dir:"src/org/beanio", excludes: "xsd/**")
ant.pathconvert(refid:"osgi.dirs", property:"osgi.packages", dirsep:".", pathsep:";version=\"${version}\",") {
map(from:"$basedir/src/", to:"")
}
manifest {
attributes(
"Implementation-Title": "BeanIO ${version}",
"Implementation-Version": version,
"Bundle-ManifestVersion": "2",
"Bundle-Name": "BeanIO",
"Bundle-SymbolicName": "org.beanio",
"Bundle-Version": version,
"Bundle-Vendor": "Kevin Seim",
"Bundle-Description": "BeanIO OSGi support",
"Bundle-License": "http://www.apache.org/licenses/LICENSE-2.0",
"Bundle-DocURL": "http://beanio.org",
"Export-Package": ant.properties["osgi.packages"] + ";version=\"${version}\"",
"DynamicImport-Package": "*")
}
doLast {
manifest.writeTo("$metaInfDir/MANIFEST.MF")
project.ant {
taskdef name: "jarjar", classname: "com.tonicsystems.jarjar.JarJarTask", classpath: configurations.jarjar.asPath
jarjar(jarfile: "$buildDir/libs/${baseName}-${version}.jar", manifest: "$metaInfDir/MANIFEST.MF") {
fileset(dir: "$sourceSets.main.output.classesDir")
fileset(dir: "$sourceSets.main.output.resourcesDir")
metainf(dir: "$projectDir") {
include(name: "LICENSE.txt")
include(name: "LICENSE-ASM.txt")
include(name: "NOTICE.txt")
}
configurations.compile.files { dep -> dep.name == 'asm' }.each { file -> zipfileset(src: file) }
rule pattern: "org.objectweb.asm.**", result: "org.beanio.internal.asm.@1"
}
}
}
}
task sourcesJar(type: Jar, dependsOn:classes) {
baseName = "$artifactId"
classifier = 'sources'
from("$projectDir/src") {
exclude '**/package.html'
}
manifest {
attributes(
"Implementation-Title": "BeanIO ${version}",
"Implementation-Version": version
)
}
metaInf {
from("$projectDir") {
include "LICENSE.txt"
include "NOTICE.txt"
}
}
}
task javadocJar(type: Jar, dependsOn:javadoc) {
baseName = "$artifactId"
classifier = 'javadoc'
from javadoc.destinationDir
manifest {
attributes(
"Implementation-Title": "BeanIO ${version}",
"Implementation-Version": version
)
}
metaInf {
from("$projectDir") {
include "LICENSE.txt"
include "NOTICE.txt"
}
}
}
task zip(type: Zip, dependsOn: [javadoc, jar] ) {
baseName = "$artifactId"
from jar.archivePath
from(javadoc.destinationDir) {
into "docs/api"
}
from("$projectDir") {
include "docs/**"
include "src/**"
include "test/**"
include "*.txt"
include "*.xml"
include "*.properties"
include "build.gradle"
}
}
task site(type: Tar, dependsOn: javadoc) {
baseName = "$artifactId"
classifier "site"
version ""
compression Compression.GZIP
from(javadoc.destinationDir) {
into "2.1/docs/api"
}
from ("$projectDir/docs") {
into "2.1/docs"
}
from("$projectDir/site")
from("$projectDir/src/org/beanio/xsd") {
include "2012/**"
}
}
artifacts {
archives jar
archives sourcesJar
archives javadocJar
}
signing {
required { isReleaseVersion && gradle.taskGraph.hasTask("uploadArchives") }
sign configurations.archives
}
uploadArchives {
repositories {
mavenDeployer {
beforeDeployment { MavenDeployment deployment -> signPom(deployment) }
repository(url: "https://oss.sonatype.org/service/local/staging/deploy/maven2/") {
authentication(userName: sonatypeUsername, password: sonatypePassword)
}
pom.project {
name 'BeanIO'
artifactId "$artifactId"
packaging 'jar'
description 'A Java un/marshalling library for CSV, XML, delimited and fixed length stream formats.'
url 'http://beanio.org/'
scm {
url 'http://beanio.googlecode.com/svn'
connection 'scm:svn:http://beanio.googlecode.com/svn/trunk'
developerConnection 'scm:svn:https://beanio.googlecode.com/svn/trunk'
}
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 'kevinseim'
name 'Kevin Seim'
}
}
}
pom.whenConfigured {
dependencies.find { dep -> dep.artifactId == 'asm' }.scope = "provided"
dependencies.find { dep -> dep.artifactId == 'spring-batch-core' }.optional = true
dependencies.find { dep -> dep.artifactId == 'commons-logging' }.optional = true
}
}
}
}