-
Notifications
You must be signed in to change notification settings - Fork 39
/
build.gradle
174 lines (142 loc) · 5.84 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
/*
This is the GRADLE build file for LIRE.
*/
apply plugin: 'java'
apply plugin: 'project-report'
sourceCompatibility = 1.8
version = project.property('versionString') + '_build' + project.property('buildNumber')
def solrVersion = '7.5.0'
repositories {
mavenLocal()
mavenCentral()
maven {
url 'http://maven.restlet.org'
}
}
dependencies {
// ---< Lucene >---
compile group: 'org.apache.lucene', name: 'lucene-core', version: solrVersion
compile group: 'org.apache.lucene', name: 'lucene-analyzers-common', version: solrVersion
compile group: 'org.apache.lucene', name: 'lucene-queryparser', version: solrVersion
compile group: 'org.apache.lucene', name: 'lucene-queries', version: solrVersion
// ---< Solr >---
// https://mvnrepository.com/artifact/org.apache.solr/solr-core
compile group: 'org.apache.solr', name: 'solr-core', version: solrVersion
// https://mvnrepository.com/artifact/org.apache.solr/solr-dataimporthandler
compile group: 'org.apache.solr', name: 'solr-dataimporthandler', version: solrVersion
compile group: 'org.apache.solr', name: 'solr-solrj', version: solrVersion
// https://mvnrepository.com/artifact/org.apache.solr/solr-solrj
// ---< Commons >---
compile group: 'commons-io', name: 'commons-io', version: '2.6'
compile group: 'org.apache.commons', name: 'commons-math3', version: '3.6.1'
// https://mvnrepository.com/artifact/commons-codec/commons-codec
compile group: 'commons-codec', name: 'commons-codec', version: '1.11'
// https://mvnrepository.com/artifact/commons-cli/commons-cli
compile group: 'commons-cli', name: 'commons-cli', version: '1.4'
// https://mvnrepository.com/artifact/com.sangupta/jopensurf
compile group: 'com.sangupta', name: 'jopensurf', version: '1.0.0'
// https://mvnrepository.com/artifact/org.bytedeco.javacpp-presets/opencv
// compile group: 'org.bytedeco.javacpp-presets', name: 'opencv', version: '2.4.11-0.11'
// ---< Helper files >---
// https://mvnrepository.com/artifact/com.twelvemonkeys.imageio/imageio-jpeg
compile group: 'com.twelvemonkeys.imageio', name: 'imageio-jpeg', version: '3.4.1'
// ---< Dom4j & Jaxen for XPath because StaX is often too complicated >---
compile 'org.dom4j:dom4j:2.1.1'
compile 'jaxen:jaxen:1.1.6'
// ---< Current version of LIRE >---
compile fileTree(dir: 'lib', include: '*.jar')
runtime fileTree(dir: 'lib', include: '*.jar')
// https://mvnrepository.com/artifact/junit/junit
testCompile group: 'junit', name: 'junit', version: '4.12'
}
jar {
Properties props = new Properties()
File propsFile = new File("$project.rootDir/gradle.properties")
props.load(propsFile.newDataInputStream())
Integer nextbuildnum = (((props.getProperty('buildNumber')) as BigDecimal) + 1)
props.setProperty('buildNumber', nextbuildnum.toString())
def date = new Date()
def formattedDate = date.format('yyyy-MM-dd-HHmm')
props.setProperty('buildDate', formattedDate.toString())
props.store(propsFile.newWriter(), null)
archiveName = baseName+'-'+props.getProperty('versionString')+'.'+extension
manifest {
attributes 'Implementation-Title': 'LireSolr',
'Implementation-Version': props.getProperty('versionString') + ' build' + nextbuildnum.toString() + ' date' + formattedDate.toString()
}
}
/**
* Deploys the results from the jar task to Solr.
*/
task distForSolr(type: Copy, dependsOn: jar) {
delete './dist'
String path = './dist'
// change the path variable to copy it to your Solr installation directory ...
// String path = '../../Applications/solr-7.5.0/server/solr-webapp/webapp/WEB-INF/lib'
String lsJar = 'liresolr.jar'
String liJar = 'lire.jar'
delete path + lsJar
delete path + liJar
from('build/libs'){
include 'LireSolr*.jar'
rename { lsJar }
}
from('lib'){
include 'LIRE-*.jar'
rename { liJar }
}
into path
}
task prepareForDockerImage(type: Copy, dependsOn: distForSolr) {
String path = './liresolr-docker-build'
delete path
String lsJar = 'liresolr.jar'
String liJar = 'lire.jar'
from('build/libs'){
include 'LireSolr*.jar'
rename { lsJar }
}
from('lib'){
include 'LIRE-*.jar'
rename { liJar }
}
into path
from ('src/main/web') into path
from ('src/main/docker') into path
}
task createFlickrDownloader(type: Jar, dependsOn: build) {
archiveName = 'flickrdownloader.jar'
destinationDir = project.getRootDir()
from { Project.DEFAULT_BUILD_DIR_NAME + "/classes/main" }
from { zipTree("lib/LIRE-1.0_b05.jar") }
from { Project.DEFAULT_BUILD_DIR_NAME + "/resources/main" }
manifest.attributes(
'Main-Class': 'net.semanticmetadata.lire.solr.tools.FlickrSolrIndexingTool',
'Class-Path': 'lire.jar'
)
}
task runParallelIndexer(type: JavaExec) {
classpath = sourceSets.main.runtimeClasspath
main = 'net.semanticmetadata.lire.solr.indexing.ParallelSolrIndexer'
// arguments to pass to the application
args('-i images-wipo.lst -f -o images-wipo.xml -n 4'.split(' '))
/*
use the XML file like this:
curl http://localhost:8983/solr/lire/update -H "Content-Type: text/xml" --data-binary @file.xml
and maybe then
curl http://localhost:8983/solr/lire/update?commit=true
*/
//
}
task runImportFromCSV(type: JavaExec) {
classpath = sourceSets.main.runtimeClasspath
main = 'net.semanticmetadata.lire.solr.indexing.ImportFromCSV'
// run this with
// $> gradle runImportFromCSV --args='-i in.csv -o out.xml'
}
task runFlickrDownloader(type: JavaExec) {
classpath = sourceSets.main.runtimeClasspath
main = 'net.semanticmetadata.lire.solr.tools.FlickrSolrIndexingTool'
// arguments to pass to the application
args('-o auto -n 20'.split(' '))
}