You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by dw...@apache.org on 2021/03/10 10:03:39 UTC

[lucene] 02/18: LUCENE-6938: Convert build to work with Git rather than SVN. (Mark Miller via Dawid Weiss).

This is an automated email from the ASF dual-hosted git repository.

dweiss pushed a commit to branch branch_5_4
in repository https://gitbox.apache.org/repos/asf/lucene.git

commit 7f9506ca82032804f2354fef71201366fcbf9932
Author: Dawid Weiss <da...@carrotsearch.com>
AuthorDate: Sat Jan 23 02:46:55 2016 +0100

    LUCENE-6938: Convert build to work with Git rather than SVN. (Mark Miller
    via Dawid Weiss).
---
 .gitignore              |  3 ++
 lucene/build.xml        | 16 +++++------
 lucene/common-build.xml | 75 ++++++++++++-------------------------------------
 solr/build.xml          | 20 ++++++-------
 4 files changed, 39 insertions(+), 75 deletions(-)

diff --git a/.gitignore b/.gitignore
index 03a42f4..7d712b4 100644
--- a/.gitignore
+++ b/.gitignore
@@ -47,3 +47,6 @@ solr/contrib/dataimporthandler/test-lib/
 solr/contrib/morphlines-core/test-lib/
 
 solr/core/test-lib/
+
+solr/server/solr-webapp
+solr/server/start.jar
diff --git a/lucene/build.xml b/lucene/build.xml
index 99e108a..712e14b 100644
--- a/lucene/build.xml
+++ b/lucene/build.xml
@@ -335,25 +335,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/java7"/>
+    <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.xml
index 5153450..d6167c1 100644
--- a/lucene/common-build.xml
+++ b/lucene/common-build.xml
@@ -248,14 +248,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" />
@@ -639,14 +632,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}">
         <!--
@@ -678,7 +669,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}"/>
@@ -1568,7 +1559,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 the
   file, but source distributions cannot because of legal reasons.
   #########################################################################
   
@@ -2264,51 +2255,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.xml
index 215c949..1b30dc9 100644
--- a/solr/build.xml
+++ b/solr/build.xml
@@ -447,36 +447,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/java7"/>
+    <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}"/>