diff options
-rw-r--r-- | build.xml | 73 | ||||
-rwxr-xr-x | release.sh | 37 |
2 files changed, 77 insertions, 33 deletions
@@ -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"/> @@ -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}"/> @@ -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"/> @@ -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}"> @@ -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/**"/> @@ -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}" @@ -185,9 +195,7 @@ <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."> @@ -195,34 +203,33 @@ <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"/> @@ -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}"/> diff --git a/release.sh b/release.sh new file mode 100755 index 00000000..bb0bc6fb --- /dev/null +++ b/release.sh @@ -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."
\ No newline at end of file |