-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
174 lines (147 loc) · 6.84 KB
/
build.xml
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
<project name="grassroots-search" default="jars" basedir=".">
<property name="current.version" value="0.1" />
<property name="classes.dir" value="classes" />
<property name="source.dir" value="src" />
<property name="core.jar" value="${ant.project.name}-core-${current.version}.jar" />
<property name="lucene.jar" value="${ant.project.name}-lucene-app-${current.version}.jar" />
<property name="solr.jar" value="${ant.project.name}-solr-app-${current.version}.jar" />
<loadproperties srcFile="grassroots-lucene.properties"/>
<property name="install.lib.dir" value="${install.dir}/lib" />
<!-- shared libs -->
<path id="shared.class.path">
<filelist dir="lib" files="json-simple-1.1.1.jar" />
<filelist dir="${solr.dir}/dist/solrj-lib" files="slf4j-api-1.7.24.jar" />
</path>
<!-- solr libs -->
<!--
<path id="solr.class.path">
<filelist dir="${solr.dir}/dist" files="solr-core-${lucene.version}.jar, solr-solrj-${lucene.version}.jar" />
</path>
-->
<path id="solr.class.path">
<filelist dir="${solr.dir}" files="solr-core-${solr.version}.jar, solr-solrj-${solr.version}.jar" />
</path>
<!-- lucene libs -->
<!--
<path id="lucene.class.path">
<pathelement path="${lucene.dir}/analysis/common/lucene-analyzers-common-${lucene.version}.jar" />
<pathelement path="${lucene.dir}/core/lucene-core-${lucene.version}.jar" />
<pathelement path="${lucene.dir}/queryparser/lucene-queryparser-${lucene.version}.jar" />
<pathelement path="${lucene.dir}/facet/lucene-facet-${lucene.version}.jar" />
<pathelement path="${lucene.dir}/highlighter/lucene-highlighter-${lucene.version}.jar" />
</path>
-->
<path id="lucene.class.path">
<pathelement path="${lucene.dir}/modules/lucene-analyzers-common-${lucene.version}.jar" />
<pathelement path="${lucene.dir}/modules/lucene-core-${lucene.version}.jar" />
<pathelement path="${lucene.dir}/modules/lucene-queryparser-${lucene.version}.jar" />
<pathelement path="${lucene.dir}/modules/lucene-facet-${lucene.version}.jar" />
<pathelement path="${lucene.dir}/modules/lucene-highlighter-${lucene.version}.jar" />
</path>
<target name="jars" depends="core-jar,lucene-app-jar,solr-app-jar"></target>
<target name="clean">
<delete includeemptydirs="true">
<fileset dir="${classes.dir}" includes="**/*"/>
</delete>
</target>
<target name="init">
<mkdir dir="${classes.dir}"/>
<!--
<echo message="lucene.dir ${lucene.dir}" />
<echo message="shared.class.path ${shared_path_prop}" />
<pathconvert property="lucene_path_prop" refid="lucene.class.path"/>
<echo message="lucene.class.path ${lucene_path_prop}" />
<pathconvert property="solr_path_prop" refid="solr.class.path"/>
<echo message="solr.class.path ${solr_path_prop}" />
-->
</target>
<target name="compile" depends="init">
<pathconvert property="shared.path" refid="shared.class.path"/>
<pathconvert property="lucene.path" refid="lucene.class.path"/>
<pathconvert property="solr.path" refid="solr.class.path"/>
<javac srcdir="${source.dir}" destdir="${classes.dir}" includes="**/*.java" debug="true">
<classpath>
<pathelement path="${shared.path}" />
<pathelement path="${lucene.path}" />
<pathelement path="${solr.path}" />
</classpath>
</javac>
</target>
<target name="core-jar" depends="compile">
<jar destfile="${core.jar}"
basedir="${classes.dir}"
includes="uk/ac/earlham/grassroots/document/**/*.class">
<manifest>
<attribute name="Bundle-Name" value="Grassroots.Lucene"/>
<attribute name="Bundle-Version" value="${current.version}"/>
<attribute name="Bundle-License" value="http://www.apache.org/licenses/LICENSE-2.0.txt"/>
<attribute name="Bundle-Description" value="The Grassroots toolkit for indexing and searching data"/>
</manifest>
</jar>
</target>
<target name="lucene-app-jar" depends="compile">
<jar destfile="${lucene.jar}"
basedir="${classes.dir}"
includes="uk/ac/earlham/grassroots/app/lucene/**/*.class">
<manifest>
<attribute name="Bundle-Name" value="Grassroots.Lucene"/>
<attribute name="Bundle-Version" value="${current.version}"/>
<attribute name="Bundle-License" value="http://www.apache.org/licenses/LICENSE-2.0.txt"/>
<attribute name="Bundle-Description" value="The Grassroots app for indexing and searching data using Lucene"/>
</manifest>
</jar>
</target>
<target name="solr-app-jar" depends="compile">
<jar destfile="${solr.jar}"
basedir="${classes.dir}"
includes="uk/ac/earlham/grassroots/app/solr/**/*.class">
<manifest>
<attribute name="Bundle-Name" value="Grassroots.Lucene"/>
<attribute name="Bundle-Version" value="${current.version}"/>
<attribute name="Bundle-License" value="http://www.apache.org/licenses/LICENSE-2.0.txt"/>
<attribute name="Bundle-Description" value="The Grassroots app for indexing and searching data using Solr"/>
</manifest>
</jar>
</target>
<target name="install" depends="jars">
<copy file="${core.jar}" tofile="${install.lib.dir}/${core.jar}" overwrite="true" />
<copy file="${lucene.jar}" tofile="${install.lib.dir}/${lucene.jar}" overwrite="true" />
<copy file="${solr.jar}" tofile="${install.lib.dir}/${solr.jar}" overwrite="true" />
</target>
<target name="run-lucene-indexer" depends="jars">
<java classname="uk.ac.earlham.grassroots.app.Indexer">
<arg value="index ${index.dir} -tax ${tax.dir} -data ~/Desktop/lucene_test/docs"/>
<classpath>
<pathelement path="${ant.project.name}-${current.version}.jar" />
<pathelement refid="class.path" />
</classpath>
</java>
</target>
<target name="echo-paths">
<pathconvert property="shared.path" refid="shared.class.path"/>
<pathconvert property="lucene.path" refid="lucene.class.path"/>
<pathconvert property="solr.path" refid="solr.class.path"/>
<echo message="core ${install.lib.dir}/${core.jar}" />
<echo message="lucene ${install.lib.dir}/${lucene.jar}" />
<echo message="solr ${install.lib.dir}/${solr.jar}" />
<echo message="lucene.path ${lucene.path}" />
<echo message="solr.path ${solr.path}" />
<echo message="shared.path ${shared.path}" />
</target>
<target name="run-lucene-searcher" depends="install">
<pathconvert property="shared.path" refid="shared.class.path"/>
<pathconvert property="lucene.path" refid="lucene.class.path"/>
<pathconvert property="solr.path" refid="solr.class.path"/>
<java classname="uk.ac.earlham.grassroots.app.lucene.Searcher">
<arg value="-index ${index.dir} -tax ${tax.dir} -query ${searcher.query}"/>
<classpath>
<pathelement path="${install.lib.dir}/${core.jar}" />
<pathelement path="${install.lib.dir}/${lucene.jar}" />
<pathelement path="${install.lib.dir}/${solr.jar}" />
<pathelement path="${lucene.path}" />
<pathelement path="${solr.path}" />
<pathelement path="${shared.path}" />
</classpath>
</java>
</target>
</project>