<commit_before><!--
 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="common-solr" default="default" xmlns:rsel="antlib:org.apache.tools.ant.types.resources.selectors">
  <description>
    This file is designed for importing into a main build file, and not intended
    for standalone use.
  </description>

  <dirname file="${ant.file.common-solr}" property="common-solr.dir"/>
  
  <property name="Name" value="Solr" />
  
  <!-- solr uses 1.7 -->
  <property name="javac.source" value="1.7"/>
  <property name="javac.target" value="1.7"/>
  <property name="javac.args" value=""/>
  
  <property name="dest" location="${common-solr.dir}/build" />
  <property name="build.dir" location="${dest}/${ant.project.name}"/>
  <property name="dist" location="${common-solr.dir}/dist"/>
  <property name="package.dir" location="${common-solr.dir}/package"/>
  <property name="maven.dist.dir" location="${package.dir}/maven"/>
  <property name="lucene-libs" location="${dest}/lucene-libs" />
  <property name="tests.userdir" location="src/test-files"/>
  <property name="example" location="${common-solr.dir}/example" />
  <property name="javadoc.dir" location="${dest}/docs"/>
  <property name="tests.cleanthreads.sysprop" value="perClass"/>

  <property name="changes.target.dir" location="${dest}/docs/changes"/>
  <property name="license.dir" location="${common-solr.dir}/licenses"/>

  <property name="solr.tgz.unpack.dir" location="${common-solr.dir}/build/solr.tgz.unpacked"/>
  <property name="dist.jar.dir.prefix" value="${solr.tgz.unpack.dir}/solr"/>
  <property name="dist.jar.dir.suffix" value="dist"/>

  <import file="${common-solr.dir}/../lucene/module-build.xml"/>

  <property name="solr.tgz.file" location="${common-solr.dir}/package/solr-${version}.tgz"/>
  <available file="${solr.tgz.file}" property="solr.tgz.exists"/>
  <available type="dir" file="${solr.tgz.unpack.dir}" property="solr.tgz.unpack.dir.exists"/>
  <target name="-ensure-solr-tgz-exists" unless="solr.tgz.exists">
    <ant dir="${common-solr.dir}" target="create-package" inheritall="false"/>
  </target>
  <target name="-unpack-solr-tgz" unless="${solr.tgz.unpack.dir.exists}">
    <antcall target="-ensure-solr-tgz-exists"/>
    <mkdir dir="${solr.tgz.unpack.dir}"/>
    <untar compression="gzip" src="${solr.tgz.file}" dest="${solr.tgz.unpack.dir}">
      <patternset refid="patternset.lucene.solr.jars"/>
    </untar>
  </target>

  <!-- backwards compatibility with existing targets/tasks; TODO: remove this! -->
  <property name="fullnamever" value="${final.name}"/>

  <path id="additional.dependencies">
  	<fileset dir="${common-solr.dir}/core/lib" excludes="${common.classpath.excludes}"/>
  	<fileset dir="${common-solr.dir}/solrj/lib" excludes="${common.classpath.excludes}"/>
  	<fileset dir="${common-solr.dir}/example/lib" excludes="${common.classpath.excludes}"/>
  	<fileset dir="${common-solr.dir}/example/example-DIH/solr/db/lib" excludes="${common.classpath.excludes}"/>  	
  	<fileset dir="lib" excludes="${common.classpath.excludes}" erroronmissingdir="false"/>
  </path>

  <path id="solr.lucene.libs">
    <!-- List of jars that will be used as the foundation for both
         the base classpath, as well as copied into the lucene-libs dir 
	 in the release.
    -->
    <!-- NOTE: lucene-core is explicitly not included because of the 
	 base.classpath (compilation & tests are done directly against   
	 the class files w/o needing to build the jar)
    -->
    <pathelement location="${analyzers-common.jar}"/>
    <pathelement location="${analyzers-kuromoji.jar}"/>
    <pathelement location="${analyzers-phonetic.jar}"/>
    <pathelement location="${codecs.jar}"/>
    <pathelement location="${backward-codecs.jar}"/>
    <pathelement location="${highlighter.jar}"/>
    <pathelement location="${memory.jar}"/>
    <pathelement location="${misc.jar}"/>
    <pathelement location="${spatial.jar}"/>
    <pathelement location="${expressions.jar}"/>
    <pathelement location="${suggest.jar}"/>
    <pathelement location="${grouping.jar}"/>
    <pathelement location="${queries.jar}"/>
    <pathelement location="${queryparser.jar}"/>
    <pathelement location="${join.jar}"/>
  </path>

  <path id="solr.base.classpath">
    <pathelement location="${common-solr.dir}/build/solr-solrj/classes/java"/>
    <pathelement location="${common-solr.dir}/build/solr-core/classes/java"/>
    <path refid="solr.lucene.libs" />
    <path refid="additional.dependencies"/>
    <path refid="base.classpath"/>
  </path>

  <path id="classpath" refid="solr.base.classpath"/>

  <path id="solr.test.base.classpath">
    <pathelement path="${common-solr.dir}/build/solr-test-framework/classes/java"/>
    <fileset dir="${common-solr.dir}/test-framework/lib">
      <include name="*.jar"/>
      <exclude name="junit-*.jar" />
      <exclude name="randomizedtesting-runner-*.jar" />
      <exclude name="ant*.jar" />
    </fileset>
  	<pathelement path="src/test-files"/>
  	<path refid="test.base.classpath"/>
  </path>
 
  <path id="test.classpath" refid="solr.test.base.classpath"/>

  <macrodef name="solr-contrib-uptodate">
    <attribute name="name"/>
    <attribute name="property" default="@{name}.uptodate"/>
    <attribute name="classpath.property" default="@{name}.jar"/>
    <!-- set jarfile only, if the target jar file has no generic name -->
    <attribute name="jarfile" default="${common-solr.dir}/build/contrib/solr-@{name}/solr-@{name}-${version}.jar"/>
    <sequential>
      <!--<echo message="Checking '@{jarfile}' against source folder '${common.dir}/contrib/@{name}/src/java'"/>-->
      <property name="@{classpath.property}" location="@{jarfile}"/>
      <uptodate property="@{property}" targetfile="@{jarfile}">
        <srcfiles dir="${common-solr.dir}/contrib/@{name}/src/java" includes="**/*.java"/>
      </uptodate>
    </sequential>
  </macrodef>

  <!-- we don't want to run HDFS tests on Windows, because they require Cygwin.
    If you have Cygwin, you can override this property on command line: -->
  <condition property="tests.disableHdfs" value="true">
    <os family="windows"/>
  </condition>

  <target name="validate" depends="compile-tools">
  </target>

  <target name="init-dist" >
    <mkdir dir="${build.dir}"/>
    <mkdir dir="${package.dir}"/>
    <mkdir dir="${dist}"/>
    <mkdir dir="${maven.dist.dir}"/>
  </target>

  <target name="prep-lucene-jars" 
  	      depends="jar-lucene-core, jar-analyzers-phonetic, jar-analyzers-kuromoji, jar-codecs,jar-expressions, jar-suggest, jar-highlighter, jar-memory,
  	               jar-misc, jar-spatial, jar-grouping, jar-queries, jar-queryparser, jar-join">
  	  <property name="solr.deps.compiled" value="true"/>
  </target>
	
  <target name="lucene-jars-to-solr" 
          depends="-lucene-jars-to-solr-not-for-package,-lucene-jars-to-solr-package"/>
  
  <target name="-lucene-jars-to-solr-not-for-package" unless="called.from.create-package">
    <sequential>
      <antcall target="prep-lucene-jars" inheritall="true"/>
      <property name="solr.deps.compiled" value="true"/>
      <copy todir="${lucene-libs}" preservelastmodified="true" flatten="true" failonerror="true" overwrite="true">
        <path refid="solr.lucene.libs" />
        <!-- NOTE: lucene-core is not already included in "solr.lucene.libs" because of its use in classpaths. -->
        <fileset file="${lucene-core.jar}" />
      </copy>
    </sequential>
  </target>
  
  <target name="-lucene-jars-to-solr-package" if="called.from.create-package">
    <sequential>
      <antcall target="-unpack-lucene-tgz" inheritall="true"/>
      <pathconvert property="relative.solr.lucene.libs" pathsep=",">
        <path refid="solr.lucene.libs"/>
        <fileset file="${lucene-core.jar}"/>
        <globmapper from="${common.build.dir}/*" to="*" handledirsep="true"/>
      </pathconvert>
      <mkdir dir="${lucene-libs}"/>
      <copy todir="${lucene-libs}" preservelastmodified="true" flatten="true" failonerror="true" overwrite="true">
        <fileset dir="${lucene.tgz.unpack.dir}/lucene-${version}" includes="${relative.solr.lucene.libs}"/>
      </copy>
    </sequential>
  </target>

  <!-- Shared core/solrj/test-framework/contrib targets -->
  
  <macrodef name="solr-jarify" description="Builds a Solr JAR file">
    <attribute name="basedir" default="${build.dir}/classes/java"/>
    <attribute name="destfile" default="${build.dir}/${final.name}.jar"/>
    <attribute name="title" default="Apache Solr Search Server: ${ant.project.name}"/>
    <attribute name="excludes" default="**/pom.xml,**/*.iml"/>
    <attribute name="metainf.source.dir" default="${common-solr.dir}"/>
    <attribute name="implementation.title" default="org.apache.solr"/>
    <attribute name="manifest.file" default="${manifest.file}"/>
    <element name="solr-jarify-filesets" optional="true"/>
    <element name="solr-jarify-additional-manifest-attributes" optional="true"/>
    <sequential>
      <jarify basedir="@{basedir}" destfile="@{destfile}"
              title="@{title}" excludes="@{excludes}"
              metainf.source.dir="@{metainf.source.dir}"
              implementation.title="@{implementation.title}"
              manifest.file="@{manifest.file}">
        <filesets>
          <solr-jarify-filesets />
        </filesets>
        <jarify-additional-manifest-attributes>
          <solr-jarify-additional-manifest-attributes />
        </jarify-additional-manifest-attributes>
      </jarify>
    </sequential>
  </macrodef>

  <target name="jar-core" depends="compile-core">
    <solr-jarify/>
  </target>

  <target name="compile-core" depends="prep-lucene-jars,resolve-example,common.compile-core"/>
  <target name="compile-test" depends="compile-solr-test-framework,common.compile-test"/>

  <target name="dist" depends="jar-core">
    <copy file="${build.dir}/${fullnamever}.jar" todir="${dist}"/>
  </target>

  <property name="lucenedocs" location="${common.dir}/build/docs"/>

  <!-- dependency to ensure all lucene javadocs are present -->
  <target name="lucene-javadocs" depends="javadocs-lucene-core,javadocs-analyzers-common,javadocs-analyzers-icu,javadocs-analyzers-kuromoji,javadocs-analyzers-phonetic,javadocs-analyzers-smartcn,javadocs-analyzers-morfologik,javadocs-analyzers-stempel,javadocs-analyzers-uima,javadocs-codecs,javadocs-expressions,javadocs-suggest,javadocs-grouping,javadocs-queries,javadocs-queryparser,javadocs-highlighter,javadocs-memory,javadocs-misc,javadocs-spatial,javadocs-test-framework"/>

  <!-- create javadocs for the current module -->
  <target name="javadocs" depends="compile-core,define-lucene-javadoc-url,lucene-javadocs,javadocs-solr-core,check-javadocs-uptodate" unless="javadocs-uptodate-${name}">
   	<sequential>
      <mkdir dir="${javadoc.dir}/${name}"/>
      <solr-invoke-javadoc>
        <solrsources>
          <packageset dir="${src.dir}"/>
        </solrsources>
        <links>
          <link href="../solr-solrj"/>
          <link href="../solr-core"/>
        </links>
      </solr-invoke-javadoc>
      <solr-jarify basedir="${javadoc.dir}/${name}" destfile="${build.dir}/${final.name}-javadoc.jar"/>
     </sequential>
  </target>

  <target name="check-solr-core-javadocs-uptodate" unless="solr-core-javadocs.uptodate">
    <uptodate property="solr-core-javadocs.uptodate" targetfile="${build.dir}/solr-core/solr-core-${version}-javadoc.jar">
       <srcfiles dir="${common-solr.dir}/core/src/java" includes="**/*.java"/>
    </uptodate>
  </target>

  <target name="check-solrj-javadocs-uptodate" unless="solrj-javadocs.uptodate">
    <uptodate property="solrj-javadocs.uptodate" targetfile="${build.dir}/solr-solrj/solr-solrj-${version}-javadoc.jar">
       <srcfiles dir="${common-solr.dir}/solrj/src/java" includes="**/*.java"/>
    </uptodate>
  </target>

  <target name="javadocs-solr-core" depends="check-solr-core-javadocs-uptodate" unless="solr-core-javadocs.uptodate">
    <ant dir="${common-solr.dir}/core" target="javadocs" inheritAll="false">
      <propertyset refid="uptodate.and.compiled.properties"/>
    </ant>
    <property name="solr-core-javadocs.uptodate" value="true"/>
  </target>

  <target name="javadocs-solrj" depends="check-solrj-javadocs-uptodate" unless="solrj-javadocs.uptodate">
    <ant dir="${common-solr.dir}/solrj" target="javadocs" inheritAll="false">
      <propertyset refid="uptodate.and.compiled.properties"/>
    </ant>
    <property name="solrj-javadocs.uptodate" value="true"/>
  </target>

  <!-- macro to create solr javadocs with links to lucene. make sure calling task depends on lucene-javadocs -->
  <macrodef name="solr-invoke-javadoc">
      <element name="solrsources" optional="yes"/>
      <element name="links" optional="yes"/>
      <attribute name="destdir" default="${javadoc.dir}/${name}"/>
      <attribute name="title" default="${Name} ${version} ${name} API"/>
      <attribute name="overview" default="${src.dir}/overview.html"/>
    <sequential>
      <mkdir dir="@{destdir}"/>
      <invoke-javadoc destdir="@{destdir}" title="@{title}" overview="@{overview}">
        <sources>
          <solrsources/>
          <link offline="true" href="${lucene.javadoc.url}core" packagelistloc="${lucenedocs}/core"/>
          <link offline="true" href="${lucene.javadoc.url}analyzers-common" packagelistloc="${lucenedocs}/analyzers-common"/>
          <link offline="true" href="${lucene.javadoc.url}analyzers-icu" packagelistloc="${lucenedocs}/analyzers-icu"/>
          <link offline="true" href="${lucene.javadoc.url}analyzers-kuromoji" packagelistloc="${lucenedocs}/analyzers-kuromoji"/>
          <link offline="true" href="${lucene.javadoc.url}analyzers-morfologik" packagelistloc="${lucenedocs}/analyzers-morfologik"/>
          <link offline="true" href="${lucene.javadoc.url}analyzers-phonetic" packagelistloc="${lucenedocs}/analyzers-phonetic"/>
          <link offline="true" href="${lucene.javadoc.url}analyzers-smartcn" packagelistloc="${lucenedocs}/analyzers-smartcn"/>
          <link offline="true" href="${lucene.javadoc.url}analyzers-stempel" packagelistloc="${lucenedocs}/analyzers-stempel"/>
          <link offline="true" href="${lucene.javadoc.url}analyzers-uima" packagelistloc="${lucenedocs}/analyzers-uima"/>
          <link offline="true" href="${lucene.javadoc.url}codecs" packagelistloc="${lucenedocs}/codecs"/>
          <link offline="true" href="${lucene.javadoc.url}expressions" packagelistloc="${lucenedocs}/expressions"/>
          <link offline="true" href="${lucene.javadoc.url}suggest" packagelistloc="${lucenedocs}/suggest"/>
          <link offline="true" href="${lucene.javadoc.url}grouping" packagelistloc="${lucenedocs}/grouping"/>
          <link offline="true" href="${lucene.javadoc.url}queries" packagelistloc="${lucenedocs}/queries"/>
          <link offline="true" href="${lucene.javadoc.url}queryparser" packagelistloc="${lucenedocs}/queryparser"/>
          <link offline="true" href="${lucene.javadoc.url}highlighter" packagelistloc="${lucenedocs}/highlighter"/>
          <link offline="true" href="${lucene.javadoc.url}memory" packagelistloc="${lucenedocs}/memory"/>
          <link offline="true" href="${lucene.javadoc.url}misc" packagelistloc="${lucenedocs}/misc"/>
          <link offline="true" href="${lucene.javadoc.url}spatial" packagelistloc="${lucenedocs}/spatial"/>
          <links/>
          <link href=""/>
        </sources>
      </invoke-javadoc>
    </sequential>
  </macrodef><commit_msg>LUCENE-5858: add missing references to backward-codecs<commit_after><!--
 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="common-solr" default="default" xmlns:rsel="antlib:org.apache.tools.ant.types.resources.selectors">
  <description>
    This file is designed for importing into a main build file, and not intended
    for standalone use.
  </description>

  <dirname file="${ant.file.common-solr}" property="common-solr.dir"/>
  
  <property name="Name" value="Solr" />
  
  <!-- solr uses 1.7 -->
  <property name="javac.source" value="1.7"/>
  <property name="javac.target" value="1.7"/>
  <property name="javac.args" value=""/>
  
  <property name="dest" location="${common-solr.dir}/build" />
  <property name="build.dir" location="${dest}/${ant.project.name}"/>
  <property name="dist" location="${common-solr.dir}/dist"/>
  <property name="package.dir" location="${common-solr.dir}/package"/>
  <property name="maven.dist.dir" location="${package.dir}/maven"/>
  <property name="lucene-libs" location="${dest}/lucene-libs" />
  <property name="tests.userdir" location="src/test-files"/>
  <property name="example" location="${common-solr.dir}/example" />
  <property name="javadoc.dir" location="${dest}/docs"/>
  <property name="tests.cleanthreads.sysprop" value="perClass"/>

  <property name="changes.target.dir" location="${dest}/docs/changes"/>
  <property name="license.dir" location="${common-solr.dir}/licenses"/>

  <property name="solr.tgz.unpack.dir" location="${common-solr.dir}/build/solr.tgz.unpacked"/>
  <property name="dist.jar.dir.prefix" value="${solr.tgz.unpack.dir}/solr"/>
  <property name="dist.jar.dir.suffix" value="dist"/>

  <import file="${common-solr.dir}/../lucene/module-build.xml"/>

  <property name="solr.tgz.file" location="${common-solr.dir}/package/solr-${version}.tgz"/>
  <available file="${solr.tgz.file}" property="solr.tgz.exists"/>
  <available type="dir" file="${solr.tgz.unpack.dir}" property="solr.tgz.unpack.dir.exists"/>
  <target name="-ensure-solr-tgz-exists" unless="solr.tgz.exists">
    <ant dir="${common-solr.dir}" target="create-package" inheritall="false"/>
  </target>
  <target name="-unpack-solr-tgz" unless="${solr.tgz.unpack.dir.exists}">
    <antcall target="-ensure-solr-tgz-exists"/>
    <mkdir dir="${solr.tgz.unpack.dir}"/>
    <untar compression="gzip" src="${solr.tgz.file}" dest="${solr.tgz.unpack.dir}">
      <patternset refid="patternset.lucene.solr.jars"/>
    </untar>
  </target>

  <!-- backwards compatibility with existing targets/tasks; TODO: remove this! -->
  <property name="fullnamever" value="${final.name}"/>

  <path id="additional.dependencies">
  	<fileset dir="${common-solr.dir}/core/lib" excludes="${common.classpath.excludes}"/>
  	<fileset dir="${common-solr.dir}/solrj/lib" excludes="${common.classpath.excludes}"/>
  	<fileset dir="${common-solr.dir}/example/lib" excludes="${common.classpath.excludes}"/>
  	<fileset dir="${common-solr.dir}/example/example-DIH/solr/db/lib" excludes="${common.classpath.excludes}"/>  	
  	<fileset dir="lib" excludes="${common.classpath.excludes}" erroronmissingdir="false"/>
  </path>

  <path id="solr.lucene.libs">
    <!-- List of jars that will be used as the foundation for both
         the base classpath, as well as copied into the lucene-libs dir 
	 in the release.
    -->
    <!-- NOTE: lucene-core is explicitly not included because of the 
	 base.classpath (compilation & tests are done directly against   
	 the class files w/o needing to build the jar)
    -->
    <pathelement location="${analyzers-common.jar}"/>
    <pathelement location="${analyzers-kuromoji.jar}"/>
    <pathelement location="${analyzers-phonetic.jar}"/>
    <pathelement location="${codecs.jar}"/>
    <pathelement location="${backward-codecs.jar}"/>
    <pathelement location="${highlighter.jar}"/>
    <pathelement location="${memory.jar}"/>
    <pathelement location="${misc.jar}"/>
    <pathelement location="${spatial.jar}"/>
    <pathelement location="${expressions.jar}"/>
    <pathelement location="${suggest.jar}"/>
    <pathelement location="${grouping.jar}"/>
    <pathelement location="${queries.jar}"/>
    <pathelement location="${queryparser.jar}"/>
    <pathelement location="${join.jar}"/>
  </path>

  <path id="solr.base.classpath">
    <pathelement location="${common-solr.dir}/build/solr-solrj/classes/java"/>
    <pathelement location="${common-solr.dir}/build/solr-core/classes/java"/>
    <path refid="solr.lucene.libs" />
    <path refid="additional.dependencies"/>
    <path refid="base.classpath"/>
  </path>

  <path id="classpath" refid="solr.base.classpath"/>

  <path id="solr.test.base.classpath">
    <pathelement path="${common-solr.dir}/build/solr-test-framework/classes/java"/>
    <fileset dir="${common-solr.dir}/test-framework/lib">
      <include name="*.jar"/>
      <exclude name="junit-*.jar" />
      <exclude name="randomizedtesting-runner-*.jar" />
      <exclude name="ant*.jar" />
    </fileset>
  	<pathelement path="src/test-files"/>
  	<path refid="test.base.classpath"/>
  </path>
 
  <path id="test.classpath" refid="solr.test.base.classpath"/>

  <macrodef name="solr-contrib-uptodate">
    <attribute name="name"/>
    <attribute name="property" default="@{name}.uptodate"/>
    <attribute name="classpath.property" default="@{name}.jar"/>
    <!-- set jarfile only, if the target jar file has no generic name -->
    <attribute name="jarfile" default="${common-solr.dir}/build/contrib/solr-@{name}/solr-@{name}-${version}.jar"/>
    <sequential>
      <!--<echo message="Checking '@{jarfile}' against source folder '${common.dir}/contrib/@{name}/src/java'"/>-->
      <property name="@{classpath.property}" location="@{jarfile}"/>
      <uptodate property="@{property}" targetfile="@{jarfile}">
        <srcfiles dir="${common-solr.dir}/contrib/@{name}/src/java" includes="**/*.java"/>
      </uptodate>
    </sequential>
  </macrodef>

  <!-- we don't want to run HDFS tests on Windows, because they require Cygwin.
    If you have Cygwin, you can override this property on command line: -->
  <condition property="tests.disableHdfs" value="true">
    <os family="windows"/>
  </condition>

  <target name="validate" depends="compile-tools">
  </target>

  <target name="init-dist" >
    <mkdir dir="${build.dir}"/>
    <mkdir dir="${package.dir}"/>
    <mkdir dir="${dist}"/>
    <mkdir dir="${maven.dist.dir}"/>
  </target>

  <target name="prep-lucene-jars" 
  	      depends="jar-lucene-core, jar-backward-codecs, jar-analyzers-phonetic, jar-analyzers-kuromoji, jar-codecs,jar-expressions, jar-suggest, jar-highlighter, jar-memory,
  	               jar-misc, jar-spatial, jar-grouping, jar-queries, jar-queryparser, jar-join">
  	  <property name="solr.deps.compiled" value="true"/>
  </target>
	
  <target name="lucene-jars-to-solr" 
          depends="-lucene-jars-to-solr-not-for-package,-lucene-jars-to-solr-package"/>
  
  <target name="-lucene-jars-to-solr-not-for-package" unless="called.from.create-package">
    <sequential>
      <antcall target="prep-lucene-jars" inheritall="true"/>
      <property name="solr.deps.compiled" value="true"/>
      <copy todir="${lucene-libs}" preservelastmodified="true" flatten="true" failonerror="true" overwrite="true">
        <path refid="solr.lucene.libs" />
        <!-- NOTE: lucene-core is not already included in "solr.lucene.libs" because of its use in classpaths. -->
        <fileset file="${lucene-core.jar}" />
      </copy>
    </sequential>
  </target>
  
  <target name="-lucene-jars-to-solr-package" if="called.from.create-package">
    <sequential>
      <antcall target="-unpack-lucene-tgz" inheritall="true"/>
      <pathconvert property="relative.solr.lucene.libs" pathsep=",">
        <path refid="solr.lucene.libs"/>
        <fileset file="${lucene-core.jar}"/>
        <globmapper from="${common.build.dir}/*" to="*" handledirsep="true"/>
      </pathconvert>
      <mkdir dir="${lucene-libs}"/>
      <copy todir="${lucene-libs}" preservelastmodified="true" flatten="true" failonerror="true" overwrite="true">
        <fileset dir="${lucene.tgz.unpack.dir}/lucene-${version}" includes="${relative.solr.lucene.libs}"/>
      </copy>
    </sequential>
  </target>

  <!-- Shared core/solrj/test-framework/contrib targets -->
  
  <macrodef name="solr-jarify" description="Builds a Solr JAR file">
    <attribute name="basedir" default="${build.dir}/classes/java"/>
    <attribute name="destfile" default="${build.dir}/${final.name}.jar"/>
    <attribute name="title" default="Apache Solr Search Server: ${ant.project.name}"/>
    <attribute name="excludes" default="**/pom.xml,**/*.iml"/>
    <attribute name="metainf.source.dir" default="${common-solr.dir}"/>
    <attribute name="implementation.title" default="org.apache.solr"/>
    <attribute name="manifest.file" default="${manifest.file}"/>
    <element name="solr-jarify-filesets" optional="true"/>
    <element name="solr-jarify-additional-manifest-attributes" optional="true"/>
    <sequential>
      <jarify basedir="@{basedir}" destfile="@{destfile}"
              title="@{title}" excludes="@{excludes}"
              metainf.source.dir="@{metainf.source.dir}"
              implementation.title="@{implementation.title}"
              manifest.file="@{manifest.file}">
        <filesets>
          <solr-jarify-filesets />
        </filesets>
        <jarify-additional-manifest-attributes>
          <solr-jarify-additional-manifest-attributes />
        </jarify-additional-manifest-attributes>
      </jarify>
    </sequential>
  </macrodef>

  <target name="jar-core" depends="compile-core">
    <solr-jarify/>
  </target>

  <target name="compile-core" depends="prep-lucene-jars,resolve-example,common.compile-core"/>
  <target name="compile-test" depends="compile-solr-test-framework,common.compile-test"/>

  <target name="dist" depends="jar-core">
    <copy file="${build.dir}/${fullnamever}.jar" todir="${dist}"/>
  </target>

  <property name="lucenedocs" location="${common.dir}/build/docs"/>

  <!-- dependency to ensure all lucene javadocs are present -->
  <target name="lucene-javadocs" depends="javadocs-lucene-core,javadocs-analyzers-common,javadocs-analyzers-icu,javadocs-analyzers-kuromoji,javadocs-analyzers-phonetic,javadocs-analyzers-smartcn,javadocs-analyzers-morfologik,javadocs-analyzers-stempel,javadocs-analyzers-uima,javadocs-backward-codecs,javadocs-codecs,javadocs-expressions,javadocs-suggest,javadocs-grouping,javadocs-queries,javadocs-queryparser,javadocs-highlighter,javadocs-memory,javadocs-misc,javadocs-spatial,javadocs-test-framework"/>

  <!-- create javadocs for the current module -->
  <target name="javadocs" depends="compile-core,define-lucene-javadoc-url,lucene-javadocs,javadocs-solr-core,check-javadocs-uptodate" unless="javadocs-uptodate-${name}">
   	<sequential>
      <mkdir dir="${javadoc.dir}/${name}"/>
      <solr-invoke-javadoc>
        <solrsources>
          <packageset dir="${src.dir}"/>
        </solrsources>
        <links>
          <link href="../solr-solrj"/>
          <link href="../solr-core"/>
        </links>
      </solr-invoke-javadoc>
      <solr-jarify basedir="${javadoc.dir}/${name}" destfile="${build.dir}/${final.name}-javadoc.jar"/>
     </sequential>
  </target>

  <target name="check-solr-core-javadocs-uptodate" unless="solr-core-javadocs.uptodate">
    <uptodate property="solr-core-javadocs.uptodate" targetfile="${build.dir}/solr-core/solr-core-${version}-javadoc.jar">
       <srcfiles dir="${common-solr.dir}/core/src/java" includes="**/*.java"/>
    </uptodate>
  </target>

  <target name="check-solrj-javadocs-uptodate" unless="solrj-javadocs.uptodate">
    <uptodate property="solrj-javadocs.uptodate" targetfile="${build.dir}/solr-solrj/solr-solrj-${version}-javadoc.jar">
       <srcfiles dir="${common-solr.dir}/solrj/src/java" includes="**/*.java"/>
    </uptodate>
  </target>

  <target name="javadocs-solr-core" depends="check-solr-core-javadocs-uptodate" unless="solr-core-javadocs.uptodate">
    <ant dir="${common-solr.dir}/core" target="javadocs" inheritAll="false">
      <propertyset refid="uptodate.and.compiled.properties"/>
    </ant>
    <property name="solr-core-javadocs.uptodate" value="true"/>
  </target>

  <target name="javadocs-solrj" depends="check-solrj-javadocs-uptodate" unless="solrj-javadocs.uptodate">
    <ant dir="${common-solr.dir}/solrj" target="javadocs" inheritAll="false">
      <propertyset refid="uptodate.and.compiled.properties"/>
    </ant>
    <property name="solrj-javadocs.uptodate" value="true"/>
  </target>

  <!-- macro to create solr javadocs with links to lucene. make sure calling task depends on lucene-javadocs -->
  <macrodef name="solr-invoke-javadoc">
      <element name="solrsources" optional="yes"/>
      <element name="links" optional="yes"/>
      <attribute name="destdir" default="${javadoc.dir}/${name}"/>
      <attribute name="title" default="${Name} ${version} ${name} API"/>
      <attribute name="overview" default="${src.dir}/overview.html"/>
    <sequential>
      <mkdir dir="@{destdir}"/>
      <invoke-javadoc destdir="@{destdir}" title="@{title}" overview="@{overview}">
        <sources>
          <solrsources/>
          <link offline="true" href="${lucene.javadoc.url}core" packagelistloc="${lucenedocs}/core"/>
          <link offline="true" href="${lucene.javadoc.url}analyzers-common" packagelistloc="${lucenedocs}/analyzers-common"/>
          <link offline="true" href="${lucene.javadoc.url}analyzers-icu" packagelistloc="${lucenedocs}/analyzers-icu"/>
          <link offline="true" href="${lucene.javadoc.url}analyzers-kuromoji" packagelistloc="${lucenedocs}/analyzers-kuromoji"/>
          <link offline="true" href="${lucene.javadoc.url}analyzers-morfologik" packagelistloc="${lucenedocs}/analyzers-morfologik"/>
          <link offline="true" href="${lucene.javadoc.url}analyzers-phonetic" packagelistloc="${lucenedocs}/analyzers-phonetic"/>
          <link offline="true" href="${lucene.javadoc.url}analyzers-smartcn" packagelistloc="${lucenedocs}/analyzers-smartcn"/>
          <link offline="true" href="${lucene.javadoc.url}analyzers-stempel" packagelistloc="${lucenedocs}/analyzers-stempel"/>
          <link offline="true" href="${lucene.javadoc.url}analyzers-uima" packagelistloc="${lucenedocs}/analyzers-uima"/>
          <link offline="true" href="${lucene.javadoc.url}backward-codecs" packagelistloc="${lucenedocs}/backward-codecs"/>
          <link offline="true" href="${lucene.javadoc.url}codecs" packagelistloc="${lucenedocs}/codecs"/>
          <link offline="true" href="${lucene.javadoc.url}expressions" packagelistloc="${lucenedocs}/expressions"/>
          <link offline="true" href="${lucene.javadoc.url}suggest" packagelistloc="${lucenedocs}/suggest"/>
          <link offline="true" href="${lucene.javadoc.url}grouping" packagelistloc="${lucenedocs}/grouping"/>
          <link offline="true" href="${lucene.javadoc.url}queries" packagelistloc="${lucenedocs}/queries"/>
          <link offline="true" href="${lucene.javadoc.url}queryparser" packagelistloc="${lucenedocs}/queryparser"/>
          <link offline="true" href="${lucene.javadoc.url}highlighter" packagelistloc="${lucenedocs}/highlighter"/>
          <link offline="true" href="${lucene.javadoc.url}memory" packagelistloc="${lucenedocs}/memory"/>
          <link offline="true" href="${lucene.javadoc.url}misc" packagelistloc="${lucenedocs}/misc"/>
          <link offline="true" href="${lucene.javadoc.url}spatial" packagelistloc="${lucenedocs}/spatial"/>
          <links/>
          <link href=""/>
        </sources>
      </invoke-javadoc>
    </sequential>
  </macrodef>
{'fraction_non_alphanumeric': 0.1865472502530442, 'fraction_numerical': 0.0007361285771248045, 'mean_word_length': 4.104744011272898, 'pattern_counts': {'":': 0, '<': 506, '<?xml version=': 0, '>': 506, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 6}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1151042', 'n_tokens_mistral': 11211, 'n_tokens_neox': 10452, 'n_words': 1751}