forked from crate/crate-mesos-framework
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.gradle
More file actions
176 lines (147 loc) · 5.28 KB
/
build.gradle
File metadata and controls
176 lines (147 loc) · 5.28 KB
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
plugins {
id "eu.appsatori.fatjar" version "0.3"
}
apply plugin: 'java'
apply plugin: 'idea'
sourceCompatibility = 1.7
targetCompatibility = 1.7
group = 'io.crate'
task wrapper(type: Wrapper) {
gradleVersion = '2.13'
}
ext {
// crate
crateClientVersion="0.54.8"
// mesos
mesosVersion="0.28.1"
minimesosVersion = "0.9.0"
awaitilityVersion = "1.7.0"
// testing
junitVersion="4.12"
mockitoVersion="1.10.19"
hamcrestAllVersion="1.3"
// jersey
jerseyContainerGrizzly2Version="2.16"
jerseyMediaJsonJackson="2.16"
// apache
apacheHttpClientVersion="4.4.1"
apacheCommonIOVersion="1.3.2"
// utils
log4jVersion="1.7.12"
jetbrainsAnnotationsVersion="13.0"
jcommanderVersion="1.30"
guavaVersion="0.19.0"
//apache curator
curatorVersion = "3.0.0"
}
repositories {
jcenter()
maven { url "https://jitpack.io" }
}
dependencies {
compile "com.jayway.awaitility:awaitility:$awaitilityVersion"
compile "org.apache.mesos:mesos:$mesosVersion"
compile "org.glassfish.jersey.containers:jersey-container-grizzly2-http:$jerseyContainerGrizzly2Version"
compile "org.glassfish.jersey.media:jersey-media-json-jackson:$jerseyMediaJsonJackson"
compile "com.google.guava:guava:$guavaVersion"
compile "com.beust:jcommander:$jcommanderVersion"
compile "org.jetbrains:annotations:$jetbrainsAnnotationsVersion"
compile "io.crate:crate-client:$crateClientVersion"
compile "org.apache.httpcomponents:httpclient:$apacheHttpClientVersion"
compile "org.apache.commons:commons-io:$apacheCommonIOVersion"
compile "com.github.ContainerSolutions:minimesos:$minimesosVersion"
compile "org.apache.curator:curator-framework:$curatorVersion"
testCompile "org.hamcrest:hamcrest-all:$hamcrestAllVersion"
testCompile ("junit:junit:$junitVersion") {
exclude group: 'org.hamcrest', module: 'hamcrest-core'
}
testCompile ("org.mockito:mockito-core:$mockitoVersion") {
exclude group: 'org.hamcrest', module: 'hamcrest-core'
}
}
test {
exclude '**/*IntegrationTest.*'
testLogging {
// Show that tests are run in the command-line output
events 'started'
}
}
task itest(type: Test) {
dependsOn fatJar
include '**/*IntegrationTest.*'
environment 'DOCKER_TLS_VERIFY', System.getenv("DOCKER_TLS_VERIFY")
environment 'DOCKER_HOST', System.getenv("DOCKER_HOST")
environment 'DOCKER_CERT_PATH', System.getenv("DOCKER_CERT_PATH")
}
task getVersion (dependsOn: 'classes') << {
def stdout = new ByteArrayOutputStream()
javaexec {
classpath = sourceSets.main.runtimeClasspath
main = 'io.crate.frameworks.mesos.Version'
standardOutput = stdout
}
ext.gitTag = "git describe".execute().in.text.trim()
ext.version = stdout.toString().trim().split(" ")[1].replace(',','').trim()
if (gradle.taskGraph.hasTask(release)) {
assert gitTag == version, "Version conflict: git tag: '" + gitTag + "' does not match release version: '" + version + "'"
} else if (gradle.taskGraph.hasTask(snapshotRelease)) {
assert version.endsWith("-SNAPSHOT"), "Version conflict: version does not end with -SNAPSHOT"
version = version + "-" + "git rev-parse --short HEAD".execute().in.text.trim()
}
logger.quiet("----------------------------")
logger.quiet(" gitTag: " + gitTag)
logger.quiet(" version: " + version)
logger.quiet("----------------------------")
project.version = version
}
task snapshotRelease(dependsOn: 'fatJar') << {
logger.quiet("Snapshot Release: " + project.name + " (" + getVersion.version + ")");
}
task release(dependsOn: 'fatJar') << {
logger.quiet("Release: " + project.name + " (" + getVersion.version + ")");
}
fatJar {
dependsOn getVersion
doFirst {
manifest {
attributes 'Implementation-Version': getVersion.version
}
}
manifest {
attributes 'Main-Class': 'io.crate.frameworks.mesos.Main',
'Implementation-Title': 'Crate Mesos Framework',
'Built-Date': new Date(),
'Built-JDK': System.getProperty('java.version'),
'Built-Gradle': gradle.gradleVersion
}
}
fatJarPrepareFiles {
exclude 'META-INF/*.RSA', 'META-INF/*.SF','META-INF/*.DSA'
}
def jvmTestFlags = ['-ea']
idea {
project {
languageLevel = 'JDK_1_7'
ipr {
withXml { provider ->
def node = provider.asNode()
def copyrightManager = node.component.find { it.'@name' == 'CopyrightManager' }
copyrightManager.@default = "CrateASL2"
def aslCopyright = copyrightManager.copyright.find { it.option.find { it.@name == "myName" }?.@value == "CrateASL2" }
if (aslCopyright == null) {
copyrightManager.append(new XmlParser().parse(file("copyright.xml")))
}
}
}
}
workspace {
iws.withXml { xmlFile ->
def runManager = xmlFile.asNode().component.find { it.@name == 'RunManager' }
// enable assertions for junit tests
def junitDefaults = runManager.configuration.find { it.@default == 'true' && it.@type == 'JUnit' }
junitDefaults.option.find { it.@name == 'VM_PARAMETERS' }.replaceNode {
option(name: 'VM_PARAMETERS', value: jvmTestFlags.join(' '))
}
}
}
}