Skip to content

Apache Lucene open-source search software

make kuromoji's download-dict task ivy:retrieve instead of getting directly everytime

Robert Muir924adf689fa2
diff --git a/lucene/analysis/kuromoji/build.xml b/lucene/analysis/kuromoji/build.xml
index ea37cdbbbf5..d72fe24b0e5 100644
--- a/lucene/analysis/kuromoji/build.xml
+++ b/lucene/analysis/kuromoji/build.xml
@@ -17,7 +17,7 @@
limitations under the License.
-->
-<project name="analyzers-kuromoji" default="default">
+<project name="analyzers-kuromoji" default="default" xmlns:ivy="antlib:org.apache.ivy.ant">
<description>
Japanese Morphological Analyzer
@@ -26,19 +26,21 @@
<!-- currently whether rat detects this as binary or not
is platform dependent?! -->
<property name="rat.excludes" value="**/*.txt,**/bocchan.utf-8"/>
+
+ <!-- we don't want to pull in ipadic/naist etc -->
+ <property name="ivy.default.configuration" value="default"/>
<import file="../analysis-module-build.xml"/>
<!-- default configuration: uses mecab-ipadic -->
+ <property name="ipadic.type" value="ipadic"/>
<property name="ipadic.version" value="mecab-ipadic-2.7.0-20070801" />
- <property name="dict.src.file" value="${ipadic.version}.tar.gz" />
- <property name="dict.url" value="http://mecab.googlecode.com/files/${dict.src.file}"/>
<!-- alternative configuration: uses mecab-naist-jdic
+ <property name="ipadic.type" value="naist"/>
<property name="ipadic.version" value="mecab-naist-jdic-0.6.3b-20111013" />
- <property name="dict.src.file" value="${ipadic.version}.tar.gz" />
- <property name="dict.url" value="http://sourceforge.jp/frs/redir.php?m=iij&amp;f=/naist-jdic/53500/${dict.src.file}"/>
-->
+ <property name="dict.src.file" value="${ipadic.version}.tar.gz" />
<property name="dict.src.dir" value="${build.dir}/${ipadic.version}" />
<property name="dict.encoding" value="euc-jp"/>
<property name="dict.format" value="ipadic"/>
@@ -54,8 +56,9 @@
</path>
<target name="compile-core" depends="jar-analyzers-common, common.compile-core" />
- <target name="download-dict" unless="dict.available">
- <get src="${dict.url}" dest="${build.dir}/${dict.src.file}"/>
+ <target name="download-dict" depends="ivy-availability-check,ivy-fail,ivy-configure" unless="dict.available">
+ <ivy:retrieve pattern="${build.dir}/${dict.src.file}" conf="${ipadic.type}"/>
+ <!-- TODO: we should checksum too -->
<gunzip src="${build.dir}/${dict.src.file}"/>
<untar src="${build.dir}/${ipadic.version}.tar" dest="${build.dir}"/>
</target>
@@ -86,7 +89,6 @@
<java fork="true" failonerror="true" maxmemory="1g" classname="org.apache.lucene.analysis.ja.util.DictionaryBuilder">
<classpath>
<path refid="tools.classpath"/>
- <pathelement path="${build.dir}/classes/tools"/>
</classpath>
<assertions>
<enable package="org.apache.lucene"/>
@@ -113,7 +115,6 @@
destdir="${build.dir}/classes/tools">
<classpath>
<path refid="tools.classpath"/>
- <pathelement path="src/tools/java"/>
</classpath>
</compile>
</target>
diff --git a/lucene/analysis/kuromoji/ivy.xml b/lucene/analysis/kuromoji/ivy.xml
index 0de1478c539..ae8a8199c5f 100644
--- a/lucene/analysis/kuromoji/ivy.xml
+++ b/lucene/analysis/kuromoji/ivy.xml
@@ -17,5 +17,19 @@
under the License.
-->
<ivy-module version="2.0">
- <info organisation="org.apache.lucene" module="analyzers-kuromoji"/>
+ <info organisation="org.apache.lucene" module="analyzers-kuromoji"/>
+ <configurations>
+ <conf name="default" description="compile dependencies"/>
+ <conf name="ipadic" description="ipadic dictionary"/>
+ <conf name="naist" description="naist-jdic dictionary"/>
+ </configurations>
+
+ <dependencies>
+ <dependency org="mecab" name="mecab-ipadic" rev="2.7.0-20070801" conf="ipadic->default">
+ <artifact name="ipadic" type=".tar.gz" url="http://mecab.googlecode.com/files/mecab-ipadic-2.7.0-20070801.tar.gz"/>
+ </dependency>
+ <dependency org="mecab" name="mecab-naist-jdic" rev="0.6.3b-20111013" conf="naist->default">
+ <artifact name="mecab-naist-jdic" type=".tar.gz" url="http://sourceforge.jp/frs/redir.php?m=iij&amp;f=/naist-jdic/53500/mecab-naist-jdic-0.6.3b-20111013.tar.gz"/>
+ </dependency>
+ </dependencies>
</ivy-module>
diff --git a/lucene/common-build.xml b/lucene/common-build.xml
index 9fb15e5d6be..a52b97596c4 100644
--- a/lucene/common-build.xml
+++ b/lucene/common-build.xml
@@ -58,6 +58,7 @@
<property name="ivy.bootstrap.version" value="2.2.0" />
<property name="ivy.resource" value="org/apache/ivy/ant/antlib.xml" />
<available resource="${ivy.resource}" property="ivy.available" />
+ <property name="ivy.default.configuration" value="*"/>
<property name="junit.jar" value="junit-4.10.jar"/>
<property name="junit-location.jar" value="${common.dir}/test-framework/lib/${junit.jar}"/>
@@ -282,7 +283,8 @@
<target name="resolve" depends="ivy-availability-check,ivy-fail,ivy-configure">
<!-- todo, make this a property or something.
only special cases need bundles -->
- <ivy:retrieve type="jar,bundle" log="download-only"/>
+ <ivy:retrieve type="jar,bundle" log="download-only"
+ conf="${ivy.default.configuration}"/>
</target>
<property name="ivy_install_path" location="${user.home}/.ant/lib" />