Skip to content

Apache Lucene open-source search software

LUCENE-930: Various contrib building improvements to ensure contrib dependencies are met, and test compilation errors fail the build.

Chris M. Hostetter373af70a2049
diff --git a/CHANGES.txt b/CHANGES.txt
index c55cf1f3a10..e56843d256b 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -305,6 +305,10 @@ Build
jar and makes sure that the lucli jar contains LICENSE.txt and NOTICE.txt.
(Chris Hostetter, Michael Busch)
+ 9. LUCENE-930: Various contrib building improvements to ensure contrib
+ dependencies are met, and test compilation errors fail the build.
+ (Steven Parkes, Chris Hostetter)
+
======================= Release 2.1.0 2007-02-14 =======================
Changes in runtime behavior
diff --git a/build.xml b/build.xml
index 3de4323950c..1ef5f9417b3 100644
--- a/build.xml
+++ b/build.xml
@@ -96,7 +96,7 @@
description="Runs unit tests for the core Lucene code"
/>
<target name="test" depends="test-core, test-contrib"
- description="Runs all unit tests"
+ description="Runs all unit tests (including contribs)"
/>
<!-- ================================================================== -->
@@ -435,14 +435,20 @@
</sequential>
</macrodef>
- <target name="build-contrib" depends="compile-test">
- <contrib-crawl/>
+ <target name="build-contrib"
+ description="Builds all contrib modules and their tests">
+ <contrib-crawl target="build-artifacts-and-tests"/>
</target>
- <target name="test-contrib" depends="compile-test">
- <!-- don't fail on error, instead check for flag file so we run
+ <target name="test-contrib" depends="build-contrib">
+ <!-- Don't fail on error, instead check for flag file so we run
all the tests possible and can "ant generate-test-reports"
- for all of them
+ for all of them.
+
+ Because of this, we depend on "build-contrib" even though the
+ Individual contrib "test" targets probably have the
+ neccessary dependencies. If they fail to compile, we won't
+ know about it.
-->
<contrib-crawl target="test" failonerror="false"/>
<available property="contribs.failed" file="junitfailed.flag">
diff --git a/contrib/benchmark/build.xml b/contrib/benchmark/build.xml
index 9d9023fc25b..022ea7348e1 100644
--- a/contrib/benchmark/build.xml
+++ b/contrib/benchmark/build.xml
@@ -150,6 +150,6 @@
</subant>
</target>
- <target name="init" depends="common.init,compile-demo,check-files"/>
+ <target name="init" depends="contrib-build.init,compile-demo,check-files"/>
</project>
diff --git a/contrib/contrib-build.xml b/contrib/contrib-build.xml
index d014a56c090..44ce005ece8 100644
--- a/contrib/contrib-build.xml
+++ b/contrib/contrib-build.xml
@@ -28,7 +28,10 @@
<property name="lucene.jar" location="${common.dir}/build/lucene-core-${version}.jar"/>
<available property="lucene.jar.present" type="file" file="${lucene.jar}"/>
-
+ <available property="lucene.tests.present" type="dir"
+ file="${common.dir}/build/classes/test" />
+ <available property="contrib.has.tests" type="dir" file="src/test" />
+
<path id="classpath">
<pathelement path="${lucene.jar}"/>
<pathelement path="${project.classpath}"/>
@@ -48,9 +51,20 @@
</path>
<target name="build-lucene" unless="lucene.jar.present">
- <!-- TODO: some tests need some of Lucene's own test classes too -->
- <ant antfile="${common.dir}/build.xml" target="jar-core" inheritall="false"/>
+ <ant dir="${common.dir}" target="jar-core" inheritAll="false"/>
+ </target>
+
+ <target name="build-lucene-tests" unless="lucene.tests.present">
+ <ant dir="${common.dir}" target="compile-test" inheritAll="false"/>
</target>
+
<target name="init" depends="common.init,build-lucene"/>
+ <target name="compile-test" depends="init" if="contrib.has.tests">
+ <antcall target="common.compile-test" inheritRefs="true" />
+ </target>
+ <target name="test" depends="init" if="contrib.has.tests">
+ <antcall target="common.test" inheritRefs="true" />
+ </target>
+ <target name="build-artifacts-and-tests" depends="jar, compile-test" />
</project>
diff --git a/contrib/db/bdb-je/build.xml b/contrib/db/bdb-je/build.xml
index 68520b427ab..92a6ba06c13 100644
--- a/contrib/db/bdb-je/build.xml
+++ b/contrib/db/bdb-je/build.xml
@@ -34,5 +34,5 @@
</target>
<target name="check-and-get-je-jar" depends="get-je-jar" />
- <target name="init" depends="common.init,check-and-get-je-jar" />
+ <target name="init" depends="contrib-build.init,check-and-get-je-jar" />
</project>
diff --git a/contrib/db/bdb/build.xml b/contrib/db/bdb/build.xml
index fbed78cf2a9..7cac45c0f52 100644
--- a/contrib/db/bdb/build.xml
+++ b/contrib/db/bdb/build.xml
@@ -55,6 +55,6 @@
</target>
<target name="check-and-get-db-jar" depends="get-db-jar" />
- <target name="init" depends="common.init,check-and-get-db-jar" />
+ <target name="init" depends="contrib-build.init,check-and-get-db-jar" />
</project>
diff --git a/contrib/db/build.xml b/contrib/db/build.xml
index 8e33d737a1d..7916c428408 100644
--- a/contrib/db/build.xml
+++ b/contrib/db/build.xml
@@ -39,10 +39,19 @@
<ant dir="bdb" target="clean" />
<ant dir="bdb-je" target="clean" />
</target>
-
+ <target name="compile-core">
+ <ant dir="bdb" target="compile-core" />
+ <ant dir="bdb-je" target="compile-core" />
+ </target>
+ <target name="compile-test">
+ <ant dir="bdb" target="compile-test" />
+ <ant dir="bdb-je" target="compile-test" />
+ </target>
<target name="test">
<ant dir="bdb" target="test" />
<ant dir="bdb-je" target="test" />
</target>
+ <target name="build-artifacts-and-tests" depends="default,compile-test" />
+
</project>
diff --git a/contrib/gdata-server/build.xml b/contrib/gdata-server/build.xml
index 1ae48032b04..55fc1777089 100644
--- a/contrib/gdata-server/build.xml
+++ b/contrib/gdata-server/build.xml
@@ -90,8 +90,7 @@
<ant dir="src/gom" target="jar-core" inheritRefs="true" />
</target>
-
- <target name="test" depends="init" if="build-1-5-contrib">
+ <target name="test" depends="compile-test" if="build-1-5-contrib">
<ant dir="src/core" target="test" inheritRefs="true" />
<ant dir="src/gom" target="test" inheritRefs="true" />
<ant dir="src/hivemind" target="test" inheritRefs="true" />
@@ -129,5 +128,6 @@
<target name="check-1-5" unless="build-1-5-contrib" >
<echo>Java 1.5 support not availabble (or prohibited by explicitly set property) ... skipping task</echo>
</target>
-
+
+ <target name="build-artifacts-and-tests" depends="default,compile-test" />
</project>
diff --git a/contrib/spellchecker/build.xml b/contrib/spellchecker/build.xml
index d89be94a268..8ac6a25acbe 100755
--- a/contrib/spellchecker/build.xml
+++ b/contrib/spellchecker/build.xml
@@ -24,4 +24,6 @@
</description>
<import file="../contrib-build.xml"/>
+ <target name="compile-test"
+ depends="build-lucene-tests,contrib-build.compile-test" />
</project>