This repository has been archived by the owner on Aug 28, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
121 lines (103 loc) · 3.4 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
buildscript {
apply from: 'https://raw.githubusercontent.com/comodal/gradle-conf/master/plugins.gradle'
dependencies {
classpath "$axion"
classpath "$bintray"
}
}
ext {
desc = 'Distributed systems locks backed by Redis.'
}
apply from: 'https://raw.githubusercontent.com/comodal/gradle-conf/master/java/java.gradle'
apply from: 'https://raw.githubusercontent.com/comodal/gradle-conf/master/axion.gradle'
apply from: 'https://raw.githubusercontent.com/comodal/gradle-conf/master/comodal.gradle'
apply from: 'https://raw.githubusercontent.com/comodal/gradle-conf/master/java/bintray-maven.gradle'
apply from: 'https://raw.githubusercontent.com/comodal/gradle-conf/master/java/checks.gradle'
apply plugin: 'findbugs'
dependencies {
compile 'com.fabahaba:jedipus:+'
}
sourceSets {
main {
java {
srcDir 'src/core/java'
srcDir 'src/modules/java'
srcDir 'src/lua/java'
}
resources {
srcDir 'src/lua/resources'
}
}
test {
java {
srcDir 'src/unit/java'
srcDir 'src/integ/java'
}
resources {
srcDir 'src/unit/resources'
srcDir 'src/integ/resources'
}
}
}
test {
outputs.upToDateWhen { false }
testLogging {
events "failed", "standardOut", "standardError"
showExceptions true
showStackTraces true
exceptionFormat "full"
}
systemProperty 'redislocks.redis.port', '9736'
}
task startRedis(type: Exec) {
commandLine 'docker-compose', 'up', '-d'
}
task rmRedis(type: Exec) {
commandLine 'docker-compose', 'down'
}
task getRedisModule() {
OutputStream moduleHeaderFile = new File('./redis/redismodule.h').newOutputStream()
moduleHeaderFile << new URL('https://raw.githubusercontent.com/antirez/redis/unstable/src/redismodule.h').openStream()
moduleHeaderFile.close()
}
task compileIntegModules(type: Exec) {
String dir = System.getProperty("user.dir");
commandLine 'docker', 'run', '--rm', '-v', "$dir/redis/:/tmp", 'comodal/alpine-gcc-make:latest', '/bin/sh', '-c', 'make -B -C /tmp/modules'
}
task makeClean(type: Exec) {
String dir = System.getProperty("user.dir");
commandLine 'docker', 'run', '--rm', '-v', "$dir/redis/:/tmp", 'comodal/alpine-gcc-make:latest', '/bin/sh', '-c', 'make -C /tmp/modules clean'
}
compileIntegModules.dependsOn getRedisModule
startRedis.dependsOn compileIntegModules
test.dependsOn startRedis
test.finalizedBy rmRedis
rmRedis.finalizedBy makeClean
findbugs {
toolVersion = "+"
effort = "max"
reportLevel = "low"
ignoreFailures = false
}
tasks.withType(FindBugs) {
reports {
xml.enabled = false
html.enabled = true
}
}
gradle.addListener(new TestEventLogger())
class TestEventLogger implements org.gradle.api.tasks.testing.TestListener {
void beforeSuite(TestDescriptor suite) {
if (suite.getClassName() != null) {
println 'Running ' + suite.getClassName() + ' test suite.'
}
}
void afterSuite(TestDescriptor suite, TestResult result) {
}
void beforeTest(TestDescriptor test) {
println '\n' + test.getName() + ' STARTED @ ' + new Date().toTimestamp()
}
void afterTest(TestDescriptor test, TestResult result) {
println test.getName() + ' ' + result.getResultType() + ' in ' + (result.getEndTime() - result.getStartTime()) + 'ms.'
}
}