blob: 90d72b29d8ff6d21e84c0bb88a9f2846cb7e1e3c [file] [log] [blame]
<?xml version="1.0" encoding="UTF-8"?>
<!--
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="Apache Knox Gateway" default="build" basedir=".">
<description>
Release build file for the Apache Knox Gateway
</description>
<property name="gateway-name" value="Apache Knox (Incubator)"/>
<property name="gateway-project" value="knox"/>
<property name="gateway-artifact" value="knox-incubating"/>
<property name="gateway-version" value="0.3.0"/>
<property name="release-manager" value="kminder"/>
<property name="gateway-home" value="${gateway-artifact}-${gateway-version}"/>
<property name="build-url" value="https://builds.apache.org/job/Knox-${gateway-version}/ws/target/${gateway-version}"/>
<property name="install.dir" value="install"/>
<property name="candidate.dir" value="candidate"/>
<property name="svn.release.path" value="https://dist.apache.org/repos/dist/release/incubator/${gateway-project}" />
<property name="svn.staging.path" value="https://dist.apache.org/repos/dist/dev/incubator/${gateway-project}" />
<condition property="isUnix">
<os family="unix"/>
</condition>
<condition property="mvn.cmd" value="mvn">
<os family="unix" />
</condition>
<condition property="mvn.cmd" value="mvn.bat">
<os family="windows" />
</condition>
<condition property="svn.cmd" value="svn">
<os family="unix" />
</condition>
<condition property="svn.cmd" value="svn">
<os family="windows" />
</condition>
<condition property="curl.cmd" value="curl">
<os family="unix" />
</condition>
<condition property="curl.cmd" value="curl">
<os family="windows" />
</condition>
<condition property="rpm-builder" value="./gateway-rpm/build_knox_rpm.sh">
<os family="unix" />
</condition>
<target name="_init" description="Initialize the build.">
</target>
<target name="clean" depends="_init" description="Clean up any build artifacts.">
<delete dir="target"/>
<delete dir="${install.dir}"/>
<delete dir="${candidate.dir}"/>
</target>
<target name="build" depends="_init" description="Build the product.">
<exec executable="${mvn.cmd}">
<arg value="clean"/>
<arg value="install"/>
</exec>
</target>
<target name="verify" depends="package" description="Perform the verification build."/>
<target name="package" depends="_init" description="Build and package the product (aka verify).">
<exec executable="${mvn.cmd}">
<arg value="-Prelease"/>
<arg value="clean"/>
<arg value="install"/>
</exec>
<copy file="KEYS" todir="target/${gateway-version}">
<fileset file="KEYS"/>
<fileset file="gateway-release/home/CHANGES"/>
</copy>
</target>
<target name="daily" depends="full" description="Perform the daily build."/>
<target name="full" depends="_init" description="Perform a full build (aka daily).">
<exec executable="${mvn.cmd}">
<arg value="-Panalyze"/>
<arg value="-Prelease"/>
<arg value="site"/>
</exec>
</target>
<target name="post-build" depends="_init,_rpm,_changes"/>
<target name="_changes" depends="_init">
<copy file="gateway-release/home/CHANGES" todir="target/${gateway-version}"/>
</target>
<target name="set-rpm-builder-privs" if="isUnix">
<chmod file="${rpm-builder}" perm="700"/>
</target>
<target name="rpm" depends="package,_rpm" description="Package and build RPM of the product."/>
<target name="_rpm" depends="_init,set-rpm-builder-privs" description="Build RPM of the product from existing package.">
<exec executable="${rpm-builder}">
<arg value="target"/>
<arg value="${gateway-artifact}"/>
<arg value="${gateway-version}"/>
<arg value="${release-manager}"/>
</exec>
<checksum file="target/${gateway-version}/${gateway-artifact}-${gateway-version}.rpm" algorithm="MD5" fileext=".md5" forceOverwrite="yes"/>
<checksum file="target/${gateway-version}/${gateway-artifact}-${gateway-version}.rpm" algorithm="SHA1" fileext=".sha" forceOverwrite="yes"/>
</target>
<target name="build-candidate">
<exec executable="${curl.cmd}">
<arg value="--silent"/>
<arg value="--request"/>
<arg value="POST"/>
<arg value="https://builds.apache.org/job/Knox-${gateway-version}/build?token=knox-remote-build-token"/>
</exec>
</target>
<target name="download-candidate">
<mkdir dir="${candidate.dir}"/>
<get dest="${candidate.dir}">
<url url="${build-url}/knox-incubating-${gateway-version}.zip"/>
<url url="${build-url}/knox-incubating-${gateway-version}.zip.md5"/>
<url url="${build-url}/knox-incubating-${gateway-version}.zip.sha"/>
<url url="${build-url}/knox-incubating-${gateway-version}-src.zip"/>
<url url="${build-url}/knox-incubating-${gateway-version}-src.zip.md5"/>
<url url="${build-url}/knox-incubating-${gateway-version}-src.zip.sha"/>
<url url="${build-url}/knox-incubating-${gateway-version}.tar.gz"/>
<url url="${build-url}/knox-incubating-${gateway-version}.tar.gz.md5"/>
<url url="${build-url}/knox-incubating-${gateway-version}.tar.gz.sha"/>
<url url="${build-url}/knox-incubating-${gateway-version}.rpm"/>
<url url="${build-url}/knox-incubating-${gateway-version}.rpm.md5"/>
<url url="${build-url}/knox-incubating-${gateway-version}.rpm.sha"/>
<url url="${build-url}/CHANGES"/>
</get>
</target>
<target name="download-stage">
<mkdir dir="${install.dir}"/>
<get dest="${install.dir}">
<url url="${svn.staging.path}/knox-incubating-${gateway-version}/knox-incubating-${gateway-version}.zip"/>
<url url="${svn.staging.path}/knox-incubating-${gateway-version}/knox-incubating-${gateway-version}.zip.md5"/>
<url url="${svn.staging.path}/knox-incubating-${gateway-version}/knox-incubating-${gateway-version}.zip.sha"/>
<url url="${svn.staging.path}/knox-incubating-${gateway-version}/knox-incubating-${gateway-version}.zip.asc"/>
<url url="${svn.staging.path}/knox-incubating-${gateway-version}/knox-incubating-${gateway-version}-src.zip"/>
<url url="${svn.staging.path}/knox-incubating-${gateway-version}/knox-incubating-${gateway-version}-src.zip.md5"/>
<url url="${svn.staging.path}/knox-incubating-${gateway-version}/knox-incubating-${gateway-version}-src.zip.sha"/>
<url url="${svn.staging.path}/knox-incubating-${gateway-version}/knox-incubating-${gateway-version}-src.zip.asc"/>
<url url="${svn.staging.path}/knox-incubating-${gateway-version}/knox-incubating-${gateway-version}.tar.gz"/>
<url url="${svn.staging.path}/knox-incubating-${gateway-version}/knox-incubating-${gateway-version}.tar.gz.md5"/>
<url url="${svn.staging.path}/knox-incubating-${gateway-version}/knox-incubating-${gateway-version}.tar.gz.sha"/>
<url url="${svn.staging.path}/knox-incubating-${gateway-version}/knox-incubating-${gateway-version}.tar.gz.asc"/>
<url url="${svn.staging.path}/knox-incubating-${gateway-version}/knox-incubating-${gateway-version}.rpm"/>
<url url="${svn.staging.path}/knox-incubating-${gateway-version}/knox-incubating-${gateway-version}.rpm.md5"/>
<url url="${svn.staging.path}/knox-incubating-${gateway-version}/knox-incubating-${gateway-version}.rpm.sha"/>
<url url="${svn.staging.path}/knox-incubating-${gateway-version}/knox-incubating-${gateway-version}.rpm.asc"/>
<url url="${svn.staging.path}/knox-incubating-${gateway-version}/CHANGES"/>
<url url="${svn.staging.path}/knox-incubating-${gateway-version}/KEYS"/>
</get>
</target>
<target name="verify-stage" depends="_init">
<echo>Verify ${gateway-artifact}-${gateway-version}.zip</echo>
<exec executable="gpg" dir="${install.dir}" failonerror="true">
<arg value="--verify"/>
<arg value="${gateway-artifact}-${gateway-version}.zip.asc"/>
</exec>
<checksum file="${install.dir}/${gateway-artifact}-${gateway-version}.zip" verifyproperty="zip.md5.ok"/>
<fail message="MD5 Invalid"><condition><isfalse value="${zip.md5.ok}"/></condition></fail>
<checksum file="${install.dir}/${gateway-artifact}-${gateway-version}.zip" algorithm="SHA" verifyproperty="zip.sha.ok"/>
<fail message="SHA Invalid"><condition><isfalse value="${zip.sha.ok}"/></condition></fail>
<echo>Verify ${gateway-artifact}-${gateway-version}-src.zip</echo>
<exec executable="gpg" dir="${install.dir}" failonerror="true">
<arg value="--verify"/>
<arg value="${gateway-artifact}-${gateway-version}-src.zip.asc"/>
</exec>
<checksum file="${install.dir}/${gateway-artifact}-${gateway-version}-src.zip" verifyproperty="src.md5.ok"/>
<fail message="MD5 Invalid"><condition><isfalse value="${src.md5.ok}"/></condition></fail>
<checksum file="${install.dir}/${gateway-artifact}-${gateway-version}-src.zip" algorithm="SHA" verifyproperty="src.sha.ok"/>
<fail message="SHA Invalid"><condition><isfalse value="${src.sha.ok}"/></condition></fail>
<echo>Verify ${gateway-artifact}-${gateway-version}.tar.gz</echo>
<exec executable="gpg" dir="${install.dir}" failonerror="true">
<arg value="--verify"/>
<arg value="${gateway-artifact}-${gateway-version}.tar.gz.asc"/>
</exec>
<checksum file="${install.dir}/${gateway-artifact}-${gateway-version}.tar.gz" verifyproperty="tar.md5.ok"/>
<fail message="MD5 Invalid"><condition><isfalse value="${tar.md5.ok}"/></condition></fail>
<checksum file="${install.dir}/${gateway-artifact}-${gateway-version}.tar.gz" algorithm="SHA" verifyproperty="tar.sha.ok"/>
<fail message="SHA Invalid"><condition><isfalse value="${tar.sha.ok}"/></condition></fail>
<echo>Verify ${gateway-artifact}-${gateway-version}.rpm</echo>
<exec executable="gpg" dir="${install.dir}" failonerror="true">
<arg value="--verify"/>
<arg value="${gateway-artifact}-${gateway-version}.rpm.asc"/>
</exec>
<checksum file="${install.dir}/${gateway-artifact}-${gateway-version}.rpm" verifyproperty="rpm.md5.ok"/>
<fail message="MD5 Invalid"><condition><isfalse value="${rpm.md5.ok}"/></condition></fail>
<checksum file="${install.dir}/${gateway-artifact}-${gateway-version}.rpm" algorithm="SHA" verifyproperty="rpm.sha.ok"/>
<fail message="SHA Invalid"><condition><isfalse value="${rpm.sha.ok}"/></condition></fail>
</target>
<target name="sign-candidate" depends="_init" description="Sign a downloaded created release.">
<delete>
<fileset dir="${candidate.dir}" includes="*.asc,KEYS"/>
</delete>
<exec executable="gpg" dir="${candidate.dir}">
<arg value="--armor"/>
<arg value="--detach-sig"/>
<arg value="${gateway-artifact}-${gateway-version}.zip"/>
</exec>
<exec executable="gpg" dir="${candidate.dir}">
<arg value="--armor"/>
<arg value="--detach-sig"/>
<arg value="${gateway-artifact}-${gateway-version}-src.zip"/>
</exec>
<exec executable="gpg" dir="${candidate.dir}">
<arg value="--armor"/>
<arg value="--detach-sig"/>
<arg value="${gateway-artifact}-${gateway-version}.tar.gz"/>
</exec>
<exec executable="gpg" dir="${candidate.dir}">
<arg value="--armor"/>
<arg value="--detach-sig"/>
<arg value="${gateway-artifact}-${gateway-version}.rpm"/>
</exec>
<exec executable="gpg" dir="${candidate.dir}">
<arg value="--export"/>
<arg value="--armor"/>
<arg value="--output"/>
<arg value="KEYS"/>
</exec>
<copy file="src/vote.txt" tofile="target/vote.txt">
<filterchain>
<expandproperties/>
</filterchain>
</copy>
<loadfile property="stage-message" srcFile="src/stage.txt">
<filterchain>
<expandproperties/>
</filterchain>
</loadfile>
<echo message="${stage-message}"/>
</target>
<target name="release" depends="package,rpm" description="Build release artifacts including RPM and sign."/>
<target name="stage-candidate" depends="unstage-candidate" description="Stage release artifacts.">
<exec executable="svn">
<arg value="import" />
<arg value="${candidate.dir}"/>
<arg value="${svn.staging.path}/${gateway-artifact}-${gateway-version}/"/>
<arg value="-m"/>
<arg value="Staging Apache Knox Gateway version ${gateway-version}."/>
</exec>
</target>
<target name="unstage-candidate" description="Delete staged release artifacts.">
<exec executable="svn">
<arg value="delete" />
<arg value="${svn.staging.path}/${gateway-artifact}-${gateway-version}/"/>
<arg value="-m"/>
<arg value="Removing Apache Knox Gateway version ${gateway-version} from staging."/>
</exec>
</target>
<target name="promote-release" description="Promote staged artifacts to release area.">
<exec executable="svn">
<arg value="move"/>
<arg value="${svn.staging.path}/${gateway-artifact}-${gateway-version}"/>
<arg value="${svn.release.path}"/>
<arg value="-m"/>
<arg value="Releasing Apache Knox Gateway version ${gateway-version}." />
</exec>
</target>
<target name="install-test-home" description="Install binary release into install directory.">
<delete dir="${install.dir}" quiet="true"/>
<unzip src="target/${gateway-version}/${gateway-artifact}-${gateway-version}.zip/" dest="${install.dir}"/>
<echo file="${install.dir}/${gateway-artifact}-${gateway-version}/conf/security/master">#1.0# Mon, Aug 26 2013 14:25:31.483
cGkvajhUZHBNSTQ9OjpPMk5PQktYaHRyUmJoTW1zWGo0bytRPT06OkxtVjlvSDdIOWdvSEZqNTRlWVJ2N3c9PQ==</echo>
<chmod file="${install.dir}/${gateway-artifact}-${gateway-version}/conf/security/master" perm="600"/>
</target>
<target name="spawn-test-ldap" description="Spawn test LDAP server.">
<exec executable="java" dir="${install.dir}/${gateway-artifact}-${gateway-version}" spawn="true">
<arg value="-jar"/>
<arg value="bin/ldap.jar"/>
<arg value="conf"/>
</exec>
</target>
<target name="start-test-ldap" description="Spawn test LDAP server.">
<exec executable="java" dir="${install.dir}/${gateway-artifact}-${gateway-version}">
<arg value="-jar"/>
<arg value="bin/ldap.jar"/>
<arg value="conf"/>
</exec>
</target>
<target name="start-test-gateway" description="Start test gateway server.">
<exec executable="java" dir="${install.dir}/${gateway-artifact}-${gateway-version}">
<arg value="-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005"/>
<arg value="-jar"/>
<arg value="bin/gateway.jar"/>
</exec>
</target>
<target name="start-test-servers" depends="spawn-test-ldap,start-test-gateway" description="Spawn test LDAP server and start test gateway server."/>
</project>