forked from dermotte/liresolr
-
Notifications
You must be signed in to change notification settings - Fork 5
/
build.gradle
157 lines (128 loc) · 4.65 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
/*
This is the GRADLE build file for LIRE.
*/
apply plugin: 'java'
apply plugin: 'project-report'
version = project.property('versionString') + '_build' + project.property('buildNumber')
repositories {
mavenLocal()
mavenCentral()
maven {
url 'https://maven.restlet.org'
}
}
dependencies {
// ---< Lucene >---
implementation 'org.apache.lucene:lucene-core:8.11.3'
implementation 'org.apache.lucene:lucene-analyzers-common:8.11.3'
implementation 'org.apache.lucene:lucene-queryparser:8.11.3'
implementation 'org.apache.lucene:lucene-queries:8.11.3'
// ---< Solr >---
implementation 'org.apache.solr:solr-core:8.11.3'
implementation 'org.apache.solr:solr-dataimporthandler:8.11.3'
implementation 'org.apache.solr:solr-solrj:8.11.3'
// ---< Commons >---
implementation 'commons-io:commons-io:2.6'
implementation 'org.apache.commons:commons-math3:3.6.1'
implementation 'commons-codec:commons-codec:1.11'
implementation 'commons-cli:commons-cli:1.4'
implementation 'com.sangupta:jopensurf:1.0.0'
// ---< Helper files >---
implementation 'com.twelvemonkeys.imageio:imageio-jpeg:3.4.1'
// ---< Dom4j & Jaxen for XPath because StaX is often too complicated >---
implementation 'org.dom4j:dom4j:2.1.1'
implementation 'jaxen:jaxen:1.1.6'
// ---< Current version of LIRE >---
implementation fileTree(dir: 'lib', include: '*.jar')
// https://mvnrepository.com/artifact/junit/junit
testImplementation 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)
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) {
duplicatesStrategy = DuplicatesStrategy.INCLUDE
delete './dist'
String path = './dist'
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) {
archiveFileName = 'flickrdownloader.jar'
destinationDirectory = 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
mainClass = '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
mainClass = '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
mainClass = 'net.semanticmetadata.lire.solr.tools.FlickrSolrIndexingTool'
// arguments to pass to the application
args('-o auto -n 20'.split(' '))
}