-
Notifications
You must be signed in to change notification settings - Fork 33
/
build.gradle
182 lines (150 loc) · 5.24 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
plugins {
id 'java-library'
id "com.diffplug.gradle.spotless" version "3.24.3"
id 'io.codearte.nexus-staging' version '0.21.2'
id "de.marcphilipp.nexus-publish" version "0.3.0"
id "com.github.johnrengelman.shadow" version "5.2.0"
}
ext {
gitVersion = getGitVersion()
gitLastComment = getGitLastComment()
javaDataLoader = "com.mongodb.jdbc.integration.testharness.DataLoader"
javaTestGenerator = "com.mongodb.jdbc.integration.testharness.TestGenerator"
}
spotless {
java {
googleJavaFormat('1.1').aosp()
}
}
sourceSets {
integrationTest {
java {
compileClasspath += main.output
runtimeClasspath += main.output
srcDir file('src/integration-test/java')
exclude '**/MySQLIntegrationTest.java'
}
resources.srcDir file('src/integration-test/resources')
}
tdvtTest {
java {
compileClasspath += main.output
runtimeClasspath += main.output
srcDir file('src/tdvt/java')
}
resources.srcDir file('src/tdvt/resources')
}
}
allprojects {
apply plugin: 'idea'
apply plugin: 'java'
apply plugin: 'com.github.johnrengelman.shadow'
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = sourceCompatibility
repositories {
mavenCentral()
}
dependencies {
// MongoDB
implementation group: 'org.mongodb', name: 'mongodb-driver-sync', version: mongodbDriverVersion
implementation group: 'org.mongodb', name: 'mongodb-driver-core', version: mongodbDriverVersion
implementation group: 'org.mongodb', name: 'mongodb-driver', version: mongodbDriverVersion
implementation group: 'com.google.guava', name: 'guava', version: guavaVersion
implementation group: 'org.apache.commons', name: 'commons-lang3', version: lang3Version
testCompile group: 'junit', name: 'junit', version: junitVersion
// Test
testImplementation group: 'org.junit.jupiter', name: 'junit-jupiter-api', version: junitJupiterVersion
testRuntimeOnly group: 'org.junit.jupiter', name: 'junit-jupiter-engine', version: junitJupiterVersion
testCompile group: 'org.mockito', name: 'mockito-core', version: mockitoVersion
testCompile group: 'org.mockito', name: 'mockito-junit-jupiter', version: mockitoVersion
}
test {
useJUnitPlatform()
failFast = true
}
task sourceJar(type: Jar) {
from sourceSets.main.allJava
classifier "sources"
}
task testJar(type: Jar) {
from sourceSets.test.allJava
classifier "test"
}
task javadocJar(type: Jar) {
from javadoc
classifier 'javadoc'
}
artifacts {
sourceJar
testJar
javadocJar
}
}
configurations {
integrationTestImplementation.extendsFrom implementation
integrationTestRuntimeOnly.extendsFrom runtimeOnly
tdvtTestImplementation.extendsFrom implementation
tdvtTestRuntimeOnly.extendsFrom runtimeOnly
}
task integrationTest(type: Test) {
useJUnitPlatform()
description = 'Runs integration tests.'
group = 'verification'
testClassesDirs = sourceSets.integrationTest.output.classesDirs
classpath = sourceSets.integrationTest.runtimeClasspath
shouldRunAfter test
}
check.dependsOn integrationTest
task tdvtTest(type: Test) {
description = 'Runs tdvt tests.'
group = 'verification'
testClassesDirs = sourceSets.tdvtTest.output.classesDirs
classpath = sourceSets.tdvtTest.runtimeClasspath
shouldRunAfter test
}
check.dependsOn tdvtTest
task runTestGenerator(type: JavaExec) {
group = "Execution"
description = "Run the integration test baseline file generator."
classpath = sourceSets.integrationTest.runtimeClasspath
main = javaTestGenerator
}
task runDataLoader(type: JavaExec) {
group = "Execution"
description = "Run the data loader."
classpath = sourceSets.integrationTest.runtimeClasspath
main = javaDataLoader
}
jar {
manifest {
attributes('Implementation-Title': project.name,
'Implementation-Version': project.version)
}
}
dependencies {
implementation "org.yaml:snakeyaml:$snakeYamlVersion"
api "org.mongodb:mongodb-driver-sync:$mongodbDriverVersion"
api "org.mongodb:mongodb-driver:$mongodbDriverVersion"
integrationTestImplementation "org.junit.jupiter:junit-jupiter:$junitJupiterVersion"
integrationTestImplementation group: 'org.junit.jupiter', name: 'junit-jupiter-api', version: junitJupiterVersion
tdvtTestImplementation "junit:junit:$junitVersion"
tdvtTestImplementation group: 'org.junit.jupiter', name: 'junit-jupiter-api', version: junitJupiterVersion
}
def getGitVersion() {
def describeStdOut = new ByteArrayOutputStream()
exec {
commandLine 'git', 'describe', '--tags', '--always', '--dirty'
standardOutput = describeStdOut
}
describeStdOut.toString().substring(1).trim()
}
def getGitLastComment() {
def describeStdOut = new ByteArrayOutputStream()
exec {
commandLine 'git', 'log', '-1', '--pretty=%B'
standardOutput = describeStdOut
}
describeStdOut.toString().trim()
}
apply from: 'gradle/publish.gradle'
apply from: 'gradle/deploy.gradle'