-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.gradle
128 lines (99 loc) · 3.48 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
apply from: "$rootDir/project-settings.gradle"
buildscript {
repositories {
jcenter()
maven {
url 'http://oss.sonatype.org/content/repositories/snapshots'
}
mavenCentral()
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
classpath "net.ltgt.gradle:gradle-apt-plugin:0.13"
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7.3'
classpath "io.codearte.gradle.nexus:gradle-nexus-staging-plugin:0.11.0"
}
}
apply from: "$rootDir/gradle/sonatype-top.gradle"
apply from: "$rootDir/gradle/kotlin-settings.gradle"
apply plugin: 'net.ltgt.apt'
apply from: "$rootDir/gradle/idea.gradle"
apply from: "$rootDir/gradle/sonatype-subproj.gradle"
apply from: "$rootDir/gradle/bintray.gradle"
repositories {
mavenCentral()
maven {
url = 'http://oss.sonatype.org/content/repositories/snapshots/'
}
}
dependencies {
compile "io.vertx:vertx-core:$version_vertx"
compile "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlinVersion"
compile "com.amazonaws:aws-java-sdk-kinesis:$version_kinesis"
compile "nl.komponents.kovenant:kovenant:$version_kovenant"
compileOnly "io.vertx:vertx-codegen:$version_vertx"
apt "io.vertx:vertx-codegen:$version_vertx"
apt "io.vertx:vertx-codegen:$version_vertx:processor"
testCompile "io.vertx:vertx-unit:$version_vertx"
testCompile "io.vertx:vertx-lang-groovy:$version_vertx"
testCompile "io.vertx:vertx-lang-js:$version_vertx"
testCompile "io.vertx:vertx-service-factory:$version_vertx"
testCompile "io.vertx:vertx-hazelcast:$version_vertx"
testCompile "io.vertx:vertx-service-proxy:$version_vertx"
testCompile "org.jetbrains.kotlin:kotlin-test-junit:$kotlinVersion"
// fix for bad dependency
compile "com.fasterxml.jackson.dataformat:jackson-dataformat-cbor:2.9.3"
}
task runNpmKinesalite(type: Exec) {
commandLine 'npm', 'install', 'kinesalite'
}
task startKinesalite(type: ExecWait) {
command "$rootDir/node_modules/.bin/kinesalite"
ready 'Listening at'
directory '..'
}
test {
dependsOn runNpmKinesalite, startKinesalite
}
// https://fbflex.wordpress.com/2013/03/14/gradle-madness-execwait-a-task-that-waits-for-commandline-calls-to-be-ready/
class ExecWait extends DefaultTask {
String command
String ready
String directory
@TaskAction
def spawnProcess() {
ProcessBuilder builder = new ProcessBuilder(command.split(' '))
builder.redirectErrorStream(true)
builder.directory(new File(directory))
Process process = builder.start()
InputStream stdout = process.getInputStream()
BufferedReader reader = new BufferedReader(new InputStreamReader(stdout))
def line
while ((line = reader.readLine()) != null) {
println line
if (line.contains(ready)) {
println "$command is ready"
break;
}
}
}
}
task freeAllPorts << {
def ports = [4567]
ports.each { port ->
def cmd = "lsof -Fp -i :$port"
def process = cmd.execute()
process.in.eachLine { line ->
def killProcess = "kill -9 ${ line.substring(1) }".execute()
killProcess.waitFor()
}
}
}
test.finalizedBy(freeAllPorts)
task wrapper(type: Wrapper) {
gradleVersion = "$version_gradle"
}
defaultTasks 'clean', 'build', 'check'