Skip to content

Commit 55005f0

Browse files
committed
LUCENE-6938: Convert build to work with Git rather than SVN. (Mark Miller
via Dawid Weiss).
1 parent c4244eb commit 55005f0

File tree

4 files changed

+37
-75
lines changed

4 files changed

+37
-75
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -48,4 +48,5 @@ solr/contrib/morphlines-core/test-lib/
4848

4949
solr/core/test-lib/
5050

51+
solr/server/solr-webapp
5152
solr/server/start.jar

lucene/build.xml

+8-8
Original file line numberDiff line numberDiff line change
@@ -336,25 +336,25 @@
336336
</target>
337337

338338
<!-- ================================================================== -->
339-
<!-- Packages the sources from "svn export" with tar-gzip -->
339+
<!-- Packages the sources with tar-gzip -->
340340
<!-- ================================================================== -->
341341
<target name="package-tgz-src" depends="init-dist"
342-
description="--> Generates the Lucene source distribution from 'svn export' as .tgz">
342+
description="--> Generates the Lucene source distribution as .tgz">
343343
<property name="source.package.file"
344344
value="${dist.dir}/lucene-${version}-src.tgz"/>
345345
<delete file="${source.package.file}"/>
346-
<svn-export-source source.dir="."/>
346+
<export-source source.dir="."/>
347347

348348
<!-- Exclude javadoc package-list files under licenses incompatible with the ASL -->
349-
<delete dir="${svn.export.dir}/tools/javadoc/java8"/>
349+
<delete dir="${src.export.dir}/tools/javadoc/java8"/>
350350
<!-- Exclude clover license files incompatible with the ASL -->
351-
<delete dir="${svn.export.dir}/tools/clover"/>
351+
<delete dir="${src.export.dir}/tools/clover"/>
352352

353-
<build-changes changes.src.file="${svn.export.dir}/CHANGES.txt"
354-
changes.target.dir="${svn.export.dir}/docs/changes"
353+
<build-changes changes.src.file="${src.export.dir}/CHANGES.txt"
354+
changes.target.dir="${src.export.dir}/docs/changes"
355355
changes.product="LUCENE"/>
356356
<tar tarfile="${source.package.file}" compression="gzip" longfile="gnu">
357-
<tarfileset prefix="lucene-${version}" dir="${svn.export.dir}"/>
357+
<tarfileset prefix="lucene-${version}" dir="${src.export.dir}"/>
358358
</tar>
359359
<make-checksums file="${source.package.file}"/>
360360
</target>

lucene/common-build.xml

+18-57
Original file line numberDiff line numberDiff line change
@@ -238,14 +238,7 @@
238238

239239
<property name="manifest.file" location="${build.dir}/MANIFEST.MF"/>
240240

241-
<!--
242-
we attempt to exec svnversion to get details build information
243-
for jar manifests. this property can be set at runtime to an
244-
explicit path as needed, or ant will just try to find it in the
245-
default PATH. (this is useful for Hudson)
246-
-->
247-
<property name="svnversion.exe" value="svnversion" />
248-
<property name="svn.exe" value="svn" />
241+
<property name="git.exe" value="git" />
249242
<property name="perl.exe" value="perl" />
250243

251244
<property name="python.exe" value="python" />
@@ -615,14 +608,12 @@
615608
<attribute name="manifest.file" default="${manifest.file}"/>
616609
<element name="additional-manifest-attributes" optional="true"/>
617610
<sequential>
618-
<local name="-svnversion-raw"/>
619-
<local name="svnversion"/>
620-
621-
<!-- If possible, include the svnversion -->
622-
<exec dir="." executable="${svnversion.exe}" outputproperty="-svnversion-raw" failifexecutionfails="false"/>
623-
<condition property="svnversion" value="${-svnversion-raw}" else="unknown">
624-
<matches pattern="^\s*[\d:MSP]+\s*$" string="${-svnversion-raw}" casesensitive="true"/>
625-
</condition>
611+
<exec dir="." executable="${git.exe}" outputproperty="checkoutid" failifexecutionfails="false">
612+
<arg value="log"/>
613+
<arg value="--format='%H'"/>
614+
<arg value="-n"/>
615+
<arg value="1"/>
616+
</exec>
626617

627618
<manifest file="@{manifest.file}">
628619
<!--
@@ -654,7 +645,7 @@
654645
<attribute name="Implementation-Title" value="@{implementation.title}"/>
655646
<!-- impl version can be any string -->
656647
<attribute name="Implementation-Version"
657-
value="${version} ${svnversion} - ${user.name} - ${DSTAMP} ${TSTAMP}"/>
648+
value="${version} ${checkoutid} - ${user.name} - ${DSTAMP} ${TSTAMP}"/>
658649
<attribute name="Implementation-Vendor"
659650
value="The Apache Software Foundation"/>
660651
<attribute name="X-Compile-Source-JDK" value="${javac.source}"/>
@@ -1540,7 +1531,7 @@ ${tests-output}/junit4-*.suites - per-JVM executed suites
15401531
15411532
$ ant -Dclover.license.path=/path/to/clover.license -Drun.clover=true ...
15421533
1543-
Apache Lucene/Solr source checkouts from SVN already contain the
1534+
Apache Lucene/Solr source checkouts from Git already contain the
15441535
file, but source distributions cannot because of legal reasons.
15451536
#########################################################################
15461537
@@ -2170,51 +2161,21 @@ ${ant.project.name}.test.dependencies=${test.classpath.list}
21702161
<target name="validate">
21712162
</target>
21722163

2173-
<property name="svn.export.dir" location="${build.dir}/svn-export"/>
2174-
<macrodef name="svn-export-source"
2175-
description="Runs 'svn export' with the same URL and revision as the current working copy.">
2164+
<property name="src.export.dir" location="${build.dir}/src-export"/>
2165+
<macrodef name="export-source"
2166+
description="Exports the source to src.export.dir.">
21762167
<attribute name="source.dir"/>
21772168
<sequential>
2178-
<delete dir="${svn.export.dir}" includeemptydirs="true" failonerror="false"/>
2179-
<get-svn-info directory="@{source.dir}"/>
2180-
<exec dir="@{source.dir}" executable="${svn.exe}" failonerror="true">
2181-
<arg value="export"/>
2182-
<arg value="--native-eol"/>
2183-
<arg value="LF"/>
2184-
<arg value="-r"/>
2185-
<arg value="${svn.Revision}"/>
2186-
<arg value="${svn.URL}"/>
2187-
<arg value="${svn.export.dir}"/>
2169+
<delete dir="${src.export.dir}" includeemptydirs="true" failonerror="false"/>
2170+
<exec dir="@{source.dir}" executable="${git.exe}" failonerror="true">
2171+
<arg value="checkout-index"/>
2172+
<arg value="-a"/>
2173+
<arg value="-f"/>
2174+
<arg value="--prefix=${src.export.dir}/"/>
21882175
</exec>
21892176
</sequential>
21902177
</macrodef>
21912178

2192-
<macrodef name="get-svn-info"
2193-
description="Populates properties svn.URL and svn.Revision using 'svn info'.">
2194-
<attribute name="directory"/>
2195-
<sequential>
2196-
<exec dir="@{directory}" executable="${svnversion.exe}" outputproperty="svn.ver"/>
2197-
<fail message="A subversion checkout is required for this target">
2198-
<condition>
2199-
<matches pattern="(exported|unversioned.*)" string="${svn.ver}" casesensitive="false"/>
2200-
</condition>
2201-
</fail>
2202-
<exec dir="@{directory}" executable="${svn.exe}" outputproperty="svn.info" failonerror="true">
2203-
<arg value="info"/>
2204-
</exec>
2205-
<loadproperties>
2206-
<propertyresource name="svn.info"/>
2207-
<filterchain>
2208-
<linecontainsregexp>
2209-
<regexp pattern="(URL|Revision):"/>
2210-
</linecontainsregexp>
2211-
<replacestring from=": " to="="/>
2212-
<prefixlines prefix="svn."/>
2213-
</filterchain>
2214-
</loadproperties>
2215-
</sequential>
2216-
</macrodef>
2217-
22182179
<macrodef name="make-checksums" description="Macro for building checksum files">
22192180
<attribute name="file"/>
22202181
<sequential>

solr/build.xml

+10-10
Original file line numberDiff line numberDiff line change
@@ -448,36 +448,36 @@
448448
dest="${package.dir}/KEYS"/>
449449
</target>
450450

451-
<!-- Makes a tarball from running "svn export" at the root level. -->
451+
<!-- Makes a tarball of the source. -->
452452
<!-- Copies NOTICE.txt and LICENSE.txt from solr/ to the root level. -->
453453
<target name="package-src-tgz" depends="init-dist"
454454
description="Packages the Solr Source Distribution">
455455
<property name="source.package.file"
456456
value="${package.dir}/${fullnamever}-src.tgz"/>
457457
<delete file="${source.package.file}" failonerror="false" />
458-
<svn-export-source source.dir=".."/>
458+
<export-source source.dir=".."/>
459459

460460
<!-- Exclude javadoc package-list files under licenses incompatible with the ASL -->
461-
<delete dir="${svn.export.dir}/lucene/tools/javadoc/java8"/>
461+
<delete dir="${src.export.dir}/lucene/tools/javadoc/java8"/>
462462
<!-- Exclude clover license files incompatible with the ASL -->
463-
<delete dir="${svn.export.dir}/lucene/tools/clover"/>
463+
<delete dir="${src.export.dir}/lucene/tools/clover"/>
464464

465-
<build-changes changes.src.file="${svn.export.dir}/solr/CHANGES.txt"
466-
changes.target.dir="${svn.export.dir}/solr/docs/changes"
465+
<build-changes changes.src.file="${src.export.dir}/solr/CHANGES.txt"
466+
changes.target.dir="${src.export.dir}/solr/docs/changes"
467467
changes.product="SOLR"/>
468468

469469
<tar destfile="${source.package.file}" compression="gzip" longfile="gnu">
470-
<tarfileset dir="${svn.export.dir}/lucene"
470+
<tarfileset dir="${src.export.dir}/lucene"
471471
includes="CHANGES.txt"
472472
fullpath="${fullnamever}/solr/LUCENE_CHANGES.txt" />
473-
<tarfileset dir="${svn.export.dir}"
473+
<tarfileset dir="${src.export.dir}"
474474
prefix="${fullnamever}"
475475
excludes="solr/example/**/*.sh solr/example/**/bin/ solr/scripts/**"/>
476-
<tarfileset dir="${svn.export.dir}"
476+
<tarfileset dir="${src.export.dir}"
477477
prefix="${fullnamever}"
478478
filemode="755"
479479
includes="solr/example/**/*.sh solr/example/**/bin/ solr/scripts/**"/>
480-
<tarfileset dir="${svn.export.dir}/solr" prefix="${fullnamever}"
480+
<tarfileset dir="${src.export.dir}/solr" prefix="${fullnamever}"
481481
includes="NOTICE.txt,LICENSE.txt"/>
482482
</tar>
483483
<make-checksums file="${source.package.file}"/>

0 commit comments

Comments
 (0)