-
Notifications
You must be signed in to change notification settings - Fork 16
/
build.gradle
277 lines (229 loc) · 7.78 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
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
plugins {
id 'java'
// id 'com.github.johnrengelman.shadow' version '1.2.2'
// id "com.moowork.node" version "0.11"
}
defaultTasks 'build'
//some useful common things
task printVersions << {
println "Gradle is version " + GradleVersion.current()
println "Gradle is running with JVM " + org.gradle.internal.jvm.Jvm.current()
}
if (!project.hasProperty("output")) {
ext.output = "build/mail"
}
if (!project.hasProperty("mailing_list")) {
ext.mailing_list = "src/main/resources/mailing_list_small.csv"
}
if (!project.hasProperty("npm_exec")) {
ext.npm_exec = "npm"
}
subprojects {
apply plugin: "maven"
apply plugin: "project-report"
tasks.withType(ScalaCompile) {
sourceCompatibility = "1.7"
targetCompatibility = "1.7"
}
repositories {
mavenLocal()
mavenCentral()
//not thrilled by this, but let's try it
flatDir {
dirs "$searchhubFusionHome" + "/apps/libs/"
}
flatDir {
dirs "$searchhubFusionHome" + "/apps/spark/lib/"
}
}
// Global excludes
configurations {
compile.exclude group: "jline"
compile.exclude group: "jms"
compile.exclude group: "jmxri"
compile.exclude group: "jmxtools"
compile.exclude group: "mail"
compile.exclude group: "org.ow2.asm"
compile.exclude module: "wstx-asl"
/// we pull in javax.servlet:javax.servlet-api:3.1 or higher explicitly elsewhere; servlet-api:2.5 breaks things
compile.exclude group: "javax.servlet", module: "servlet-api"
compile.exclude group: "com.codahale.metrics"
// this has moved to io.dropwizard.metrics; we want to exclude old ones.
}
task allDeps(type: DependencyReportTask) {}
allDeps.description "Runs `dependencies` task on all subprojects. Accepts --configuration option"
task allDepInsight(type: DependencyInsightReportTask) << {}
allDepInsight.description "Run dependency insight for a given configuration and dependency. Use --configuration and --dependency"
task deleteDepDump(type: Delete) {
delete "${buildDir}/dependency-jars"
}
task dumpDeps(type: Copy, dependsOn: [deleteDepDump]) {
description "Copy all the dependencies for a project into build/dependency-jars"
from configurations.compile
into "${buildDir}/dependency-jars"
}
}
task wrapper(type: Wrapper) {
gradleVersion = '2.13'
distributionUrl = "https://downloads.gradle.org/distributions/gradle-${gradleVersion}-all.zip"
}
task checkRequiredProperties() {
if (!project.hasProperty("searchhubFusionHome")) {
throw new GradleException('missing searchhubFusionHome. Configure in ~/.gradle/gradle.properties per the README.txt')
} else {
println("Search Hub Fusion location set to $searchhubFusionHome")
}
}
checkRequiredProperties
jar {
manifest {
attributes 'Implementation-Title': 'SearchHub Fusion',
'Implementation-Version': version
}
dependencies {
compile project(":searchhub-fusion-plugins")
}
}
def jarDir = "searchhub-fusion-plugins/build/libs"
task deployLibsToSpark(type: Copy) {
from jarDir
into "$searchhubFusionHome/apps/spark/lib/"
dependsOn "searchhub-fusion-plugins:compileScala"
dependsOn "jar"
}
task deployLibsToApi(type: Copy) {
from jarDir
into "$searchhubFusionHome/apps/libs/"
dependsOn "searchhub-fusion-plugins:compileScala"
dependsOn "jar"
}
task deployLibs(dependsOn: [deployLibsToSpark, deployLibsToApi]) {
def searchhubJar = "\napps/libs/searchhub-fusion-plugins-${version}.jar"
if (file("$searchhubFusionHome/apps/jetty/api/webapps/api-extra-classpath.txt").exists()) {
file("$searchhubFusionHome/apps/jetty/api/webapps/api-extra-classpath.txt").append(searchhubJar)
println("Copied libs to apis")
}
if (file("$searchhubFusionHome/apps/jetty/connectors/webapps/connectors-extra-classpath.txt").exists()) {
file("$searchhubFusionHome/apps/jetty/connectors/webapps/connectors-extra-classpath.txt").append(searchhubJar)
println("Copied libs to connectors")
}
}
task installNPM(type: Exec) {
commandLine "$npm_exec", 'install'
}
task installBower(type: Exec, dependsOn: [installNPM]) {
commandLine 'node_modules/bower/bin/bower', 'install'
}
task setupPythonVirtualEnv(type: Exec) {
commandLine 'virtualenv', 'venv'
}
task activatePythonVirtualEnv(type: Exec, dependsOn: [setupPythonVirtualEnv]) {
commandLine 'bash', '-c', 'source venv/bin/activate'
}
task installPythonReqs(type: Exec, dependsOn: [activatePythonVirtualEnv]) {
commandLine 'venv/bin/pip', 'install', '-r', 'python/requirements.txt'
}
task installPython(dependsOn: [installPythonReqs]) {
doFirst {
println("Installing Python")
}
}
task install(dependsOn: [checkRequiredProperties, deployLibs, installNPM, installBower, installPython]) {
doFirst {
println("Installing Dependencies and other Requirements")
}
doLast {
println("!!!!!!! DON'T FORGET TO RESTART FUSION !!!!!!!!!")
}
}
//Primarily used when Fusion is running somewhere else and we don't need to build/install Fusion plugins locally
task installNoLibDeploy(dependsOn: [checkRequiredProperties, installNPM, installBower, installPython]) {
}
task gulpConfig(type: Exec) {
commandLine 'node_modules/gulp/bin/gulp.js', 'copy:configSample'
}
task gulpBuild(type: Exec) {
commandLine 'node_modules/gulp/bin/gulp.js', 'build'
}
task buildUI(dependsOn: [gulpConfig, gulpBuild]) {
}
task build(dependsOn: [buildUI]) {
}
task compile(dependsOn: [deployLibs]){
}
project(":searchhub-fusion-plugins") {
apply plugin: 'java'
apply plugin: 'scala'
sourceCompatibility = 1.8
targetCompatibility = 1.8
sourceSets.main.scala.srcDir "src/main/java"
sourceSets.main.java.srcDirs = []
sourceSets.test.scala.srcDir "src/test/java"
sourceSets.test.java.srcDirs = []
dependencies {
compile fileTree(
dir: "$searchhubFusionHome/apps/libs/",
includes: ["*.jar"]
)
compile fileTree(
dir: "$searchhubFusionHome/apps/libs/",
includes: ["*.jar"]
)
compile "org.scala-lang:scala-library:2.11.1"
testCompile group: 'junit', name: 'junit', version: '4.11'
testCompile group: 'org.scalatest', name: 'scalatest_2.11', version: '2.2.4'
}
compileScala.doFirst{
println("Removing old instances of the plugin jar from Fusion")
delete fileTree(dir: "$searchhubFusionHome/apps/libs/",
include: "searchhub-fusion-plugins*.jar"
)
delete fileTree(dir: "$searchhubFusionHome/apps/libs/",
include: "searchhub-fusion-plugins*.jar"
)
}
task getMail(type: JavaExec) {
main = "com.lucidworks.utils.mail.downloader.ApacheMailMboxGetter"
classpath = sourceSets.main.runtimeClasspath
args = ["$mailing_list", "-output", "$output"]
}
/*
dependencies {
testCompile group: 'junit', name: 'junit', version: '4.11'
compile "org.slf4j:slf4j-api:1.7.5"
compile "org.apache.logging.log4j:log4j-slf4j-impl:2.1"
compile "commons-io:commons-io:2.4"
compile "commons-lang:commons-lang:2.6"
compile "org.json:json:20160212"
compile "guava-16.0.1"
compile "org.codehaus.jackson:jackson-core-asl:1.8.8"
compile "org.apache.httpcomponents:httpclient:4.5.1"
compile "commons-cli:commons-cli:1.2"
//compile "org.apache.derby:derby:10.12.1.1"
compile "javax.mail:mail:1.5.0-b01"
compile name: "solr-solrj-5.2.1"
compile name: "solr-core-5.2.1"
compile name: "camel-core-2.12.2"
compile name: "lucidworks-shared-2.1.3"
compile name: "lucid-indexing-pipeline-service-2.1.3"
compile name: "lucid-base-service-2.1.3"
compile name: "lucid-base-pipeline-2.1.3"
compile name: "lucid-client-2.1.3"
//compile project(":Apollo:shared:lucid-base-service")
}*/
}
//test {
// systemProperties 'property': 'value'
//}
uploadArchives {
repositories {
flatDir {
dirs 'repos'
}
}
}
task getMail(dependsOn: tasks.getByPath(':searchhub-fusion-plugins:getMail')){
doLast{
print("Finished downloading Mailboxes")
}
}