-
Notifications
You must be signed in to change notification settings - Fork 28
/
Copy pathbuild.gradle
186 lines (162 loc) · 5.62 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
apply plugin: 'java'
sourceCompatibility = 1.8
targetCompatibility = 1.8
group = 'de.erichseifert.vectorgraphics2d'
version = getVersionString()
description = 'A library for adding vector export to Java(R) Graphics2D.'
ext {
inceptionYear = 2010
owner1_id = 'eseifert'
owner1_name = 'Erich Seifert'
owner1_email = 'dev[at]erichseifert.de'
owner2_id = 'mseifert'
owner2_name = 'Michael Seifert'
owner2_email = 'mseifert[at]error-reports.org'
website = 'https://github.com/eseifert/vectorgraphics2d/'
// Determine the location of rt.jar (required for ProGuard)
if (System.getProperty('os.name').startsWith('Mac')) {
runtimeJar = "${System.getProperty("java.home")}/bundle/Classes/classes.jar"
} else {
runtimeJar = "${System.getProperty("java.home")}/lib/rt.jar"
}
}
repositories {
maven {
url 'https://plugins.gradle.org/m2/'
}
}
dependencies {
testCompile 'junit:junit:4.12'
testCompile 'org.hamcrest:hamcrest-library:1.3'
testCompile 'org.ghost4j:ghost4j:1.0.1'
testCompile 'org.apache.xmlgraphics:batik-transcoder:1.9.1'
testRuntime 'org.apache.xmlgraphics:batik-codec:1.9.1' // Required for images with data: URLs
}
buildscript {
repositories {
maven {
url 'https://plugins.gradle.org/m2/'
}
}
dependencies {
classpath 'net.sf.proguard:proguard-gradle:5.2.+'
classpath 'nl.javadude.gradle.plugins:license-gradle-plugin:0.11.+'
classpath 'net.saliman:gradle-cobertura-plugin:3.0.0'
classpath 'org.kt3k.gradle.plugin:coveralls-gradle-plugin:2.8.1'
}
}
apply plugin: 'net.saliman.cobertura'
cobertura.coverageFormats = ['html', 'xml']
apply plugin: 'com.github.kt3k.coveralls'
apply plugin: 'license'
license {
header(rootProject.file("${projectDir}/src/etc/header.txt"))
strictCheck(true)
mapping {
java = 'SLASHSTAR_STYLE'
}
def currentYear = new GregorianCalendar().get(Calendar.YEAR)
ext.year = "${inceptionYear}-${currentYear}"
ext.owner1 = owner1_name
ext.email1 = owner1_email
ext.owner2 = owner2_name
ext.email2 = owner2_email
}
jar {
manifest {
attributes('Automatic-Module-Name': 'de.erichseifert.vectorgraphics2d')
}
}
task shrinkJar(type: proguard.gradle.ProGuardTask, dependsOn: jar) {
description = 'Uses ProGuard to reduce the code size of this project.'
group = 'Build'
// Configure ProGuard
configuration("${projectDir}/src/etc/proguard.conf")
target(targetCompatibility.toString())
injars(jar.archivePath)
outjars("${libsDir}/shrunk/${jar.archiveName}")
libraryjars(runtimeJar)
libraryjars(configurations.runtime)
}
task sourceJar(type: Jar) {
description = 'Assembles a jar archive containing the source code of the main classes.'
group = 'Build'
from sourceSets.main.allJava
classifier 'sources'
}
task javadocJar(type: Jar) {
description = 'Assembles a jar archive containing the API doc.'
group = 'Build'
from javadoc
classifier 'javadoc'
}
apply plugin: 'maven'
apply plugin: 'signing'
artifacts {
archives shrinkJar.getOutJarFileCollection().getSingleFile(), sourceJar, javadocJar
}
signing {
required { hasProperty('signing.keyId') && gradle.taskGraph.hasTask('uploadArchives') }
sign configurations.archives
}
uploadArchives {
repositories {
mavenDeployer {
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
repository(url: 'https://oss.sonatype.org/service/local/staging/deploy/maven2/') {
authentication(userName: project.hasProperty('ossrhUsername')?ossrhUsername:'', password: project.hasProperty('ossrhPassword')?ossrhPassword:'')
}
snapshotRepository(url: 'https://oss.sonatype.org/content/repositories/snapshots/') {
authentication(userName: project.hasProperty('ossrhUsername')?ossrhUsername:'', password: project.hasProperty('ossrhPassword')?ossrhPassword:'')
}
pom.project {
name rootProject.name
packaging 'jar'
description project.description
url website
inceptionYear inceptionYear
licenses {
license {
name 'GNU Library or Lesser General Public License (LGPL)'
url 'http://www.gnu.org/licenses/lgpl.txt'
}
}
developers {
developer {
id owner1_id
name owner1_name
email owner1_email
}
developer {
id owner2_id
name owner2_name
email owner2_email
}
}
scm {
connection 'scm:git:git://github.com/eseifert/vectorgraphics2d.git'
developerConnection 'scm:git:[email protected]:eseifert/vectorgraphics2d.git'
url website
}
issueManagement {
system 'GitHub Issues'
url website
}
}
}
}
}
signArchives.dependsOn(shrinkJar)
/*
* This method must not be named getVersion, because it would
* overwrite the implicit getter of the version property in the
* current Project object.
*/
def getVersionString() {
def out = new ByteArrayOutputStream()
exec {
commandLine('git', 'describe', '--tags', '--always')
standardOutput = out
}
return out.toString().trim()
}