forked from bwaldvogel/mongo-java-server
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
220 lines (184 loc) · 6.54 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
buildscript {
repositories {
mavenCentral()
}
}
plugins {
id 'com.github.kt3k.coveralls' version '2.10.1'
id 'com.github.johnrengelman.shadow' version '5.2.0'
id 'org.sonarqube' version '3.0'
}
allprojects {
apply plugin: 'java-library'
apply plugin: 'jacoco'
apply plugin: 'maven-publish'
apply plugin: 'signing'
version = '1.39.0-SNAPSHOT'
group = 'de.bwaldvogel'
sourceCompatibility = 1.8
targetCompatibility = 1.8
compileJava.options.encoding = 'UTF-8'
repositories {
mavenCentral()
}
dependencies {
components.all { ComponentMetadataDetails details ->
details.statusScheme = ['candidate', 'release']
if (details.id.version =~ /(?i).+(-|\.)(CANDIDATE|RC|BETA|ALPHA|PR|M\d+).*/) {
details.status = 'candidate'
} else {
details.status = 'release'
}
}
}
dependencyLocking {
lockAllConfigurations()
}
task resolveAndLockAll {
doFirst {
assert gradle.startParameter.writeDependencyLocks
}
doLast {
configurations.findAll {
// Add any custom filtering on the configurations to be resolved
it.canBeResolved
}.each { it.resolve() }
}
}
}
subprojects {
dependencies {
implementation group: 'org.slf4j', name: 'slf4j-api', version: 'latest.release'
testImplementation group: 'org.junit.jupiter', name: 'junit-jupiter-api', version: 'latest.release'
testImplementation group: 'org.junit.jupiter', name: 'junit-jupiter-params', version: 'latest.release'
testRuntimeOnly group: 'org.junit.jupiter', name: 'junit-jupiter-engine', version: 'latest.release'
testImplementation group: 'org.assertj', name: 'assertj-core', version: 'latest.release'
testRuntimeOnly group: 'ch.qos.logback', name: 'logback-classic', version: 'latest.release'
testRuntimeOnly group: 'org.slf4j', name: 'jcl-over-slf4j', version: 'latest.release'
}
test {
useJUnitPlatform()
maxHeapSize = "256m"
systemProperties['io.netty.leakDetectionLevel'] = 'advanced'
}
}
ext {
title = 'mongo-java-server'
isReleaseVersion = !version.endsWith('SNAPSHOT')
}
jar {
manifest {
attributes 'Implementation-Title': title, 'Implementation-Version': archiveVersion
}
}
allprojects {
task sourceJar(type: Jar) {
archiveClassifier = "sources"
from sourceSets.main.allJava
}
task javadocJar(type: Jar, dependsOn: javadoc) {
archiveClassifier = "javadoc"
from javadoc.destinationDir
}
publishing {
publications {
mavenJava(MavenPublication) {
groupId = 'de.bwaldvogel'
artifactId = project.name
version = project.version
pom {
name = title
description = 'Fake implementation of MongoDB in Java that speaks the wire protocol'
url = 'https://github.com/bwaldvogel/mongo-java-server'
inceptionYear = '2012'
licenses {
license {
name = 'The BSD License'
url = 'http://www.opensource.org/licenses/bsd-license.php'
distribution = 'repo'
}
}
developers {
developer {
id = 'bwaldvogel'
name = 'Benedikt Waldvogel'
email = '[email protected]'
}
}
scm {
url = '[email protected]:bwaldvogel/mongo-java-server.git'
connection = 'scm:git:[email protected]:bwaldvogel/mongo-java-server.git'
developerConnection = 'scm:git:[email protected]:bwaldvogel/mongo-java-server.git'
}
}
from components.java
artifact sourceJar
artifact javadocJar
versionMapping {
usage('java-api') {
fromResolutionOf('runtimeClasspath')
}
usage('java-runtime') {
fromResolutionResult()
}
}
}
}
repositories {
maven {
url isReleaseVersion ? 'https://oss.sonatype.org/service/local/staging/deploy/maven2' : 'https://oss.sonatype.org/content/repositories/snapshots/'
credentials {
username = project.hasProperty('nexusUsername') ? project.property('nexusUsername') : System.getenv('NEXUS_USERNAME')
password = project.hasProperty('nexusPassword') ? project.property('nexusPassword') : System.getenv('NEXUS_PASSWORD')
}
}
}
}
signing {
useGpgCmd()
sign publishing.publications.mavenJava
}
tasks.withType(Sign) {
onlyIf { isReleaseVersion }
}
}
wrapper {
gradleVersion = "6.8"
distributionType = Wrapper.DistributionType.ALL
}
task jacocoMerge(type: JacocoMerge) {
subprojects.each { subproject ->
executionData subproject.tasks.withType(Test)
}
doFirst {
executionData = files(executionData.findAll { it.exists() })
}
}
task jacocoRootReport(type: JacocoReport, group: 'Coverage reports') {
description = 'Generates an aggregate report from all subprojects'
dependsOn subprojects.test, jacocoMerge
additionalSourceDirs.from = files(subprojects.sourceSets.main.allSource.srcDirs)
sourceDirectories.from = files(subprojects.sourceSets.main.allSource.srcDirs)
classDirectories.from = files(subprojects.sourceSets.main.output)
executionData jacocoMerge.destinationFile
reports {
html.enabled = true // human readable
xml.enabled = true // required by coveralls
}
}
javadoc {
options.addBooleanOption('html5', true)
}
coveralls {
sourceDirs = subprojects.sourceSets.main.allSource.srcDirs.flatten()
jacocoReportPath = "${buildDir}/reports/jacoco/jacocoRootReport/jacocoRootReport.xml"
}
tasks.coveralls {
group = 'Coverage reports'
description = 'Uploads the aggregated coverage report to Coveralls'
dependsOn jacocoRootReport
}
dependencies {
api project(':mongo-java-server-core')
api project(':mongo-java-server-memory-backend')
}