Apache Lucene open-source search software
LUCENE-6938: Convert build to work with Git rather than SVN. (Mark Miller via Dawid Weiss).
Dawid Weiss55005f0a7dc4
diff --git a/.gitignore b/.gitignoreindex 71bc12a7c4c..7d712b42377 100644--- a/.gitignore+++ b/.gitignore@@ -48,4 +48,5 @@ solr/contrib/morphlines-core/test-lib/solr/core/test-lib/+solr/server/solr-webappsolr/server/start.jardiff --git a/lucene/build.xml b/lucene/build.xmlindex b7f790db356..e6d1418a067 100644--- a/lucene/build.xml+++ b/lucene/build.xml@@ -336,25 +336,25 @@</target><!-- ================================================================== -->- <!-- Packages the sources from "svn export" with tar-gzip -->+ <!-- Packages the sources with tar-gzip --><!-- ================================================================== --><target name="package-tgz-src" depends="init-dist"- description="--> Generates the Lucene source distribution from 'svn export' as .tgz">+ description="--> Generates the Lucene source distribution as .tgz"><property name="source.package.file"value="${dist.dir}/lucene-${version}-src.tgz"/><delete file="${source.package.file}"/>- <svn-export-source source.dir="."/>+ <export-source source.dir="."/><!-- Exclude javadoc package-list files under licenses incompatible with the ASL -->- <delete dir="${svn.export.dir}/tools/javadoc/java8"/>+ <delete dir="${src.export.dir}/tools/javadoc/java8"/><!-- Exclude clover license files incompatible with the ASL -->- <delete dir="${svn.export.dir}/tools/clover"/>+ <delete dir="${src.export.dir}/tools/clover"/>- <build-changes changes.src.file="${svn.export.dir}/CHANGES.txt"- changes.target.dir="${svn.export.dir}/docs/changes"+ <build-changes changes.src.file="${src.export.dir}/CHANGES.txt"+ changes.target.dir="${src.export.dir}/docs/changes"changes.product="LUCENE"/><tar tarfile="${source.package.file}" compression="gzip" longfile="gnu">- <tarfileset prefix="lucene-${version}" dir="${svn.export.dir}"/>+ <tarfileset prefix="lucene-${version}" dir="${src.export.dir}"/></tar><make-checksums file="${source.package.file}"/></target>diff --git a/lucene/common-build.xml b/lucene/common-build.xmlindex 7927c7a7940..dc4bd465033 100644--- a/lucene/common-build.xml+++ b/lucene/common-build.xml@@ -238,14 +238,7 @@<property name="manifest.file" location="${build.dir}/MANIFEST.MF"/>- <!--- we attempt to exec svnversion to get details build information- for jar manifests. this property can be set at runtime to an- explicit path as needed, or ant will just try to find it in the- default PATH. (this is useful for Hudson)- -->- <property name="svnversion.exe" value="svnversion" />- <property name="svn.exe" value="svn" />+ <property name="git.exe" value="git" /><property name="perl.exe" value="perl" /><property name="python.exe" value="python" />@@ -615,14 +608,12 @@<attribute name="manifest.file" default="${manifest.file}"/><element name="additional-manifest-attributes" optional="true"/><sequential>- <local name="-svnversion-raw"/>- <local name="svnversion"/>-- <!-- If possible, include the svnversion -->- <exec dir="." executable="${svnversion.exe}" outputproperty="-svnversion-raw" failifexecutionfails="false"/>- <condition property="svnversion" value="${-svnversion-raw}" else="unknown">- <matches pattern="^\s*[\d:MSP]+\s*$" string="${-svnversion-raw}" casesensitive="true"/>- </condition>+ <exec dir="." executable="${git.exe}" outputproperty="checkoutid" failifexecutionfails="false">+ <arg value="log"/>+ <arg value="--format='%H'"/>+ <arg value="-n"/>+ <arg value="1"/>+ </exec><manifest file="@{manifest.file}"><!--@@ -654,7 +645,7 @@<attribute name="Implementation-Title" value="@{implementation.title}"/><!-- impl version can be any string --><attribute name="Implementation-Version"- value="${version} ${svnversion} - ${user.name} - ${DSTAMP} ${TSTAMP}"/>+ value="${version} ${checkoutid} - ${user.name} - ${DSTAMP} ${TSTAMP}"/><attribute name="Implementation-Vendor"value="The Apache Software Foundation"/><attribute name="X-Compile-Source-JDK" value="${javac.source}"/>@@ -1540,7 +1531,7 @@ ${tests-output}/junit4-*.suites - per-JVM executed suites$ ant -Dclover.license.path=/path/to/clover.license -Drun.clover=true ...- Apache Lucene/Solr source checkouts from SVN already contain the+ Apache Lucene/Solr source checkouts from Git already contain thefile, but source distributions cannot because of legal reasons.#########################################################################@@ -2170,51 +2161,21 @@ ${ant.project.name}.test.dependencies=${test.classpath.list}<target name="validate"></target>- <property name="svn.export.dir" location="${build.dir}/svn-export"/>- <macrodef name="svn-export-source"- description="Runs 'svn export' with the same URL and revision as the current working copy.">+ <property name="src.export.dir" location="${build.dir}/src-export"/>+ <macrodef name="export-source"+ description="Exports the source to src.export.dir."><attribute name="source.dir"/><sequential>- <delete dir="${svn.export.dir}" includeemptydirs="true" failonerror="false"/>- <get-svn-info directory="@{source.dir}"/>- <exec dir="@{source.dir}" executable="${svn.exe}" failonerror="true">- <arg value="export"/>- <arg value="--native-eol"/>- <arg value="LF"/>- <arg value="-r"/>- <arg value="${svn.Revision}"/>- <arg value="${svn.URL}"/>- <arg value="${svn.export.dir}"/>+ <delete dir="${src.export.dir}" includeemptydirs="true" failonerror="false"/>+ <exec dir="@{source.dir}" executable="${git.exe}" failonerror="true">+ <arg value="checkout-index"/>+ <arg value="-a"/>+ <arg value="-f"/>+ <arg value="--prefix=${src.export.dir}/"/></exec></sequential></macrodef>- <macrodef name="get-svn-info"- description="Populates properties svn.URL and svn.Revision using 'svn info'.">- <attribute name="directory"/>- <sequential>- <exec dir="@{directory}" executable="${svnversion.exe}" outputproperty="svn.ver"/>- <fail message="A subversion checkout is required for this target">- <condition>- <matches pattern="(exported|unversioned.*)" string="${svn.ver}" casesensitive="false"/>- </condition>- </fail>- <exec dir="@{directory}" executable="${svn.exe}" outputproperty="svn.info" failonerror="true">- <arg value="info"/>- </exec>- <loadproperties>- <propertyresource name="svn.info"/>- <filterchain>- <linecontainsregexp>- <regexp pattern="(URL|Revision):"/>- </linecontainsregexp>- <replacestring from=": " to="="/>- <prefixlines prefix="svn."/>- </filterchain>- </loadproperties>- </sequential>- </macrodef>-<macrodef name="make-checksums" description="Macro for building checksum files"><attribute name="file"/><sequential>diff --git a/solr/build.xml b/solr/build.xmlindex 473b9dcde1b..e7935aab31d 100644--- a/solr/build.xml+++ b/solr/build.xml@@ -448,36 +448,36 @@dest="${package.dir}/KEYS"/></target>- <!-- Makes a tarball from running "svn export" at the root level. -->+ <!-- Makes a tarball of the source. --><!-- Copies NOTICE.txt and LICENSE.txt from solr/ to the root level. --><target name="package-src-tgz" depends="init-dist"description="Packages the Solr Source Distribution"><property name="source.package.file"value="${package.dir}/${fullnamever}-src.tgz"/><delete file="${source.package.file}" failonerror="false" />- <svn-export-source source.dir=".."/>+ <export-source source.dir=".."/><!-- Exclude javadoc package-list files under licenses incompatible with the ASL -->- <delete dir="${svn.export.dir}/lucene/tools/javadoc/java8"/>+ <delete dir="${src.export.dir}/lucene/tools/javadoc/java8"/><!-- Exclude clover license files incompatible with the ASL -->- <delete dir="${svn.export.dir}/lucene/tools/clover"/>+ <delete dir="${src.export.dir}/lucene/tools/clover"/>- <build-changes changes.src.file="${svn.export.dir}/solr/CHANGES.txt"- changes.target.dir="${svn.export.dir}/solr/docs/changes"+ <build-changes changes.src.file="${src.export.dir}/solr/CHANGES.txt"+ changes.target.dir="${src.export.dir}/solr/docs/changes"changes.product="SOLR"/><tar destfile="${source.package.file}" compression="gzip" longfile="gnu">- <tarfileset dir="${svn.export.dir}/lucene"+ <tarfileset dir="${src.export.dir}/lucene"includes="CHANGES.txt"fullpath="${fullnamever}/solr/LUCENE_CHANGES.txt" />- <tarfileset dir="${svn.export.dir}"+ <tarfileset dir="${src.export.dir}"prefix="${fullnamever}"excludes="solr/example/**/*.sh solr/example/**/bin/ solr/scripts/**"/>- <tarfileset dir="${svn.export.dir}"+ <tarfileset dir="${src.export.dir}"prefix="${fullnamever}"filemode="755"includes="solr/example/**/*.sh solr/example/**/bin/ solr/scripts/**"/>- <tarfileset dir="${svn.export.dir}/solr" prefix="${fullnamever}"+ <tarfileset dir="${src.export.dir}/solr" prefix="${fullnamever}"includes="NOTICE.txt,LICENSE.txt"/></tar><make-checksums file="${source.package.file}"/>