forked from dermotte/liresolr
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
142 lines (116 loc) · 4.7 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
/*
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.2.1'
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.5'
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.10'
// 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.3.1'
// ---< 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'
// String path = 'D:/Java/Libs/solr-6.4.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 createCommandlineDownloader(type: Jar, dependsOn: build) {
archiveName = 'flickrdownloader.jar'
destinationDir = project.getRootDir()
from { Project.DEFAULT_BUILD_DIR_NAME + "/classes/main" }
from { zipTree("lib/LIRE-1.0_b04.jar") }
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 /temp/images.lst -f -o /temp/images-out.xml -n 8'.split(' '))
}