Skip to content

Commit

Permalink
#0429 patch for master branch
Browse files Browse the repository at this point in the history
Signed-off-by: Stuart Halloway <stu@thinkrelevance.com>
  • Loading branch information
stuarthalloway committed Sep 23, 2010
1 parent d6bc47a commit 2b133f8
Show file tree
Hide file tree
Showing 2 changed files with 77 additions and 33 deletions.
73 changes: 40 additions & 33 deletions build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@
<property name="build" location="classes"/>
<property name="test-classes" location="test-classes"/>
<property name="dist" location="dist"/>
<!-- override this with -Ddeployment.url=scp://build.clojure.org/srv/test-deploy to test a deployment -->
<property name="deployment.url" location="scp://build.clojure.org/srv/www/releases"/>

<target name="debug">
<echo message="${deployment.url}"/>
</target>

<!-- version related properties -->
<property file="${cljsrc}/clojure/version.properties"/>
Expand All @@ -41,6 +47,7 @@
<not><equals arg1="${clojure.version.interim}" arg2="false" trim="true"/></not>
</condition>


<property name="clojure.version.label"
value="${clojure.version.major}.${clojure.version.minor}${clojure.version.incremental.label}${clojure.version.qualifier.label}${clojure.version.interim.label}"/>

Expand All @@ -56,7 +63,6 @@
<property name="slim_jar" location="clojure-slim-${clojure.version.label}.jar"/>
<property name="src_jar" location="clojure-sources-${clojure.version.label}.jar"/>


<!-- These make sense for building on tapestry.formos.com -->

<property name="snapshot.repo.dir" location="/var/www/maven-snapshot-repository"/>
Expand Down Expand Up @@ -128,7 +134,26 @@
</java>
</target>

<target name="clojure" depends="compile-clojure"
<target name="test-only"
description="Run clojure tests without recompiling first">
<java classname="clojure.main" failonerror="true">
<classpath>
<path location="${test-classes}"/>
<path location="${test}"/>
<path location="${build}"/>
<path location="${cljsrc}"/>
</classpath>
<arg value="-e"/>
<arg value="(require '(clojure [test-clojure :as main])) (main/run-ant)"/>
</java>
</target>

<target name="test"
description="Run clojure tests after compiling all sources and test sources"
depends="compile-java, compile-clojure, compile-tests, test-only">
</target>

<target name="clojure-jar" depends="test"
description="Create clojure jar file.">
<jar jarfile="${clojure_jar}" basedir="${build}">
<fileset dir="${cljsrc}">
Expand All @@ -143,22 +168,7 @@
<copy file="${clojure_jar}" tofile="${clojure_noversion_jar}" />
</target>

<target name="test"
description="Run clojure tests"
depends="compile-tests">
<!-- depends="clojure"> -->
<java classname="clojure.main" failonerror="true">
<classpath>
<path location="${test-classes}"/>
<path location="${test}"/>
<path location="${clojure_jar}"/>
</classpath>
<arg value="-e"/>
<arg value="(require '(clojure [test-clojure :as main])) (main/run-ant)"/>
</java>
</target>

<target name="clojure-slim" depends="compile-java"
<target name="clojure-jar-slim" depends="test"
description="Create clojure-slim jar file (omits compiled Clojure code)">
<jar jarfile="${slim_jar}">
<fileset dir="${build}" includes="clojure/asm/**"/>
Expand All @@ -176,7 +186,7 @@
<copy file="${slim_jar}" tofile="${slim_noversion_jar}" />
</target>

<target name="clojure-sources" depends="init"
<target name="clojure-jar-sources" depends="test"
description="Create a JAR of Java sources.">
<jar jarfile="${src_jar}" basedir="${jsrc}" includes="**/*">
<fileset dir="${cljsrc}"
Expand All @@ -185,44 +195,41 @@
<copy file="${src_jar}" tofile="${src_noversion_jar}" />
</target>

<target name="jar" depends="clojure"/>

<target name="all" depends="clojure,clojure-slim,clojure-sources"/>
<target name="all" depends="clojure-jar,clojure-jar-slim,clojure-jar-sources"/>

<target name="clean"
description="Remove autogenerated files and directories.">
<delete dir="${build}"/>
<delete dir="${test-classes}"/>
<delete dir="${dist}"/>
<delete file="pom.xml"/>
</target>

<target name="distclean" depends="clean"
description="Remove all generated files, including JARs.">
<delete verbose="true">
<fileset dir="${basedir}" includes="*.jar"/>
<fileset dir="${basedir}" includes="*.zip"/>
</delete>
</target>

<target name="-setup-maven">
<target name="setup-maven">
<typedef resource="org/apache/maven/artifact/ant/antlib.xml" uri="urn:maven-artifact-ant"/>
</target>

<macrodef name="deploy">
<attribute name="target-dir" description="Root of Maven repository"/>
<target name="deploy" depends="ci-build,dist" description="Build and deploy to remote stable repository.">
<sequential>
<typedef resource="org/apache/maven/artifact/ant/antlib.xml" uri="urn:maven-artifact-ant"/>
<mvn:install-provider artifactId="wagon-ssh" version="1.0-beta-2"/>
<echo message="Deploying to ${deployment.url}"/>
<mvn:deploy file="${clojure_jar}">
<pom file="pom.xml"/>
<attach file="${src_jar}" classifier="sources"/>
<attach file="${slim_jar}" classifier="slim"/>
<remoteRepository url="file:@{target-dir}"/>
<remoteRepository url="${deployment.url}">
<authentication username="root" privateKey="${user.home}/.ssh/id_rsa"/>
</remoteRepository>
</mvn:deploy>
</sequential>
</macrodef>
</target>

<target name="ci-build" depends="clean,all,-setup-maven"
<target name="ci-build" depends="clean,all,setup-maven"
description="Continous integration build, installed to local repository.">
<mvn:install file="${clojure_jar}">
<pom file="pom.xml"/>
Expand All @@ -241,7 +248,7 @@
<deploy target-dir="${stable.repo.dir}"/>
</target>

<target name="dist" depends="distclean,jar"
<target name="dist" depends="clean,clojure-jar"
description="Build distribution ZIP file">
<property name="distdir" value="${dist}/clojure-${clojure.version.label}"/>
<mkdir dir="${distdir}"/>
Expand Down
37 changes: 37 additions & 0 deletions release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#!/bin/bash

if [ -z $3 ]; then
echo 'Usage:
(checkout onto correct branch)
(edit changes.txt)
(optional: set CLOJURE_DEPLOY_URL for nonstandard location)
release.sh <major> <minor> <incremental> (qualifier)'
exit 0
fi

MAJOR_VERSION=$1
MINOR_VERSION=$2
INCREMENTAL_VERSION=$3
QUALIFIER=$4

echo "clojure.version.major=$MAJOR_VERSION
clojure.version.minor=$MINOR_VERSION
clojure.version.incremental=$INCREMENTAL_VERSION
clojure.version.qualifier=$QUALIFIER
clojure.version.interim=false" >src/clj/clojure/version.properties

if [ -z $QUALIFIER ]; then
VERSION="$MAJOR_VERSION.$MINOR_VERSION.$INCREMENTAL_VERSION"
else
VERSION="$MAJOR_VERSION.$MINOR_VERSION.$INCREMENTAL_VERSION-$QUALIFIER"
fi

git commit -a -m "[Automated release] Clojure $VERSION"
git tag -a -m "$VERSION" $VERSION

if [ -z $CLOJURE_DEPLOY_URL ]; then
CLOJURE_DEPLOY_URL=scp://build.clojure.org/srv/www/releases
fi
ant deploy -Ddeployment.url=$CLOJURE_DEPLOY_URL

echo "Build is complete. git push if you are satisfied with the result."

0 comments on commit 2b133f8

Please sign in to comment.