blob: ef0adb7d763e617c14206d0d034087f5648bfc26 [file] [log] [blame]
<?xml version="1.0"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<project name="core" default="default">
<description>Lucene core library</description>
<property name="build.dir" location="../build/core"/>
<!-- lucene core can use the minimal JDK profile -->
<property name="javac.profile.args" value="-profile compact1"/>
<import file="../common-build.xml"/>
<property name="moman.commit-hash" value="5c5c2a1e4dea" />
<property name="moman.url" value="https://bitbucket.org/jpbarrette/moman/get/${moman.commit-hash}.zip" />
<path id="classpath"/>
<!-- if we run with Java 9+, we refer to the java9 classes directory and insert this before the main classpath (to "emulate" a MR-JAR): -->
<condition property="-test.classpath.java9.addon" value="${build.dir}/classes/java9" else="${build.dir}/classes/java">
<and>
<not><equals arg1="${build.java.runtime}" arg2="1.8"/></not>
<istrue value="${tests.withJava9Patches}"/>
</and>
</condition>
<path id="test.classpath">
<pathelement location="${common.dir}/build/codecs/classes/java"/>
<pathelement location="${common.dir}/build/test-framework/classes/java"/>
<path refid="junit-path"/>
<pathelement location="${-test.classpath.java9.addon}"/><!-- if it's a duplicate it gets removed by Ant! -->
<pathelement location="${build.dir}/classes/java"/>
<pathelement location="${build.dir}/classes/test"/>
</path>
<path id="junit.classpath">
<path refid="test.classpath"/>
</path>
<target name="test-core" depends="common.test"/>
<target name="javadocs-core" depends="javadocs"/>
<target name="javadocs" description="Generate javadoc for core classes"
depends="check-javadocs-uptodate" unless="javadocs-uptodate-${name}">
<sequential>
<mkdir dir="${javadoc.dir}/core"/>
<invoke-javadoc destdir="${javadoc.dir}/core" title="${Name} ${version} core API">
<sources>
<packageset dir="${src.dir}"/>
<link href=""/>
</sources>
</invoke-javadoc>
<mkdir dir="${build.dir}"/>
<jarify basedir="${javadoc.dir}/core" destfile="${build.dir}/${final.name}-javadoc.jar"/>
</sequential>
</target>
<macrodef name="createLevAutomaton">
<attribute name="n"/>
<sequential>
<exec dir="src/java/org/apache/lucene/util/automaton"
executable="${python2.exe}" failonerror="true">
<!-- Tell Python not to write any bytecode cache into the filesystem: -->
<arg value="-B"/>
<arg value="createLevAutomata.py"/>
<arg value="@{n}"/>
<arg value="True"/>
</exec>
<exec dir="src/java/org/apache/lucene/util/automaton"
executable="${python2.exe}" failonerror="true">
<!-- Tell Python not to write any bytecode cache into the filesystem: -->
<arg value="-B"/>
<arg value="createLevAutomata.py"/>
<arg value="@{n}"/>
<arg value="False"/>
</exec>
<fixcrlf srcdir="src/java/org/apache/lucene/util/automaton" includes="*ParametricDescription.java" encoding="UTF-8"/>
</sequential>
</macrodef>
<target name="createPackedIntSources">
<exec dir="src/java/org/apache/lucene/util/packed"
executable="${python2.exe}" failonerror="true">
<!-- Tell Python not to write any bytecode cache into the filesystem: -->
<arg value="-B"/>
<arg value="gen_BulkOperation.py"/>
</exec>
<exec dir="src/java/org/apache/lucene/util/packed"
executable="${python2.exe}" failonerror="true">
<!-- Tell Python not to write any bytecode cache into the filesystem: -->
<arg value="-B"/>
<arg value="gen_Direct.py"/>
</exec>
<exec dir="src/java/org/apache/lucene/util/packed"
executable="${python2.exe}" failonerror="true">
<!-- Tell Python not to write any bytecode cache into the filesystem: -->
<arg value="-B"/>
<arg value="gen_Packed64SingleBlock.py"/>
</exec>
<exec dir="src/java/org/apache/lucene/util/packed"
executable="${python2.exe}" failonerror="true">
<!-- Tell Python not to write any bytecode cache into the filesystem: -->
<arg value="-B"/>
<arg value="gen_PackedThreeBlocks.py"/>
</exec>
<fixcrlf srcdir="src/java/org/apache/lucene/util/packed" includes="BulkOperation*.java,Direct*.java,Packed64SingleBlock.java,Packed*ThreeBlocks.py" encoding="UTF-8"/>
</target>
<target name="createLevAutomata" depends="check-moman,download-moman">
<createLevAutomaton n="1"/>
<createLevAutomaton n="2"/>
</target>
<target name="check-moman">
<available file="${build.dir}/moman" property="moman.downloaded"/>
</target>
<target name="download-moman" unless="moman.downloaded">
<mkdir dir="${build.dir}/moman"/>
<get src="${moman.url}" dest="${build.dir}/moman.zip"/>
<unzip dest="${build.dir}/moman" src="${build.dir}/moman.zip">
<cutdirsmapper dirs="1"/>
</unzip>
<delete file="${build.dir}/moman.zip"/>
</target>
<target name="regenerate" depends="createLevAutomata,createPackedIntSources,jflex"/>
<target name="clean-jflex">
<delete>
<fileset dir="src/java/org/apache/lucene/analysis/standard" includes="**/*.java">
<containsregexp expression="generated.*by.*JFlex"/>
</fileset>
</delete>
</target>
<target name="jflex" depends="-install-jflex,clean-jflex,-jflex-StandardAnalyzer"/>
<target name="-jflex-StandardAnalyzer" depends="init,-install-jflex">
<run-jflex-and-disable-buffer-expansion
dir="src/java/org/apache/lucene/analysis/standard" name="StandardTokenizerImpl"/>
</target>
</project>