-
Notifications
You must be signed in to change notification settings - Fork 178
/
build.gradle
222 lines (195 loc) · 5.14 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
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'ru.vyarus:gradle-animalsniffer-plugin:1.2.0'
classpath "com.smokejumperit.gradle.license:Gradle-License-Report:0.0.2"
}
}
plugins {
id 'java'
id 'groovy'
id 'osgi'
id 'net.saliman.cobertura' version '2.4.0'
id 'com.github.kt3k.coveralls' version '2.8.1'
id 'com.github.ben-manes.versions' version '0.14.0'
id 'com.jfrog.bintray' version '1.7.3'
id 'net.researchgate.release' version '2.5.0'
id 'com.github.jk1.dependency-license-report' version '0.3.8'
}
apply plugin: 'ru.vyarus.animalsniffer'
apply plugin: 'maven-publish'
group = 'de.danielbechler'
description = """Java Object Diff"""
sourceCompatibility = 1.5
targetCompatibility = 1.5
tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
}
repositories {
mavenCentral()
}
sourceSets {
main {
java {
srcDirs = ['src/main/java']
}
groovy {
srcDirs = []
}
}
test {
java {
srcDirs = []
}
groovy {
srcDirs = ['src/test/java']
}
}
intTest {
groovy {
compileClasspath += main.output + test.output
runtimeClasspath += main.output + test.output
srcDirs = ['src/integration-test/java']
}
}
}
configurations {
intTestCompile.extendsFrom testCompile
intTestRuntime.extendsFrom testRuntime
}
task intTest(type: Test) {
testClassesDir = sourceSets.intTest.output.classesDir
classpath = sourceSets.intTest.runtimeClasspath
}
check.dependsOn intTest
compileGroovy {
// somehow the groovy compile deletes the java compiled classes from the build directory
dependsOn = []
}
jar {
manifest {
instruction 'Bundle-Vendor', 'Daniel Bechler'
instruction 'Bundle-DocURL', 'https://github.com/SQiShER/java-object-diff'
instruction 'Export-Package', '{local-packages}'
}
}
dependencies {
signature 'org.codehaus.mojo.signature:java15:1.0@signature'
signature 'org.codehaus.mojo.signature:java16:1.1@signature'
signature 'org.codehaus.mojo.signature:java17:1.0@signature'
// For Android support:
// signature 'net.sf.androidscents.signature:android-api-level-23:6.0_r3@signature'
compile group: 'org.slf4j', name: 'slf4j-api', version: '1.7.22'
testCompile group: 'org.codehaus.groovy', name: 'groovy-all', version: '2.4.8'
testCompile group: 'ch.qos.logback', name: 'logback-core', version: '1.2.1'
testCompile group: 'ch.qos.logback', name: 'logback-classic', version: '1.2.1'
testCompile group: 'org.spockframework', name: 'spock-core', version: '1.0-groovy-2.4'
testCompile group: 'cglib', name: 'cglib-nodep', version: '3.2.4'
testCompile group: 'org.objenesis', name: 'objenesis', version: '2.5.1'
}
cobertura {
coverageFormats = ['html', 'xml']
coverageIgnoreTrivial = true
}
bintray {
user = System.getenv('BINTRAY_USER')
key = System.getenv('BINTRAY_KEY')
publications = ['mavenJava']
publish = true
pkg {
repo = 'maven'
name = 'java-object-diff'
licenses = ['Apache-2.0']
vcsUrl = 'https://github.com/SQiShER/java-object-diff.git'
githubRepo = 'SQiShER/java-object-diff'
githubReleaseNotesFile = 'README.md'
version {
name = project.version
released = new Date()
vcsTag = rootProject.name + '-' + project.version
gpg {
sign = true
passphrase = System.getenv('BINTRAY_GPG_PASSPHRASE')
}
mavenCentralSync {
user = System.getenv('MAVEN_CENTRAL_USER_TOKEN_KEY')
password = System.getenv('MAVEN_CENTRAL_USER_TOKEN_PASSWORD')
}
}
}
}
javadoc {
failOnError = false
}
task sourcesJar(type: Jar, dependsOn: classes) {
classifier = 'sources'
from sourceSets.main.allSource
}
task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
from javadoc.destinationDir
}
artifacts {
archives sourcesJar, javadocJar
}
def pomConfig = {
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 "sqisher"
name "Daniel Bechler"
url "https://github.com/SQiShER"
}
}
scm {
url "https://github.com/SQiShER/java-object-diff"
}
}
publishing {
publications {
mavenJava(MavenPublication) {
from components.java
artifact sourcesJar
artifact javadocJar
pom.withXml {
def root = asNode()
root.appendNode('description', 'Library to diff and merge Java objects with ease')
root.appendNode('name', 'java-object-diff')
root.appendNode('url', 'https://github.com/SQiShER/java-object-diff')
root.children().last() + pomConfig
}
}
}
}
release {
tagTemplate = '$name-$version'
}
@SuppressWarnings("GroovyAssignabilityCheck")
static processFileInplace(File file, Closure processText) {
String text = file.text
file.write(processText(text))
}
task updateDocs {
doLast {
def updateVersion = { String text ->
text = text.replaceAll('<version>[^<]+</version>', "<version>${version}</version>")
text = text.replaceAll('de\\.danielbechler:java-object-diff:[0-9-A-Z\\-.]+', "de.danielbechler:java-object-diff:${version}")
return text
}
processFileInplace(file('README.md'), updateVersion)
processFileInplace(file('docs/maven.md'), updateVersion)
}
}
afterReleaseBuild.dependsOn bintrayUpload
afterReleaseBuild.dependsOn updateDocs
task wrapper(type: Wrapper) {
gradleVersion = '3.3'
}