-
-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathbuild.gradle
132 lines (110 loc) · 3.3 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
plugins {
id("io.github.gradle-nexus.publish-plugin") version "1.3.0"
id("se.patrikerdes.use-latest-versions") version "0.2.18"
id("com.github.ben-manes.versions") version "0.50.0"
}
apply plugin: 'jacoco'
apply plugin: 'java'
apply plugin: 'maven-publish'
apply plugin: 'signing'
version = '2.1.0'
group = 'de.undercouch'
sourceCompatibility = '1.8'
targetCompatibility = '1.8'
ext.isReleaseVersion = !version.endsWith("SNAPSHOT")
ext.junitVersion = "5.10.1"
repositories {
mavenCentral()
}
tasks.withType(JavaCompile) {
options.compilerArgs << "-Xlint"
}
dependencies {
testImplementation 'com.fasterxml.jackson.core:jackson-databind:2.16.0'
testImplementation 'commons-io:commons-io:2.15.1'
testImplementation("org.assertj:assertj-core:3.24.2")
testImplementation("org.junit.jupiter:junit-jupiter-api:$junitVersion")
testImplementation("org.junit.jupiter:junit-jupiter-engine:$junitVersion")
testImplementation("org.junit.jupiter:junit-jupiter-params:$junitVersion")
}
// package javadoc into a jar file
task packageJavadoc(type: Jar, dependsOn: 'javadoc') {
from javadoc.destinationDir
archiveClassifier = 'javadoc'
}
// package source into a jar file
task packageSources(type: Jar) {
from sourceSets.main.allSource
archiveClassifier = 'sources'
}
test {
useJUnitPlatform()
}
jacocoTestReport {
reports {
xml.required = true
html.required = true
}
}
check.dependsOn jacocoTestReport
java {
withJavadocJar()
withSourcesJar()
}
def isNonStable = { String version ->
def stableKeyword = ['RELEASE', 'FINAL', 'GA'].any { it -> version.toUpperCase().contains(it) }
def regex = /^[0-9,.v-]+(-r)?$/
return !stableKeyword && !(version ==~ regex)
}
tasks.named("dependencyUpdates").configure {
rejectVersionIf {
isNonStable(it.candidate.version) && !isNonStable(it.currentVersion)
}
}
publishing {
publications {
mavenJava(MavenPublication) {
from components.java
pom {
name = 'actson'
packaging = 'jar'
description = 'A reactive (non-blocking, asynchronous) JSON parser.'
url = 'https://michelkraemer.com'
scm {
url = 'scm:git:git://github.com/michel-kraemer/actson.git'
connection = 'scm:git:git://github.com/michel-kraemer/actson.git'
developerConnection = 'scm:git:git://github.com/michel-kraemer/actson.git'
}
licenses {
license {
name = 'The MIT License'
url = 'https://opensource.org/licenses/MIT'
distribution = 'repo'
}
}
developers {
developer {
id = 'michel-kraemer'
name = 'Michel Kraemer'
email = '[email protected]'
url = 'https://michelkraemer.com'
}
}
}
}
}
}
// sign all artifacts
signing {
useGpgCmd()
sign publishing.publications.mavenJava
}
tasks.withType(Sign) {
// only sign release artifacts and not snapshots
onlyIf { isReleaseVersion }
}
nexusPublishing {
repositories {
sonatype()
}
}