-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathbuild.gradle
242 lines (206 loc) · 7.34 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
buildscript {
ext {
kotlinVersion = '1.2.71'
junitVersion = '5.2.0'
jacksonVersion = '2.9.6'
}
repositories {
jcenter()
}
dependencies {
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${kotlinVersion}")
classpath "org.jetbrains.dokka:dokka-gradle-plugin:0.9.17"
classpath 'com.github.ben-manes:gradle-versions-plugin:0.20.0' // gradle dependencyUpdates -Drevision=release
classpath "de.thetaphi:forbiddenapis:2.5"
classpath 'com.diffplug.spotless:spotless-plugin-gradle:3.14.0'
}
}
apply plugin: 'kotlin'
apply plugin: 'org.jetbrains.dokka'
apply plugin: 'project-report' // useful for gradle htmlDependencyReport
apply plugin: 'com.diffplug.gradle.spotless'
apply plugin: "de.thetaphi.forbiddenapis"
apply plugin: 'com.github.ben-manes.versions'
apply plugin: 'java'
apply plugin: 'maven'
forbiddenApis {
// https://github.com/policeman-tools/forbidden-apis/wiki/GradleUsage
bundledSignatures = ["jdk-unsafe-9", "jdk-deprecated-9", "jdk-non-portable", "jdk-internal-9"]
// take out "jdk-system-out"
signaturesFiles = files("forbidden_signatures.txt")
ignoreFailures = false
}
// this intentionally breaks the build if you mess up the formatting; pro tip: use Save Actions plugin in intellij and auto format and organize imports on save
spotless {
java {
removeUnusedImports() // removes any unused imports
}
// to fix violations: gradle spotlessApply
// in intellij also tweak kotlin imports to require 999 imports before wildcards and remove java.util for always using wildcards
// do the same for java imports
// wildcards are verboten!
// currentlyb breaks offline build due to fucked up transitive dependency on ktlint & kotlin
kotlin {
// optionally takes a version
ktlint()
}
}
afterEvaluate {
// apply it on every build, this will create diffs but is preferable to breaking CI builds over minor formatting
tasks.getByName('spotlessCheck').dependsOn(tasks.getByName('spotlessApply'))
}
if (project.hasProperty("signing.keyId")) {
/*
fix ~/gradle.properties
# lass eight chars of the key you get with gpg --list-keys
signing.keyId=29B280D7
signing.password=XXXXXXX
signing.secretKeyRingFile=/Users/jillesvangurp/.gnupg/secring.gpg
ossrhUsername=jillesvangurp
ossrhPassword=XXXXXXX
export GRADLE_USER_HOME=/Users/jillesvangurp
to release:
bump the version number below
gradle clean
gradle build
gradle uploadArchives
goto https://oss.sonatype.org/#stagingRepositories
find the newly uploaded repo
close it, wait for it (takes a minute after it closes) ... refresh .... release .... wait some more, shit should be rolling out
set snapshot version for next version
*/
apply plugin: 'signing'
signing {
sign configurations.archives
}
}
group = 'com.jillesvangurp'
archivesBaseName = "jsonj"
version = '2.52'
description = """A fluent Java API for manipulating json data structures """
sourceCompatibility = 1.8
targetCompatibility = 1.8
tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
}
sourceSets {
main.java.srcDirs += 'src/main/kotlin'
test.java.srcDirs += 'src/test/kotlin'
}
task javadocJar(type: Jar) {
classifier = 'javadoc'
from javadoc
}
task sourcesJar(type: Jar) {
classifier = 'sources'
from sourceSets.main.allSource
}
test {
useTestNG {
parallel = "classes"
threadCount = 15
}
testLogging {
// Make sure output from
// standard out or error is shown
// in Gradle output.
showStandardStreams = true
}
}
artifacts {
archives javadocJar, sourcesJar
}
if (project.hasProperty("ossrhUsername")) {
uploadArchives {
repositories {
mavenDeployer {
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
repository(url: "https://oss.sonatype.org/service/local/staging/deploy/maven2/") {
authentication(userName: ossrhUsername, password: ossrhPassword)
}
snapshotRepository(url: "https://oss.sonatype.org/content/repositories/snapshots/") {
authentication(userName: ossrhUsername, password: ossrhPassword)
}
pom.project {
name 'Inbot Testfixtures'
packaging 'jar'
// optionally artifactId can be defined here
description 'Helper class for human readable randmized names and email addresses'
url 'https://github.com/jillesvangurp/jsonj'
scm {
connection 'scm:git:[email protected]:inbot/jsonj.git'
developerConnection 'scm:git:[email protected]:inbot/jsonj.git'
url 'git://[email protected]:jillesvangurp/jsonj.git'
}
licenses {
license {
name 'MIT license'
url 'https://github.com/jillesvangurp/jsonj/blob/master/LICENSE'
distribution 'repo'
}
}
developers {
developer {
id 'jillesvangurp'
name 'Jilles van Gurp'
}
}
}
}
}
}
}
repositories {
mavenCentral()
maven { url "https://oss.sonatype.org/content/groups/public/" }
maven { url "https://oss.sonatype.org/content/repositories/snapshots" }
}
configurations {
// adds the compileOnly dependencies
testImplementation.extendsFrom compileOnly
}
dependencies {
compile "com.google.code.findbugs:jsr305:3.0.2"
compile "org.apache.commons:commons-lang3:3.8"
compile "com.jillesvangurp:efficientstring:1.12"
// most of this is optional, just add them to your project if you need features that depend on these
compileOnly "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlinVersion"
compileOnly "com.fasterxml.jackson.core:jackson-core:$jacksonVersion"
compileOnly "com.fasterxml.jackson.module:jackson-module-kotlin:$jacksonVersion"
compileOnly "com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:$jacksonVersion"
compileOnly "xom:xom:1.2.5"
compileOnly "de.undercouch:bson4jackson:2.9.2"
compileOnly "com.googlecode.plist:dd-plist:1.21"
compileOnly "com.jasonclawson:jackson-dataformat-hocon:1.1.0"
compileOnly "com.moandjiezana.toml:toml4j:0.7.2"
// compileOnly because we export custom jsonj assertions
compileOnly "org.assertj:assertj-core:3.11.0"
testCompile "io.inbot:inbot-utils:1.28"
testCompile "org.testng:testng:6.14.3"
testCompile "org.hamcrest:hamcrest-all:1.3"
}
compileKotlin {
kotlinOptions {
jvmTarget = "1.8"
}
}
compileTestKotlin {
kotlinOptions {
jvmTarget = "1.8"
}
}
allprojects {
tasks.withType(Test).configureEach {
maxParallelForks = 4
}
tasks.withType(Test).configureEach {
forkEvery = 100
}
tasks.withType(Test).configureEach {
reports.html.required = false
reports.junitXml.required = false
}
tasks.withType(JavaCompile).configureEach {
options.incremental = true
}
}