forked from elastic/elasticsearch
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
217 lines (184 loc) · 7.87 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
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
import java.text.SimpleDateFormat
defaultTasks "clean", "release"
apply plugin: 'base'
archivesBaseName = 'elasticsearch'
buildTime = new Date()
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
sdf.setTimeZone(TimeZone.getTimeZone("UTC"));
buildTimeStr = sdf.format(buildTime)
versionNumber = '0.19.0-SNAPSHOT'
explodedDistDir = new File(distsDir, 'exploded')
explodedDistLibDir = new File(explodedDistDir, 'lib')
explodedDistBinDir = new File(explodedDistDir, 'bin')
explodedDistConfigDir = new File(explodedDistDir, 'config')
mavenRepoUrl = System.getenv("REPO_URL");
if (mavenRepoUrl == null) {
// mavenRepoUrl = "file://localhost/" + projectDir.absolutePath + "/build/maven/repository"
mavenRepoUrl = "http://oss.sonatype.org/service/local/staging/deploy/maven2/"
}
mavenSnapshotRepoUrl = System.getenv("SNAPSHOT_REPO_URL");
if (mavenSnapshotRepoUrl == null) {
// mavenSnapshotRepoUrl = "file://localhost/" + projectDir.absolutePath + "/build/maven/snapshotRepository"
mavenSnapshotRepoUrl = "http://oss.sonatype.org/content/repositories/snapshots"
}
mavenRepoUser = System.getenv("REPO_USER")
mavenRepoPass = System.getenv("REPO_PASS")
jarjarArchivePath = project(":jarjar").file("build/libs/jarjar-$versionNumber" + ".jar").absolutePath
allprojects {
group = 'org.elasticsearch'
version = versionNumber
plugins.withType(JavaPlugin).whenPluginAdded {
sourceCompatibility = 1.6
targetCompatibility = 1.6
compileJava {
sourceCompatibility = 1.6
targetCompatibility = 1.6
options.encoding = "UTF8"
}
javadoc {
maxMemory = "1g"
options.encoding = "UTF8"
}
test {
useTestNG()
String testSuiteName = project.name
suiteName = project.name
workingDir = rootProject.projectDir
options {
suiteNamte = testSuiteName
listeners << 'org.elasticsearch.util.testng.Listeners'
}
maxHeapSize = '1g'
systemProperties["es.logger.prefix"] = ""
systemProperties["es.test.log.conf"] = System.getProperty("es.test.log.conf", "log4j-gradle.properties")
systemProperties["es.test.log.conf"] = System.getProperty("es.test.log.conf", "log4j-gradle.properties")
}
dependencies {
if (project.name != "test-testng") {
testCompile project(':test-testng')
}
testCompile('org.testng:testng:6.1.1') { transitive = false }
testCompile('com.beust:jcommander:1.5') { transitive = false }
testCompile('org.beanshell:bsh:2.0b4') { transitive = false }
testCompile('org.hamcrest:hamcrest-core:1.3.RC2') { transitive = false }
testCompile('org.hamcrest:hamcrest-library:1.3.RC2') { transitive = false }
}
}
repositories {
mavenCentral()
mavenRepo urls: 'https://repository.jboss.org/nexus/content/groups/public'
mavenRepo urls: 'http://repository.codehaus.org/'
mavenRepo urls: 'http://elasticsearch.googlecode.com/svn/maven'
mavenRepo urls: 'http://oss.sonatype.org/content/repositories/releases'
mavenRepo urls: 'http://oss.sonatype.org/content/repositories/snapshots'
mavenRepo urls: 'http://download.java.net/maven/2/'
}
}
configurations {
dists
distLib {
visible = false
}
jdeb
}
dependencies {
jdeb group: 'org.vafer', name: 'jdeb', version: '0.8'
}
//task run(dependsOn: [configurations.distLib], description: 'Runs') << {
// ant.java(classname: "org.elasticsearch.bootstrap.Bootstrap", fork: "true", classpath: configurations.distLib.asPath,
// jvmargs: "-Des-foreground=yes")
//}
dependencies {
distLib project(':elasticsearch')
}
task explodedDist(dependsOn: [configurations.distLib], description: 'Builds a minimal distribution image') << {
ant.delete(dir: explodedDistDir) // clean the exploded dir
[explodedDistDir, explodedDistLibDir, explodedDistBinDir, explodedDistConfigDir]*.mkdirs()
// remove old elasticsearch files
ant.delete { fileset(dir: explodedDistLibDir, includes: "$archivesBaseName-*.jar") }
copy {
from configurations.distLib
into explodedDistLibDir
}
copy { from('bin'); into explodedDistBinDir }
copy { from('config'); into explodedDistConfigDir }
copy { from('lib'); into explodedDistLibDir }
copy {
from('.')
into explodedDistDir
include 'LICENSE.txt'
include 'NOTICE.txt'
include 'README.textile'
}
ant.replace(dir: explodedDistBinDir, token: "@ES_VERSION@", value: versionNumber)
ant.delete { fileset(dir: explodedDistLibDir, includes: "$archivesBaseName-*-javadoc.jar") }
ant.delete { fileset(dir: explodedDistLibDir, includes: "$archivesBaseName-*-sources.jar") }
ant.delete { fileset(dir: explodedDistLibDir, includes: "slf4j-*.jar") } // no need for slf4j
ant.delete { fileset(dir: explodedDistLibDir, includes: "jarjar-*.jar") } // no need jackson, we jarjar it
ant.delete { fileset(dir: explodedDistLibDir, includes: "sigar-*.jar") } // no need sigar directly under lib...
// move relevant jars to ext
// ant.move(todir: "$explodedDistLibDir/ext") {
// fileset(dir: explodedDistLibDir) {
// include(name: '*jline*')
// include(name: '*log4j*')
// include(name: '*jna*')
// }
// }
ant.chmod(dir: "$explodedDistDir/bin", perm: "ugo+rx", includes: "**/*")
}
task zip(type: Zip, dependsOn: ['explodedDist']) {
rootFolder = "$archivesBaseName-${-> version}"
from(explodedDistDir) {
into rootFolder
exclude 'bin/elasticsearch'
exclude 'bin/plugin'
}
from(explodedDistDir) {
into rootFolder
include 'bin/elasticsearch'
include 'bin/plugin'
fileMode = 0755
}
}
task tar(type: Tar, dependsOn: ['explodedDist']) {
compression = Compression.GZIP
extension = "tar.gz"
rootFolder = "$archivesBaseName-${-> version}"
from(explodedDistDir) {
into rootFolder
exclude 'bin/*.bat'
exclude 'bin/elasticsearch'
exclude 'bin/plugin'
exclude 'lib/sigar/*win*'
}
from(explodedDistDir) {
into rootFolder
include 'bin/elasticsearch'
include 'bin/plugin'
fileMode = 0755
}
}
task deb(dependsOn: ['explodedDist']) << {
ant.taskdef(name: "deb", classname: "org.vafer.jdeb.ant.DebAntTask", classpath: configurations.jdeb.asPath)
ant.copy(todir: "${distsDir}/debian") {
fileset(dir: "pkg/debian/control")
filterset(begintoken: "[[", endtoken: "]]") {
filter(token: "version", value: "${version}")
}
}
ant.deb(destfile: "${distsDir}/${archivesBaseName}-${version}-1_all.deb", control: "${distsDir}/debian", verbose: "true") {
tarfileset(dir: explodedDistDir, prefix: "/usr/share/elasticsearch", includes: "*.txt, *.textile", username: "root", group: "root")
tarfileset(dir: explodedDistBinDir, prefix: "/usr/share/elasticsearch/bin", excludes: "*.bat", filemode: "755", username: "root", group: "root")
tarfileset(dir: explodedDistLibDir, prefix: "/usr/share/elasticsearch/lib", includes: "*.jar, sigar/*", username: "root", group: "root")
tarfileset(dir: explodedDistConfigDir, prefix: "/etc/elasticsearch", username: "root", group: "root")
tarfileset(dir: "pkg/debian/init.d", includes: "elasticsearch", prefix: "/etc/init.d", filemode: "755", username: "root", group: "root")
tarfileset(dir: "pkg/debian/default", includes: "elasticsearch", prefix: "/etc/default", username: "root", group: "root")
}
ant.delete(dir: "${distsDir}/debian")
}
task release(dependsOn: [zip, tar, deb]) << {
ant.delete(dir: explodedDistDir)
}
task wrapper(type: Wrapper) {
gradleVersion = '1.0-milestone-3'
}