-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathbuild.gradle
171 lines (149 loc) · 4.28 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
plugins {
id 'java-library'
id 'maven-publish'
id 'signing'
id 'jacoco'
id 'io.codearte.nexus-staging' version '0.30.0'
}
repositories {
mavenLocal()
mavenCentral()
}
group = 'com.oblac'
version = '1.3.0'
java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
withSourcesJar()
withJavadocJar()
}
rootProject.description = 'A lightweight message queue for Java that requires no dedicated queue server.'
dependencies {
implementation 'redis.clients:jedis:2.10.2'
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.7.2'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.7.2'
}
javadoc {
options.addStringOption('Xdoclint:none', '-quiet')
if (JavaVersion.current().isJava9Compatible()) {
options.addBooleanOption('html5', true)
}
}
test {
useJUnitPlatform()
testLogging {
events "standardOut", "passed", "skipped", "failed"
showExceptions true
exceptionFormat "full"
showCauses true
showStackTraces true
afterSuite { desc, result ->
if (!desc.parent) { // will match the outermost suite
def output = "Results: ${result.resultType} (${result.testCount} tests, ${result.successfulTestCount} successes, ${result.failedTestCount} failures, ${result.skippedTestCount} skipped)"
def startItem = '| ', endItem = ' |'
def repeatLength = startItem.length() + output.length() + endItem.length()
println('\n' + ('-' * repeatLength) + '\n' + startItem + output + endItem + '\n' + ('-' * repeatLength))
}
}
}
}
jacocoTestReport {
reports {
xml.enabled false
csv.enabled false
html.enabled true
}
}
//
// MAVEN
//
ext.admin = hasProperty('sonatypeUsername')
publishing {
publications {
mavenJava(MavenPublication) {
from components.java
versionMapping {
usage('java-api') {
fromResolutionOf('runtimeClasspath')
}
usage('java-runtime') {
fromResolutionResult()
}
}
customizePom(pom, rootProject)
}
}
repositories {
maven {
url "https://oss.sonatype.org/service/local/staging/deploy/maven2"
if (admin) {
credentials {
username sonatypeUsername
password sonatypePassword
}
}
}
}
}
def customizePom(pom, gradleProject) {
pom.withXml {
def root = asNode()
// add all items necessary for maven central publication
root.children().last() + {
resolveStrategy = Closure.DELEGATE_FIRST
name 'JRSMQ'
description gradleProject.description
url 'https://githu.com/igr/jrsmq'
organization {
name 'Oblac'
url 'https://oblac.com'
}
issueManagement {
system 'GitHub'
url 'https://github.com/igr/jrsmq/issues'
}
licenses {
license {
name 'The New BSD License'
url 'https://github.com/igr/jrsmq/blob/master/LICENSE'
distribution 'repo'
}
}
scm {
url 'https://github.com/igr/jrsmq'
connection 'scm:git:git://github.com/igr/jrsmq.git'
developerConnection 'scm:git:ssh://git@github.com/igr/jrsmq.git'
}
developers {
developer {
id 'igor'
name 'Igor Spasić'
email 'igor@jodd.org'
timezone '+1'
}
}
}
}
}
signing {
required { admin }
sign publishing.publications.mavenJava
}
task install(dependsOn: publishToMavenLocal) {
group = 'Publishing'
description = 'Installs artifacts to local Maven repository'
}
//
// RELEASE
//
task release() {
group 'Project'
description 'Builds everything for the release.'
dependsOn build
dependsOn javadoc
dependsOn jacocoTestReport
}
//
// ADDON
//
apply from: "redis.gradle"