-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
178 lines (153 loc) · 4.52 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
import net.swisstech.swissarmyknife.sys.linux.BackgroundProcess
// repositories and dependencies for buildscript itself
buildscript {
repositories {
mavenLocal()
mavenCentral()
jcenter()
}
dependencies {
classpath 'net.swisstech:swissarmyknife:+'
}
}
plugins {
id 'java'
id 'jacoco'
id 'maven-publish'
id 'project-report'
id 'com.jfrog.bintray' version '1.8.4'
}
description = 'Client for the ArangoDB Write-Ahead-Log (WAL) over HTTP'
group = 'net.swisstech'
version = '2.0.0'
// re-use repositories from buildscript
buildscript.repositories.each { repositories.add(it) }
// java version
sourceCompatibility = 1.8
targetCompatibility = 1.8
// task to generate wrapper
wrapper {
gradleVersion = '4.10'
}
// source-code jar
task sourceJar(type: Jar) {
from sourceSets.main.allSource
}
// bintray uses the publication, also includes source jar
publishing {
publications {
mavenJava(MavenPublication) {
from components.java
artifact sourceJar {
classifier 'sources'
}
}
}
}
bintray {
// key and user must be in your ~/.gradle/gradle.properties
user = project.hasProperty('swisstech_bintray_user') ? project.swisstech_bintray_user : System.getenv('SWISSTECH_BINTRAY_USER')
key = project.hasProperty('swisstech_bintray_apikey') ? project.swisstech_bintray_apikey : System.getenv('SWISSTECH_BINTRAY_KEY')
dryRun = false
publish = true
publications = [ 'mavenJava' ]
pkg {
repo = 'maven'
name = project.name
desc = project.description
licenses = [ 'Apache-2.0' ]
websiteUrl = "https://github.com/stackmagic/${project.name}"
vcsUrl = "https://github.com/stackmagic/${project.name}.git"
issueTrackerUrl = "https://github.com/stackmagic/${project.name}/issues"
publicDownloadNumbers = true
version {
name = project.version
desc = project.description
}
}
}
// extra configuration for integration tests
configurations {
intTestCompile
}
sourceSets {
intTest {
compileClasspath = sourceSets.main.output + configurations.testRuntime
runtimeClasspath = sourceSets.main.output + configurations.testRuntime + output
}
}
// project dependencies
ext.versions = [
jackson : '2.5.0'
, okhttp : '2.2.0'
, commons_io : '2.4'
, swissarmyknife : '1.2.0'
, slf4j : '1.8.0-beta2'
, testng : '6.8.17'
, mockito : '1.10.19'
]
dependencies {
compile "com.fasterxml.jackson.core:jackson-databind:${versions.jackson}"
compile "com.squareup.okhttp:okhttp:${versions.okhttp}"
compile "commons-io:commons-io:${versions.commons_io}"
compile "net.swisstech:swissarmyknife:${versions.swissarmyknife}"
testCompile "org.slf4j:slf4j-simple:${versions.slf4j}"
testCompile "org.testng:testng:${versions.testng}"
testCompile "org.mockito:mockito-all:${versions.mockito}"
intTestCompile "org.slf4j:slf4j-simple:${versions.slf4j}"
intTestCompile "org.testng:testng:${versions.testng}"
intTestCompile "org.mockito:mockito-all:${versions.mockito}"
}
// normal unit tests
test {
useTestNG()
jacoco {
destinationFile = file("${buildDir}/jacoco.ut.exec")
}
}
// setup for integration tests, requires a local installation of arangodb
ext.arangoDbPort = 18529
ext.arangoDbLaunchCommand = [
'/usr/bin/docker', 'run',
'--env', 'ARANGO_NO_AUTH=1',
'--publish', "${project.arangoDbPort}:8529",
'--rm',
'arangodb'
// 'arangodb/arangodb-preview'
]
task('intTest', type: Test, dependsOn: 'intTestClasses') {
useTestNG()
testLogging.showStandardStreams = true
group = 'verification'
testClassesDirs = sourceSets.intTest.output.classesDirs
classpath = sourceSets.intTest.runtimeClasspath
systemProperty 'ARANGODB_PORT', project.arangoDbPort
jacoco {
destinationFile = file("${buildDir}/jacoco.it.exec")
}
}
jacocoTestReport {
reports.html.destination = file("${reportsDir}/jacoco/${name}")
}
task('jacocoIntTestReport', type: JacocoReport) {
reports.html.destination = file("${reportsDir}/jacoco/${name}")
executionData intTest
sourceSets sourceSets.main
}
// start & stop arangodb
afterEvaluate {
task('dockerCommand').doLast {
println project.arangoDbLaunchCommand.join(' ')
}
task('startArangoDb').doLast {
project.ext.arangodb_process =
BackgroundProcess
.launch(project.arangoDbLaunchCommand, null)
.waitForStringInStdout('ready for business', 15 * 1000)
}
task('stopArangoDb').doLast {
project.arangodb_process.shutdown()
}
tasks.intTest.dependsOn('startArangoDb')
tasks.intTest.finalizedBy('stopArangoDb')
}