-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
254 lines (219 loc) · 7.35 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
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
/*
* Copyright (c) 2010 Yahoo! Inc. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific
* language governing permissions and limitations under the
* License. See accompanying LICENSE file.
*/
/*
* S4 Top Level Build Script
*
* To learn Gradle: http://www.gradle.org
*
* The S4 Project is built using a multilevel project. The subprojects are defined in
* file "settings.gradle".
*
* USAGE: gradle TASK1 TASK2 ... (If you have gradle installed.)
* USAGE: gradlew TASK1 TASK2 ... (Wrapper, doesn't require to install gradle.)
*
*
* Main Tasks:
*
* clean: deletes all the build dirs
* jar: creates all the jars in PROJECT/build/libs
* binImage: creates an image in the ./build subdir that includes jars, scripts,
* and other resources required to run the S4 server and sample applications.
* binTgz: same in a gzipped tar file in ./build/distributions.
* allImage: creates an image in the ./build subdir that includes what is in binImage
* plus sources, javadoc, and other documents.
* allTgz: same in a gzipped tar file in ./build/distributions.
* install: installs jars and POMs in local Maven repo (eg. ~/.m2)
*
*/
apply plugin: "java"
platformProjects = [project(':s4-core'), project(':s4-comm'), project(':s4-driver')]
allprojects {
version = new Version(major: 0, minor: 3, releaseType: 'SNAPSHOT')
//version = new Version(major: 0, minor: 2, releaseType: 'beta', bugfix: 2)
archivesBaseName = 's4'
repositories {
/* Add lib dir as a repo. Some jar files that are not available
in a public repo are distributed in the lib dir. */
flatDir name: 'libDir', dirs: "lib"
mavenLocal()
mavenRepo name: "gson", urls: "http://google-gson.googlecode.com/svn/mavenrepo"
mavenCentral()
}
}
/* All project libraries must be defined here. */
libraries = [
json: 'org.json:json:20090211',
lift_json: 'net.liftweb:lift-json_2.8.1:2.2',
gson: 'com.google.code.gson:gson:1.6',
zk: 'org.apache.zookeeper:zookeeper:3.3.1',
log4j: 'log4j:log4j:1.2.15',
flexjson: 'net.sf.flexjson:flexjson:2.1',
bcel: 'org.apache.bcel:bcel:5.2',
jakarta_regexp: 'jakarta-regexp:jakarta-regexp:1.4',
kryo: 'com.esotericsoftware:kryo:1.01',
reflectasm: 'com.esotericsoftware:reflectasm:0.8',
minlog: 'com.esotericsoftware:minlog:1.2',
asm: 'asm:asm:3.2',
commons_cli: 'commons-cli:commons-cli:1.2',
commons_logging: 'commons-logging:commons-logging:1.1.1',
commons_jexl: 'commons-jexl:commons-jexl:1.1',
commons_codec: 'commons-codec:commons-codec:1.4',
commons_httpclient: 'commons-httpclient:commons-httpclient:3.1',
spring: 'org.springframework:spring:2.5.6',
junit: 'junit:junit:4.4',
scala_compiler: 'org.scala-lang:scala-compiler:2.8.1',
scala_library: 'org.scala-lang:scala-library:2.8.1',
bookkeeper: 'org.apache.bookkeeper:bookkeeper-server:3.4.0-SNAPSHOT',
jedis: 'redis.clients:jedis:1.5.2'
]
subprojects {
apply plugin: 'eclipse'
apply plugin: 'maven'
apply plugin: "java"
sourceCompatibility = 1.6
targetCompatibility = 1.6
//defaultTasks 'build'
group = 'io.s4'
/* Common dependencies applied to all subprojects. */
dependencies {
compile( libraries.log4j )
compile( libraries.commons_logging )
compile( libraries.spring )
testCompile( libraries.junit )
}
manifest.mainAttributes(
provider: 'gradle',
'Implementation-Url': 'http://s4.io',
'Implementation-Version': version,
'Implementation-Vendor': 'The S4 Project',
'Implementation-Vendor-Id': 'io.s4'
)
}
dependsOnChildren()
distRootFolder = "$archivesBaseName-${-> version}"
/* Generate Javadoc. */
task s4Javadoc(type: Javadoc) {
source platformProjects.collect { project ->
project.sourceSets.main.allJava
}
destinationDir = new File(buildDir, 'javadoc')
// Might need a classpath
classpath = files(platformProjects.collect { project ->
project.sourceSets.main.compileClasspath
})
}
configurations {
allLibs
}
dependencies {
allLibs subprojects
}
binDistImage = copySpec {
/* Include all the resources. */
from project(':s4-core').sourceSets.main.resources
into ("s4-core/lib") {
from project("s4-core").configurations.runtime
from project("s4-core").configurations.archives.allArtifactFiles.filter{ file -> !file.name.endsWith('-sources.jar') }
}
into ("s4-driver/lib/java") {
from project("s4-driver").configurations.runtime
from project("s4-driver").configurations.archives.allArtifactFiles.filter{ file -> !file.name.endsWith('-sources.jar') }
}
}
allDistImage = copySpec {
with binDistImage
base = "${project(":").projectDir}/s4-driver"
into ("s4-driver/lib/perl") {
from "$base/perl"
}
into ("s4-driver/lib/python") {
from "$base/python"
}
into ("testinput") {
from "${project(":").projectDir}/s4-examples/testinput"
}
subprojects.findAll {proj ->
into('src') {
from proj.sourceSets.main.allJava
}
switch(proj.name) {
case "s4-example-driver":
into("s4-driver") {
from proj.sourceSets.main.resources
}
into ("s4-driver/lib/java") {
from proj.configurations.runtime
from proj.configurations.archives.allArtifactFiles
}
break
case ~/(s4\-example).*/:
into ("s4-example-apps/" + proj.name + "/lib") {
from(
proj.configurations.runtime
- project("s4-core").configurations.runtime
)
from proj.configurations.archives.allArtifactFiles
}
into ("s4-example-apps/" + proj.name) {
from proj.sourceSets.main.resources
}
break
}
}
into('javadoc') {
from "$buildDir/javadoc"
}
}
task binImage(type: Copy) {
description = "Create binary image"
destinationDir = file("$buildDir/s4-image")
with binDistImage
}
task allImage(type: Copy, dependsOn: s4Javadoc) {
description = "Create complete image"
destinationDir = file("$buildDir/s4-image")
with allDistImage
}
task binTgz( type: Tar) {
description = "Build binary bundle in GZIP format"
classifier = 'bin'
compression = Compression.GZIP
into(distRootFolder) {
with binDistImage
}
}
task allTgz( type: Tar, dependsOn: s4Javadoc) {
description = "Build complete bundle in GZIP format"
classifier = 'all'
compression = Compression.GZIP
into(distRootFolder) {
with allDistImage
}
}
/* Generates the gradlew scripts.
http://www.gradle.org/1.0-milestone-1/docs/userguide/gradle_wrapper.html */
task wrapper(type: Wrapper) {
gradleVersion = '1.0-milestone-1'
}
class Version {
int major
int minor
int bugfix
String releaseType
String toString() {
"$major.$minor-$releaseType${bugfix ?: ''}"
}
}