forked from Baqend/Orestes-Bloomfilter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
163 lines (135 loc) · 5.71 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
import org.apache.tools.ant.filters.ReplaceTokens
plugins {
id 'com.jfrog.bintray' version "1.1"
id 'net.researchgate.release' version '2.2.1'
}
apply plugin: 'java'
apply plugin: 'maven'
apply plugin: 'java-library-distribution'
repositories {
mavenCentral()
}
dependencies {
compile(
'com.google.code.gson:gson:2.5',
'redis.clients:jedis:2.9.0',
//'org.apache.commons:commons-pool2:2.2',
'org.slf4j:slf4j-api:1.7.12',
"org.projectlombok:lombok:1.16.4",
'org.slf4j:slf4j-api:1.7.7',
'org.slf4j:log4j-over-slf4j:1.7.7'
)
testCompile(
'junit:junit:4.11',
'org.apache.commons:commons-math:2.2',
'com.google.guava:guava:18.0',
'org.apache.commons:commons-lang3:3.0'
)
}
group = "com.baqend"
distTar.compression "GZIP"
task wrapper(type: Wrapper) {
gradleVersion = '2.3'
}
task javadocJar(type: Jar) {
classifier = 'javadoc'
from javadoc
}
task sourcesJar(type: Jar) {
classifier = 'sources'
from sourceSets.main.allSource
}
test {
dependsOn 'startRedis'
finalizedBy 'stopRedis'
}
artifacts {
archives javadocJar, sourcesJar
}
release {
preTagCommitMessage = "[ci skip] pre tag commit:"
tagCommitMessage = "creating tag:"
newVersionCommitMessage = "[ci skip] new version commit:"
buildTasks = ['assemble']
git {
requireBranch = 'master'
pushToRemote = 'github'
pushToCurrentBranch = false
}
}
afterReleaseBuild.dependsOn bintrayUpload
bintray {
user = project.properties.get('bintray_user')
key = project.properties.get('bintray_api_key')
configurations = ['archives'] //When uploading configuration files
dryRun = false //Whether to run this as dry-run, without deploying
publish = true //If version should be auto published after an upload
pkg {
repo = 'maven'
userOrg = 'baqend' //An optional organization name when the repo belongs to one of the user's orgs
name = 'Orestes-Bloomfilter'
desc = 'Library of different Bloom filters in Java with optional Redis-backing, counting and many hashing options'
websiteUrl = 'https://github.com/Baqend/Orestes-Bloomfilter'
issueTrackerUrl = 'https://github.com/Baqend/Orestes-Bloomfilter/issues'
vcsUrl = '[email protected]:Baqend/Orestes-Bloomfilter.git'
licenses = ['MIT']
labels = ['bloomfilter', 'redis', 'memory', 'counting bloomfilter']
publicDownloadNumbers = true
}
}
task startRedis() {
//redis master port 6385
//redis slave ports 6386 6387
//redis sentinel ports 16385 16386 16387
//redis standalone ports 6379 6380
doLast {
//redis currently does not support a docker setup with docker networks
//https://github.com/antirez/redis/issues/2527
copy {
from 'conf' into "$buildDir/node1" filter(ReplaceTokens, tokens: [redis_port: "6385", sentinel_port: "16385", master_port: "6385"]) fileMode 0777
}
copy {
from 'conf' into "$buildDir/node2" filter(ReplaceTokens, tokens: [redis_port: "6386", sentinel_port: "16386", master_port: "6385"]) fileMode 0777
}
copy {
from 'conf' into "$buildDir/node3" filter(ReplaceTokens, tokens: [redis_port: "6387", sentinel_port: "16387", master_port: "6385"]) fileMode 0777
}
copy { from 'conf' into "$buildDir/master" filter(ReplaceTokens, tokens: [redis_port: "6379", master_port: "6379"]) fileMode 0777 }
copy { from 'conf' into "$buildDir/slave" filter(ReplaceTokens, tokens: [redis_port: "6380", master_port: "6379"]) fileMode 0777 }
//sh "docker network create bf-cluster"
sh "docker run -d -v $buildDir/node1/redis.conf:/redis.conf --name=redis-node1 --net=host redis redis-server /redis.conf"
sh "docker run -d -v $buildDir/node2/slave.conf:/redis.conf --name=redis-node2 --net=host redis redis-server /redis.conf"
sh "docker run -d -v $buildDir/node3/slave.conf:/redis.conf --name=redis-node3 --net=host redis redis-server /redis.conf"
sh "docker run -d -v $buildDir/node1/sentinel.conf:/redis.conf --name=redis-sentinel1 --net=host redis redis-server /redis.conf --sentinel"
sh "docker run -d -v $buildDir/node2/sentinel.conf:/redis.conf --name=redis-sentinel2 --net=host redis redis-server /redis.conf --sentinel"
sh "docker run -d -v $buildDir/node3/sentinel.conf:/redis.conf --name=redis-sentinel3 --net=host redis redis-server /redis.conf --sentinel"
//sh "docker network create bf-standalone"
sh "docker run -d -v $buildDir/master/redis.conf:/redis.conf --name=redis-master --net=host redis redis-server /redis.conf"
sh "docker run -d -v $buildDir/slave/slave.conf:/redis.conf --name=redis-slave --net=host redis redis-server /redis.conf"
}
}
task stopRedis() {
doLast {
try {
sh "docker rm -f redis-sentinel1 redis-sentinel2 redis-sentinel3 redis-node1 redis-node2 redis-node3 redis-master redis-slave"
} catch (ignore) {
}
try {
//sh "docker network rm bf-cluster bf-standalone"
} catch (ignore) {
}
}
}
def sh(command, workingDir = buildDir, returnOutput = false) {
println "> $command"
def process = new ProcessBuilder(command.split(" "))
.directory(file(workingDir))
.redirectError(ProcessBuilder.Redirect.INHERIT)
.redirectOutput(returnOutput ? ProcessBuilder.Redirect.PIPE : ProcessBuilder.Redirect.INHERIT)
.start()
def code = process.waitFor()
if (code != 0)
throw new GradleScriptException("$command failed with status code " + code, null);
if (returnOutput)
return process.text
}