add --shared
[pylucene.git] / lucene-java-3.4.0 / lucene / contrib / contrib-build.xml
1 <?xml version="1.0"?>
2
3 <!--
4     Licensed to the Apache Software Foundation (ASF) under one or more
5     contributor license agreements.  See the NOTICE file distributed with
6     this work for additional information regarding copyright ownership.
7     The ASF licenses this file to You under the Apache License, Version 2.0
8     the "License"); you may not use this file except in compliance with
9     the License.  You may obtain a copy of the License at
10  
11         http://www.apache.org/licenses/LICENSE-2.0
12  
13     Unless required by applicable law or agreed to in writing, software
14     distributed under the License is distributed on an "AS IS" BASIS,
15     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16     See the License for the specific language governing permissions and
17     limitations under the License.
18  -->
19
20 <project name="contrib-build" xmlns:artifact="antlib:org.apache.maven.artifact.ant">
21   <echo>Building ${ant.project.name}...</echo>
22
23   <!-- TODO: adjust build.dir/dist.dir appropriately when a contrib project is run individually -->
24   <property name="build.dir" location="../../build/contrib/${ant.project.name}"/>
25   <property name="dist.dir" location="../../dist/contrib/${ant.project.name}"/>
26   <property name="maven.dist.dir" location="../../dist/maven"/>
27         
28   <import file="../common-build.xml"/>
29
30   <available property="contrib.has.tests" type="dir" file="src/test" />
31   
32   <!-- if you extend the classpath refid in one contrib's build.xml (add JARs), use this as basis: -->
33   <path id="base.classpath">
34    <pathelement location="${common.dir}/build/classes/java"/>
35    <pathelement path="${project.classpath}"/>
36   </path>
37   
38   <!-- default classpath refid, can be overridden by contrib's build.xml (use the above base.classpath as basis): -->
39   <path id="classpath" refid="base.classpath"/>
40   
41   <path id="test.base.classpath">
42     <path refid="classpath"/>
43     <pathelement location="${common.dir}/build/classes/test-framework"/>
44     <path refid="junit-path"/>
45     <pathelement location="${build.dir}/classes/java"/>
46   </path>
47
48   <path id="test.classpath" refid="test.base.classpath"/>
49
50   <path id="junit.classpath">
51     <path refid="test.classpath"/>
52     <pathelement location="${build.dir}/classes/test"/>
53     <pathelement path="${java.class.path}"/>
54   </path>
55
56   <target name="init" depends="common.init,compile-lucene-core"/>
57   <target name="compile-test" depends="init" if="contrib.has.tests">
58     <antcall target="common.compile-test" inheritRefs="true" />
59   </target>
60   <target name="test" depends="init" if="contrib.has.tests">
61     <antcall target="common.test" inheritRefs="true" />
62   </target>
63   <target name="build-artifacts-and-tests" depends="jar, compile-test" />
64         
65   <available 
66     type="file" 
67     file="pom.xml" 
68     property="pom.xml.present">
69   </available>
70
71 <target name="dist-maven" if="pom.xml.present" depends="jar-core, jar-src, javadocs">
72   <taskdef resource="org/apache/maven/artifact/ant/antlib.xml"
73            uri="antlib:org.apache.maven.artifact.ant"
74            classpathref="maven-ant-tasks.classpath"/>
75     <sequential>
76       <m2-deploy>
77         <artifact-attachments>
78           <attach file="${build.dir}/${final.name}-src.jar"
79                   classifier="sources"/>
80           <attach file="${build.dir}/${final.name}-javadoc.jar"
81                   classifier="javadoc"/>
82         </artifact-attachments>
83       </m2-deploy>
84     </sequential>
85   </target>
86
87   <target name="javadocs" depends="compile-core">
88         <sequential>
89        <mkdir dir="${javadoc.dir}/contrib-${name}"/>
90        <invoke-javadoc
91          destdir="${javadoc.dir}/contrib-${name}"
92         title="${Name} ${version} contrib-${name} API">
93          <sources>
94            <link href=""/>
95            <packageset dir="${src.dir}"/>
96         </sources>
97       </invoke-javadoc>
98       <jarify basedir="${javadoc.dir}/contrib-${name}" destfile="${build.dir}/${final.name}-javadoc.jar"/>
99     </sequential>
100   </target>     
101
102   <target name="javadocs-index.html" description="Generate line for index.html of JavaDocs">
103     <echo file="${javadoc.dir}/index.html" append="true">
104 <![CDATA[
105   <li><a href="contrib-${name}/index.html">${name}</a></li>
106 ]]></echo>
107   </target>
108   
109   <macrodef name="contrib-uptodate">
110     <attribute name="name"/>
111     <attribute name="property"/>
112     <attribute name="jarfile"/>
113     <attribute name="contrib-src-name" default="@{name}"/>
114     <sequential>
115       <uptodate property="@{property}" targetfile="@{jarfile}">
116         <srcfiles dir="${common.dir}/contrib/@{contrib-src-name}/src/java" includes="**/*.java"/>
117       </uptodate>
118     </sequential>
119   </macrodef>
120
121   <property name="analyzers-common.jar" value="${common.dir}/build/contrib/analyzers/common/lucene-analyzers-${version}.jar"/>
122   <target name="check-analyzers-common-uptodate" unless="analyzers-common.uptodate">
123     <contrib-uptodate name="analyzers/common" jarfile="${analyzers-common.jar}" property="analyzers-common.uptodate"/>
124   </target>
125   <target name="jar-analyzers-common" unless="analyzers-common.uptodate" depends="check-analyzers-common-uptodate">
126     <ant dir="${common.dir}/contrib/analyzers/common" target="jar-core" inheritall="false">
127       <propertyset refid="uptodate.and.compiled.properties"/>
128     </ant>
129     <property name="analyzers-common.uptodate" value="true"/>
130   </target>
131
132   <property name="analyzers-smartcn.jar" value="${common.dir}/build/contrib/analyzers/smartcn/lucene-smartcn-${version}.jar"/>
133   <target name="check-analyzers-smartcn-uptodate" unless="analyzers-smartcn.uptodate">
134     <contrib-uptodate name="analyzers/smartcn" jarfile="${analyzers-smartcn.jar}" property="analyzers-smartcn.uptodate"/>
135   </target>
136   <target name="jar-analyzers-smartcn" unless="analyzers-smartcn.uptodate" depends="check-analyzers-smartcn-uptodate">
137         <ant dir="${common.dir}/contrib/analyzers/smartcn" target="jar-core" inheritAll="false">
138       <propertyset refid="uptodate.and.compiled.properties"/>
139     </ant>
140     <property name="analyzers-smartcn.uptodate" value="true"/>
141   </target>
142
143   <property name="analyzers-stempel.jar" value="${common.dir}/build/contrib/analyzers/stempel/lucene-stempel-${version}.jar"/>
144   <target name="check-analyzers-stempel-uptodate" unless="analyzers-stempel.uptodate">
145     <contrib-uptodate name="analyzers/stempel" jarfile="${analyzers-stempel.jar}" property="analyzers-stempel.uptodate"/>
146   </target>
147   <target name="jar-analyzers-stempel" unless="analyzers-stempel.uptodate" depends="check-analyzers-stempel-uptodate">
148         <ant dir="${common.dir}/contrib/analyzers/stempel" target="jar-core" inheritAll="false">
149       <propertyset refid="uptodate.and.compiled.properties"/>
150     </ant>
151     <property name="analyzers-stempel.uptodate" value="true"/>
152   </target>
153
154   <property name="grouping.jar" value="${common.dir}/build/contrib/grouping/lucene-grouping-${version}.jar"/>
155   <target name="check-grouping-uptodate" unless="grouping.uptodate">
156     <contrib-uptodate name="grouping" jarfile="${grouping.jar}" property="grouping.uptodate"/>
157   </target>
158   <target name="jar-grouping" unless="grouping.uptodate" depends="check-grouping-uptodate">
159         <ant dir="${common.dir}/contrib/grouping" target="jar-core" inheritAll="false">
160       <propertyset refid="uptodate.and.compiled.properties"/>
161     </ant>
162     <property name="grouping.uptodate" value="true"/>
163   </target>
164
165   <property name="highlighter.jar" value="${common.dir}/build/contrib/highlighter/lucene-highlighter-${version}.jar"/>
166   <target name="check-highlighter-uptodate" unless="highlighter.uptodate">
167     <contrib-uptodate name="highlighter" jarfile="${highlighter.jar}" property="highlighter.uptodate"/>
168   </target>
169   <target name="jar-highlighter" unless="highlighter.uptodate" depends="check-highlighter-uptodate">
170     <ant dir="${common.dir}/contrib/highlighter" target="jar-core" inheritall="false">
171       <propertyset refid="uptodate.and.compiled.properties"/>
172     </ant>
173     <property name="highlighter.uptodate" value="true"/>
174   </target>
175
176   <property name="icu.jar" value="${common.dir}/build/contrib/icu/lucene-icu-${version}.jar"/>
177   <target name="check-icu-uptodate" unless="icu.uptodate">
178     <contrib-uptodate name="icu" jarfile="${icu.jar}" property="icu.uptodate"/>
179   </target>
180   <target name="jar-icu" unless="icu.uptodate" depends="check-icu-uptodate">
181         <ant dir="${common.dir}/contrib/icu" target="jar-core" inheritAll="false">
182       <propertyset refid="uptodate.and.compiled.properties"/>
183     </ant>
184     <property name="icu.uptodate" value="true"/>
185   </target>
186
187   <property name="memory.jar" value="${common.dir}/build/contrib/memory/lucene-memory-${version}.jar"/>
188   <target name="check-memory-uptodate" unless="memory.uptodate">
189     <contrib-uptodate name="memory" jarfile="${memory.jar}" property="memory.uptodate"/>
190   </target>
191   <target name="jar-memory" unless="memory.uptodate" depends="check-memory-uptodate">
192     <ant dir="${common.dir}/contrib/memory" target="jar-core" inheritall="false">
193       <propertyset refid="uptodate.and.compiled.properties"/>
194     </ant>
195     <property name="memory.uptodate" value="true"/>
196   </target>
197
198   <property name="misc.jar" value="${common.dir}/build/contrib/misc/lucene-misc-${version}.jar"/>
199   <target name="check-misc-uptodate" unless="misc.uptodate">
200     <contrib-uptodate name="misc" jarfile="${misc.jar}" property="misc.uptodate"/>
201   </target>
202   <target name="jar-misc" unless="misc.uptodate" depends="check-misc-uptodate">
203         <ant dir="${common.dir}/contrib/misc" target="jar-core" inheritAll="false">
204       <propertyset refid="uptodate.and.compiled.properties"/>
205     </ant>
206     <property name="misc.uptodate" value="true"/>
207   </target>
208
209   <property name="queries.jar" value="${common.dir}/build/contrib/queries/lucene-queries-${version}.jar"/>
210   <target name="check-queries-uptodate" unless="queries.uptodate">
211     <contrib-uptodate name="queries" jarfile="${queries.jar}" property="queries.uptodate"/>
212   </target>
213   <target name="jar-queries" unless="queries.uptodate" depends="check-queries-uptodate">
214     <ant dir="${common.dir}/contrib/queries" target="jar-core" inheritall="false">
215       <propertyset refid="uptodate.and.compiled.properties"/>
216     </ant>
217     <property name="queries.uptodate" value="true"/>
218   </target>
219
220   <property name="queryparser.jar" value="${common.dir}/build/contrib/queryparser/lucene-queryparser-${version}.jar"/>
221   <target name="check-queryparser-uptodate" unless="queryparser.uptodate">
222     <contrib-uptodate name="queryparser" jarfile="${queryparser.jar}" property="queryparser.uptodate"/>
223   </target>
224   <target name="jar-queryparser" unless="queryparser.uptodate" depends="check-queryparser-uptodate">
225     <ant dir="${common.dir}/contrib/queryparser" target="jar-core" inheritall="false">
226       <propertyset refid="uptodate.and.compiled.properties"/>
227     </ant>
228     <property name="queryparser.uptodate" value="true"/>
229   </target>
230
231   <property name="spatial.jar" value="${common.dir}/build/contrib/spatial/lucene-spatial-${version}.jar"/>
232   <target name="check-spatial-uptodate" unless="spatial.uptodate">
233     <contrib-uptodate name="spatial" jarfile="${spatial.jar}" property="spatial.uptodate"/>
234   </target>
235   <target name="jar-spatial" unless="spatial.uptodate" depends="check-spatial-uptodate">
236         <ant dir="${common.dir}/contrib/spatial" target="jar-core" inheritAll="false">
237       <propertyset refid="uptodate.and.compiled.properties"/>
238     </ant>
239     <property name="spatial.uptodate" value="true"/>
240   </target>
241
242   <property name="spellchecker.jar" value="${common.dir}/build/contrib/spellchecker/lucene-spellchecker-${version}.jar"/>
243   <target name="check-spellchecker-uptodate" unless="spellchecker.uptodate">
244     <contrib-uptodate name="spellchecker" jarfile="${spellchecker.jar}" property="spellchecker.uptodate"/>
245   </target>
246   <target name="jar-spellchecker" unless="spellchecker.uptodate" depends="check-spellchecker-uptodate">
247         <ant dir="${common.dir}/contrib/spellchecker" target="jar-core" inheritAll="false">
248       <propertyset refid="uptodate.and.compiled.properties"/>
249     </ant>
250     <property name="spellchecker.uptodate" value="true"/>
251   </target>
252 </project>