Skip to content

armgit / solr

Public Imported from GitHub
0

Apache Solr open-source search software

LUCENE-2267: Add support for gpg signing to build.xml

Uwe Schindler0f42e34dcdcf
diff --git a/build.xml b/build.xml
index 85abf65c7b0..4df111e8acd 100644
--- a/build.xml
+++ b/build.xml
@@ -549,6 +549,48 @@
</sequential>
</target>
+ <!-- ================================================================== -->
+ <!-- support for signing the artifacts using gpg -->
+ <!-- ================================================================== -->
+ <target name="clean-dist-signatures">
+ <delete failonerror="false">
+ <fileset dir="${dist.dir}">
+ <include name="**/*.asc"/>
+ </fileset>
+ </delete>
+ </target>
+
+ <target name="sign-artifacts" depends="clean-dist-signatures">
+ <available property="gpg.input.handler" classname="org.apache.tools.ant.input.SecureInputHandler"
+ value="org.apache.tools.ant.input.SecureInputHandler"/>
+ <!--else:--><property name="gpg.input.handler" value="org.apache.tools.ant.input.DefaultInputHandler"/>
+ <input message="Enter GPG keystore password: >" addproperty="gpg.passphrase">
+ <handler classname="${gpg.input.handler}" />
+ </input>
+
+ <apply executable="${gpg.exe}" inputstring="${gpg.passphrase}"
+ dest="${dist.dir}" type="file" maxparallel="1" verbose="yes">
+ <arg value="--passphrase-fd"/>
+ <arg value="0"/>
+ <arg value="--batch"/>
+ <arg value="--armor"/>
+ <arg value="--default-key"/>
+ <arg value="${gpg.key}"/>
+ <arg value="--output"/>
+ <targetfile/>
+ <arg value="--detach-sig"/>
+ <srcfile/>
+
+ <fileset dir="${dist.dir}">
+ <include name="**/*.jar"/>
+ <include name="**/*.zip"/>
+ <include name="**/*.tar.gz"/>
+ <include name="**/*.pom"/>
+ </fileset>
+ <globmapper from="*" to="*.asc"/>
+ </apply>
+ </target>
+
<!-- ================================================================== -->
<!-- Build the JavaCC files into the source tree -->
<!-- ================================================================== -->
diff --git a/common-build.xml b/common-build.xml
index 0cb974df21f..a2ad02b4a3a 100644
--- a/common-build.xml
+++ b/common-build.xml
@@ -113,6 +113,9 @@
<property name="svnversion.exe" value="svnversion" />
<property name="svn.exe" value="svn" />
+ <property name="gpg.exe" value="gpg" />
+ <property name="gpg.key" value="CODE SIGNING KEY" />
+
<condition property="build-1-5-contrib">
<equals arg1="1.5" arg2="${ant.java.version}" />
</condition>