Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Build and deploy with Maven 2; CLJ-681

* Real pom.xml
* Simpler build.xml for local development with Ant
* No Clojure plugin; uses AntRun to build Clojure
* POM inheritance from Sonatype OSS deployment
* Build instructions in README
* Automatically builds "slim" and "sources" JARs as before
* 'distribution' profile generates a ZIP
* version.properties generated by the version in pom.xml
  * slightly different format
  * minor changes to clojure.core to handle version.properties
* Fix tests that assumed Ant as the test driver
* Tweaked run_tests.clj to work against current master
  • Loading branch information...
commit 16eef0b2259d3cc0aaa95e7d7b438aeec3cdb197 1 parent c567308
@stuartsierra stuartsierra authored stuarthalloway committed
View
8 .gitignore
@@ -1,9 +1,5 @@
-test-classes/*
-classes/*
-*jar
-pom.xml
+*.jar
+target
clojure.iws
clojure.ipr
nbproject/private/
-*.zip
-dist
View
203 build.xml
@@ -1,87 +1,35 @@
-<project name="clojure" default="all" xmlns:mvn="urn:maven-artifact-ant">
+<project name="clojure" default="all">
<description>
- Build with "ant jar" and then start the
+ Build with "ant" and then start the
REPL with: "java -cp clojure.jar clojure.main".
- You will need to install the Maven Ant
- Tasks to ${ant.home}/lib in order to execute
- the nightly-build or stable-build targets.
</description>
<property name="src" location="src"/>
<property name="test" location="test"/>
<property name="jsrc" location="${src}/jvm"/>
<property name="cljsrc" location="${src}/clj"/>
- <property name="build" location="classes"/>
- <property name="test-classes" location="test-classes"/>
+ <property name="cljscript" location="${src}/script"/>
+ <property name="test-script" location="${cljscript}/run_tests.clj"/>
+ <property name="compile-script" location="${cljscript}/bootstrap_compile.clj"/>
+ <property name="target" location="target"/>
+ <property name="build" location="${target}/classes"/>
+ <property name="test-classes" location="${target}/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" value="scp://build.clojure.org/srv/www/releases"/>
- <target name="debug">
- <echo message="${deployment.url}"/>
- </target>
-
- <!-- version related properties -->
- <property file="${cljsrc}/clojure/version.properties"/>
- <!-- ensures all version properties are present -->
- <fail unless="clojure.version.major"/>
- <fail unless="clojure.version.minor"/>
- <fail unless="clojure.version.interim"/>
+ <!-- Get the version string out of the POM -->
+ <xmlproperty file="pom.xml" prefix="pom"/>
+ <property name="clojure.version.label" value="${pom.project.version}"/>
+ <property name="version.properties" value="${build}/clojure/version.properties"/>
- <condition property="clojure.version.incremental.label"
- value=".${clojure.version.incremental}"
- else="">
- <length string="${clojure.version.incremental}" when="greater" length="0" />
- </condition>
- <condition property="clojure.version.qualifier.label"
- value="-${clojure.version.qualifier}"
- else="">
- <length string="${clojure.version.qualifier}" when="greater" length="0" />
- </condition>
- <condition property="clojure.version.interim.label"
- value="-SNAPSHOT"
- else="">
- <!-- We place -SNAPSHOT whenever interim is not set to false, not only
- if interim is set to true (this is less typo prone in the worst case -->
- <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}"/>
-
- <!-- general filterset for use when clojure version must be copied -->
- <filterset id="clojure-version-filterset">
- <filter token="clojure-version" value="${clojure.version.label}"/>
- </filterset>
-
- <property name="clojure_noversion_jar" location="clojure.jar"/>
- <property name="slim_noversion_jar" location="clojure-slim.jar"/>
- <property name="src_noversion_jar" location="clojure-sources.jar"/>
<property name="clojure_jar" location="clojure-${clojure.version.label}.jar"/>
- <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"/>
- <property name="stable.repo.dir" location="/var/www/maven-repository"/>
+ <property name="clojure_noversion_jar" location="clojure.jar"/>
<target name="init" depends="clean">
<tstamp/>
<mkdir dir="${build}"/>
- <antcall target="init-version"/>
- </target>
-
- <target name="init-version">
- <copy file="pom-template.xml"
- tofile="pom.xml">
- <filterset refid="clojure-version-filterset"/>
- </copy>
- <!--prevents users from modifying accidentally the generated pom.xml
- works only on linux.-->
- <chmod file="pom.xml" perm="ugo-w"/>
+ <mkdir dir="${build}/clojure"/>
+ <echo file="${version.properties}">version=${clojure.version.label}</echo>
</target>
<target name="compile-java" depends="init"
@@ -90,7 +38,7 @@
debug="true" target="1.5"/>
</target>
- <target name="compile-clojure" depends="compile-java"
+ <target name="compile-clojure"
description="Compile Clojure sources.">
<java classname="clojure.lang.Compile"
classpath="${build}:${cljsrc}"
@@ -124,17 +72,14 @@
</java>
</target>
- <target name="build"
- description="Build Clojure (compilation only, no tests)."
- depends="compile-java, compile-clojure"/>
-
<target name="compile-tests"
description="Compile the subset of tests that require compilation.">
<delete dir="${test-classes}"/>
<mkdir dir="${test-classes}"/>
<java classname="clojure.lang.Compile"
classpath="${test-classes}:${test}:${build}:${cljsrc}"
- failonerror="true">
+ failonerror="true"
+ fork="true">
<sysproperty key="clojure.compile.path" value="${test-classes}"/>
<arg value="clojure.test-clojure.protocols.examples"/>
<arg value="clojure.test-clojure.genclass.examples"/>
@@ -144,132 +89,44 @@
<target name="test"
description="Run clojure tests without recompiling clojure."
depends="compile-tests">
- <java classname="clojure.main" failonerror="true">
+ <java classname="clojure.main" failonerror="true" fork="true">
<classpath>
<path location="${test-classes}"/>
<path location="${test}"/>
<path location="${build}"/>
- <path location="${cljsrc}"/>
+ <path location="${cljsrc}"/>
</classpath>
- <arg value="-e"/>
- <arg value="(require '(clojure [test-clojure :as main])) (main/run-ant)"/>
+ <arg value="${test-script}"/>
</java>
</target>
- <target name="clojure-jar" depends="build"
+ <target name="build"
+ description="Build Clojure (compilation only, no tests)."
+ depends="compile-java, compile-clojure"/>
+
+ <target name="jar" depends="build"
description="Create clojure jar file.">
<jar jarfile="${clojure_jar}" basedir="${build}">
<fileset dir="${cljsrc}">
<include name="**/*.clj"/>
- <include name="clojure/version.properties"/>
- </fileset>
- <manifest>
- <attribute name="Main-Class" value="clojure.main"/>
- <attribute name="Class-Path" value="."/>
- </manifest>
- </jar>
- <copy file="${clojure_jar}" tofile="${clojure_noversion_jar}" />
- </target>
-
- <target name="clojure-jar-slim" depends="build"
- description="Create clojure-slim jar file (omits compiled Clojure code).">
- <jar jarfile="${slim_jar}">
- <fileset dir="${build}" includes="clojure/asm/**"/>
- <fileset dir="${build}" includes="clojure/lang/**"/>
- <fileset dir="${build}" includes="clojure/main.class"/>
- <fileset dir="${cljsrc}">
- <include name="**/*.clj"/>
- <include name="clojure/version.properties"/>
</fileset>
<manifest>
<attribute name="Main-Class" value="clojure.main"/>
<attribute name="Class-Path" value="."/>
</manifest>
</jar>
- <copy file="${slim_jar}" tofile="${slim_noversion_jar}" />
+ <copy file="${clojure_jar}" tofile="${clojure_noversion_jar}"/>
</target>
-
- <target name="clojure-jar-sources" depends="build"
- description="Create a JAR of Java sources.">
- <jar jarfile="${src_jar}" basedir="${jsrc}" includes="**/*">
- <fileset dir="${cljsrc}"
- includes="clojure/version.properties"/>
- </jar>
- <copy file="${src_jar}" tofile="${src_noversion_jar}" />
- </target>
-
- <target name="all" depends="build,test,clojure-jar,clojure-jar-slim,clojure-jar-sources"/>
+
+ <target name="all" depends="build,test,jar"/>
<target name="clean"
description="Remove autogenerated files and directories.">
- <delete dir="${build}"/>
- <delete dir="${test-classes}"/>
- <delete dir="${dist}"/>
- <delete file="pom.xml"/>
+ <delete dir="${target}"/>
<delete verbose="true">
<fileset dir="${basedir}" includes="*.jar"/>
<fileset dir="${basedir}" includes="*.zip"/>
</delete>
</target>
- <target name="setup-maven">
- <typedef resource="org/apache/maven/artifact/ant/antlib.xml" uri="urn:maven-artifact-ant"/>
- </target>
-
- <target name="nightly-build" depends="ci-build"
- description="Build and deploy to nightly (snapshot) repository.">
- <sequential>
- <typedef resource="org/apache/maven/artifact/ant/antlib.xml" uri="urn:maven-artifact-ant"/>
- <mvn:deploy file="${clojure_jar}">
- <pom file="pom.xml"/>
- <attach file="${src_jar}" classifier="sources"/>
- <attach file="${slim_jar}" classifier="slim"/>
- <remoteRepository url="file:${snapshot.repo.dir}"/>
- </mvn:deploy>
- </sequential>
- </target>
-
- <target name="release" 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="${deployment.url}">
- <authentication username="root" privateKey="${user.home}/.ssh/id_rsa"/>
- </remoteRepository>
- </mvn:deploy>
- </sequential>
- </target>
-
- <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"/>
- <attach file="${src_jar}" classifier="sources"/>
- <attach file="${slim_jar}" classifier="slim"/>
- </mvn:install>
- </target>
-
- <target name="dist" depends="clean,clojure-jar"
- description="Build distribution ZIP file.">
- <property name="distdir" value="${dist}/clojure-${clojure.version.label}"/>
- <mkdir dir="${distdir}"/>
- <copy todir="${distdir}" includeEmptyDirs="false">
- <fileset dir="${basedir}">
- <exclude name="pom.xml"/>
- <exclude name="**/.git/**"/>
- <exclude name="**/*.class"/>
- <exclude name="**/*.iml"/>
- <exclude name="**/*.ipr"/>
- <exclude name="**/*.iws"/>
- <exclude name="**/*.jar"/>
- </fileset>
- </copy>
- <copy file="${clojure_noversion_jar}" todir="${distdir}"/>
- <zip basedir="${dist}" destfile="clojure-${clojure.version.label}.zip"/>
- </target>
</project>
View
23 pom-template.xml
@@ -1,23 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0"
- xmlns:xsi="http//www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
- http://maven.apache.org/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <groupId>org.clojure</groupId>
- <artifactId>clojure</artifactId>
- <name>clojure</name>
- <version>@clojure-version@</version>
- <url>http://clojure.org/</url>
-
- <description>Clojure core environment and runtime library.</description>
-
- <licenses>
- <license>
- <name>Eclipse Public License 1.0</name>
- <url>http://opensource.org/licenses/eclipse-1.0.php</url>
- <distribution>repo</distribution>
- </license>
- </licenses>
-
-</project>
View
211 pom.xml
@@ -0,0 +1,211 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.clojure</groupId>
+ <artifactId>clojure</artifactId>
+ <name>clojure</name>
+ <packaging>jar</packaging>
+ <version>1.3.0-master-SNAPSHOT</version>
+
+ <url>http://clojure.org/</url>
+ <description>Clojure core environment and runtime library.</description>
+
+ <developers>
+ <developer>
+ <name>Rich Hickey</name>
+ <email>richhickey@gmail.com</email>
+ <timezone>-5</timezone>
+ </developer>
+ </developers>
+
+ <licenses>
+ <license>
+ <name>Eclipse Public License 1.0</name>
+ <url>http://opensource.org/licenses/eclipse-1.0.php</url>
+ <distribution>repo</distribution>
+ </license>
+ </licenses>
+
+ <parent>
+ <groupId>org.sonatype.oss</groupId>
+ <artifactId>oss-parent</artifactId>
+ <version>5</version>
+ </parent>
+
+ <scm>
+ <connection>scm:git:git@github.com:clojure/clojure.git</connection>
+ <developerConnection>scm:git:git@github.com:clojure/clojure.git</developerConnection>
+ <url>git@github.com:clojure/clojure.git</url>
+ </scm>
+
+ <build>
+ <resources>
+ <resource>
+ <directory>src/resources</directory>
+ <filtering>true</filtering>
+ </resource>
+ <resource>
+ <directory>src/clj</directory>
+ </resource>
+ </resources>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>2.3.2</version>
+ <configuration>
+ <source>1.5</source>
+ <target>1.5</target>
+ <encoding>${project.build.sourceEncoding}</encoding>
+ </configuration>
+ </plugin>
+ <plugin>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <version>1.6</version>
+ <executions>
+ <execution>
+ <id>clojure-compile</id>
+ <phase>compile</phase>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ <configuration>
+ <target>
+ <ant target="compile-clojure" />
+ </target>
+ </configuration>
+ </execution>
+ <execution>
+ <id>clojure-test</id>
+ <phase>compile</phase>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ <configuration>
+ <target>
+ <ant target="test" />
+ </target>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>build-helper-maven-plugin</artifactId>
+ <version>1.5</version>
+ <executions>
+ <execution>
+ <id>add-clojure-source-dirs</id>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>add-source</goal>
+ </goals>
+ <configuration>
+ <sources>
+ <source>src/jvm</source>
+ </sources>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <version>2.2</version>
+ <executions>
+ <execution>
+ <id>clojure-slim-jar</id>
+ <phase>package</phase>
+ <goals>
+ <goal>single</goal>
+ </goals>
+ <configuration>
+ <descriptors>
+ <descriptor>src/assembly/slim.xml</descriptor>
+ </descriptors>
+ <archive>
+ <manifest>
+ <mainClass>clojure.main</mainClass>
+ </manifest>
+ </archive>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <artifactId>maven-jar-plugin</artifactId>
+ <version>2.3.1</version>
+ <configuration>
+ <archive>
+ <manifest>
+ <mainClass>clojure.main</mainClass>
+ </manifest>
+ </archive>
+ </configuration>
+ </plugin>
+ <plugin>
+ <artifactId>maven-source-plugin</artifactId>
+ <version>2.1.2</version>
+ <executions>
+ <execution>
+ <id>sources-jar</id>
+ <phase>package</phase>
+ <goals>
+ <goal>jar</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <!-- do not push SCM changes to upstream repository;
+ prevents pushing tags/commits for failed releases;
+ instead, push SCM changes in Hudson configuration -->
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-release-plugin</artifactId>
+ <version>2.1</version>
+ <configuration>
+ <pushChanges>false</pushChanges>
+ <localCheckout>true</localCheckout>
+ </configuration>
+ </plugin>
+ <plugin>
+ <!-- disable the Surefire testing plugin -->
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <version>2.6</version>
+ <configuration>
+ <skip>true</skip>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+ <profiles>
+ <profile>
+ <!-- "mvn -Pdistribution package" builds a .zip file -->
+ <id>distribution</id>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <version>2.2</version>
+ <executions>
+ <execution>
+ <id>clojure-distribution</id>
+ <phase>package</phase>
+ <goals>
+ <goal>single</goal>
+ </goals>
+ <configuration>
+ <appendAssemblyId>false</appendAssemblyId>
+ <descriptors>
+ <descriptor>src/assembly/distribution.xml</descriptor>
+ </descriptors>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
+</project>
View
20 readme.txt
@@ -10,8 +10,24 @@
Docs: http://clojure.org
Feedback: http://groups.google.com/group/clojure
-To Run: java -cp clojure.jar clojure.main
-To Build: ant
+
+To run: java -cp clojure-${VERSION}.jar clojure.main
+
+To build locally with Ant: ant
+
+
+Maven 2 build instructions:
+
+ To build: mvn package
+ The built JARs will be in target/
+
+ To build without testing: mvn package -Dmaven.test.skip=true
+
+ To build and install in local Maven repository: mvn install
+
+ To build a ZIP distribution: mvn package -Pdistribution
+ The built .zip will be in target/
+
--------------------------------------------------------------------------
This program uses the ASM bytecode engineering library which is distributed
View
37 release.sh
@@ -1,37 +0,0 @@
-#!/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 release -Ddeployment.url=$CLOJURE_DEPLOY_URL
-
-echo "Build is complete. git push if you are satisfied with the result."
View
49 src/assembly/distribution.xml
@@ -0,0 +1,49 @@
+<assembly>
+ <id>distribution</id>
+ <formats>
+ <format>zip</format>
+ </formats>
+ <fileSets>
+ <fileSet>
+ <directory>src</directory>
+ <outputDirectory>src</outputDirectory>
+ </fileSet>
+ <fileSet>
+ <directory>doc</directory>
+ <outputDirectory>doc</outputDirectory>
+ </fileSet>
+ <fileSet>
+ <directory>test</directory>
+ <outputDirectory>test</outputDirectory>
+ </fileSet>
+ <fileSet>
+ <directory>target</directory>
+ <outputDirectory>/</outputDirectory>
+ <filtered>false</filtered>
+ <includes>
+ <include>*.jar</include>
+ </includes>
+ </fileSet>
+ </fileSets>
+ <files>
+ <file>
+ <source>pom.xml</source>
+ </file>
+ <file>
+ <source>build.xml</source>
+ </file>
+ <file>
+ <source>readme.txt</source>
+ <filtered>true</filtered>
+ </file>
+ <file>
+ <source>changes.txt</source>
+ </file>
+ <file>
+ <source>clojure.iml</source>
+ </file>
+ <file>
+ <source>epl-v10.html</source>
+ </file>
+ </files>
+</assembly>
View
32 src/assembly/slim.xml
@@ -0,0 +1,32 @@
+<assembly>
+ <id>slim</id>
+ <formats>
+ <format>jar</format>
+ </formats>
+ <includeBaseDirectory>false</includeBaseDirectory>
+ <fileSets>
+ <fileSet>
+ <directory>src/clj</directory>
+ <outputDirectory>/</outputDirectory>
+ </fileSet>
+ <fileSet>
+ <directory>src/resources</directory>
+ <outputDirectory>/</outputDirectory>
+ <filtered>true</filtered>
+ </fileSet>
+ <fileSet>
+ <directory>target/classes/clojure/asm</directory>
+ <outputDirectory>clojure/asm</outputDirectory>
+ </fileSet>
+ <fileSet>
+ <directory>target/classes/clojure/lang</directory>
+ <outputDirectory>clojure/lang</outputDirectory>
+ </fileSet>
+ </fileSets>
+ <files>
+ <file>
+ <source>target/classes/clojure/main.class</source>
+ <outputDirectory>clojure</outputDirectory>
+ </file>
+ </files>
+</assembly>
View
29 src/clj/clojure/core.clj
@@ -5908,18 +5908,23 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; clojure version number ;;;;;;;;;;;;;;;;;;;;;;
-(let [version-stream (.getResourceAsStream (clojure.lang.RT/baseLoader)
- "clojure/version.properties")
+(let [version-stream (.getResourceAsStream
+ (clojure.lang.RT/baseLoader)
+ "clojure/version.properties")
properties (doto (new java.util.Properties) (.load version-stream))
- prop (fn [k] (.getProperty properties (str "clojure.version." k)))
- clojure-version {:major (Integer/valueOf ^String (prop "major"))
- :minor (Integer/valueOf ^String (prop "minor"))
- :incremental (Integer/valueOf ^String (prop "incremental"))
- :qualifier (prop "qualifier")}]
- (def ^:dynamic *clojure-version*
- (if (not (= (prop "interim") "false"))
- (clojure.lang.RT/assoc clojure-version :interim true)
- clojure-version)))
+ version-string (.getProperty properties "version")
+ [_ major minor incremental qualifier snapshot]
+ (re-matches
+ #"(\d+)\.(\d+)\.(\d+)(?:-([a-zA-Z0-9_]+))?(?:-(SNAPSHOT))?"
+ version-string)
+ clojure-version {:major (Integer/valueOf ^String major)
+ :minor (Integer/valueOf ^String minor)
+ :incremental (Integer/valueOf ^String incremental)
+ :qualifier (if (= qualifier "SNAPSHOT") nil qualifier)}]
+ (def ^:dynamic *clojure-version*
+ (if (.contains version-string "SNAPSHOT")
+ (clojure.lang.RT/assoc clojure-version :interim true)
+ clojure-version)))
(add-doc-and-meta *clojure-version*
"The version info for Clojure core, as a map containing :major :minor
@@ -5941,7 +5946,7 @@
(when-let [q (:qualifier *clojure-version*)]
(when (pos? (count q)) (str "-" q)))
(when (:interim *clojure-version*)
- "-SNAPSHOT")))
+ "-SNAPSHOT")))
(defn promise
"Alpha - subject to change.
View
5 src/clj/clojure/version.properties
@@ -1,5 +0,0 @@
-clojure.version.major=1
-clojure.version.minor=3
-clojure.version.incremental=0
-clojure.version.qualifier=master
-clojure.version.interim=interim
View
1  src/resources/clojure/version.properties
@@ -0,0 +1 @@
+version=${version}
View
58 src/script/run_tests.clj
@@ -0,0 +1,58 @@
+(ns clojure.test-clojure (:require clojure.test))
+
+(def test-namespaces '[
+clojure.test-clojure.agents
+clojure.test-clojure.annotations
+clojure.test-clojure.atoms
+clojure.test-clojure.clojure-set
+clojure.test-clojure.clojure-walk
+clojure.test-clojure.clojure-xml
+clojure.test-clojure.clojure-zip
+clojure.test-clojure.compilation
+clojure.test-clojure.control
+clojure.test-clojure.data
+clojure.test-clojure.data-structures
+clojure.test-clojure.def
+clojure.test-clojure.errors
+clojure.test-clojure.evaluation
+clojure.test-clojure.for
+clojure.test-clojure.genclass.examples
+clojure.test-clojure.genclass
+clojure.test-clojure.java.io
+clojure.test-clojure.java.javadoc
+clojure.test-clojure.java.shell
+clojure.test-clojure.java-interop
+clojure.test-clojure.keywords
+clojure.test-clojure.logic
+clojure.test-clojure.macros
+clojure.test-clojure.main
+clojure.test-clojure.metadata
+clojure.test-clojure.multimethods
+clojure.test-clojure.ns-libs
+clojure.test-clojure.numbers
+clojure.test-clojure.other-functions
+clojure.test-clojure.parallel
+clojure.test-clojure.pprint
+clojure.test-clojure.predicates
+clojure.test-clojure.printer
+clojure.test-clojure.protocols
+clojure.test-clojure.reader
+clojure.test-clojure.reflect
+clojure.test-clojure.refs
+clojure.test-clojure.repl
+clojure.test-clojure.rt
+clojure.test-clojure.sequences
+clojure.test-clojure.serialization
+clojure.test-clojure.special
+clojure.test-clojure.string
+clojure.test-clojure.test
+clojure.test-clojure.test-fixtures
+clojure.test-clojure.transients
+clojure.test-clojure.vars
+clojure.test-clojure.vectors
+])
+
+(apply require test-namespaces)
+
+(let [results (apply clojure.test/run-tests test-namespaces)]
+ (System/exit (+ (:error results) (:fail results))))
View
104 test/clojure/test_clojure.clj
@@ -1,104 +0,0 @@
-; Copyright (c) Rich Hickey. All rights reserved.
-; The use and distribution terms for this software are covered by the
-; Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
-; which can be found in the file epl-v10.html at the root of this distribution.
-; By using this software in any fashion, you are agreeing to be bound by
-; the terms of this license.
-; You must not remove this notice, or any other, from this software.
-;
-
-;; clojure.test-clojure
-;;
-;; Tests for the facilities provided by Clojure
-;;
-;; scgilardi (gmail)
-;; Created 22 October 2008
-
-(ns clojure.test-clojure
- (:require [clojure.test :as t])
- (:gen-class))
-
-(def test-names
- [:reader
- :printer
- :compilation
- :evaluation
- :special
- :macros
- :metadata
- :ns-libs
- :logic
- :predicates
- :control
- :data-structures
- :numbers
- :sequences
- :for
- :multimethods
- :other-functions
- :vars
- :refs
- :agents
- :atoms
- :parallel
- :java-interop
- :test
- :test-fixtures
- ;; libraries
- :clojure-set
- :clojure-xml
- :clojure-zip
- :protocols
- :genclass
- :main
- :vectors
- :annotations
- :pprint
- :serialization
- :rt
- :repl
- :java.io
- :string
- :java.javadoc
- :java.shell
- :transients
- :def
- :keywords
- :data
- :reflect
- :errors
- :clojure-walk
- ])
-
-(def test-namespaces
- (map #(symbol (str "clojure.test-clojure." (name %)))
- test-names))
-
-(defn run
- "Runs all defined tests"
- []
- (println "Loading tests...")
- (apply require :reload-all test-namespaces)
- (apply t/run-tests test-namespaces))
-
-(defn run-ant
- "Runs all defined tests, prints report to *err*, throw if failures. This works well for running in an ant java task."
- []
- (let [rpt t/report]
- (binding [;; binding to *err* because, in ant, when the test target
- ;; runs after compile-clojure, *out* doesn't print anything
- *out* *err*
- t/*test-out* *err*
- t/report (fn report [m]
- (if (= :summary (:type m))
- (do (rpt m)
- (if (or (pos? (:fail m)) (pos? (:error m)))
- (throw (new Exception (str (:fail m) " failures, " (:error m) " errors.")))))
- (rpt m)))]
- (run))))
-
-(defn -main
- "Run all defined tests from the command line"
- [& args]
- (run)
- (System/exit 0))
View
2  test/clojure/test_clojure/protocols.clj
@@ -75,7 +75,7 @@
(eval '(defprotocol Elusive (old-method [x])))
(eval '(defprotocol Elusive (new-method [x])))
(is (= :new-method (eval '(new-method (reify Elusive (new-method [x] :new-method))))))
- (is (fails-with-cause? IllegalArgumentException #"No method of interface: user\.Elusive found for function: old-method of protocol: Elusive \(The protocol method may have been defined before and removed\.\)"
+ (is (fails-with-cause? IllegalArgumentException #"No method of interface: .*\.Elusive found for function: old-method of protocol: Elusive \(The protocol method may have been defined before and removed\.\)"
(eval '(old-method (reify Elusive (new-method [x] :new-method))))))))
(deftype ExtendTestWidget [name])
View
2  test/clojure/test_clojure/reader.clj
@@ -237,7 +237,7 @@
)
(deftest reading-keywords
- (are [x y] (= x (read-string y))
+ (are [x y] (= x (binding [*ns* (the-ns 'user)] (read-string y)))
:foo ":foo"
:foo/bar ":foo/bar"
:user/foo "::foo")
View
8 test/clojure/test_clojure/rt.clj
@@ -59,19 +59,19 @@
(defn prefers [] (throw (RuntimeException. "rebound!")))))
(testing "reflection cannot resolve field"
(should-print-err-message
- #"Reflection warning, NO_SOURCE_PATH:\d+ - reference to field blah can't be resolved\.\r?\n"
+ #"Reflection warning, .*:\d+ - reference to field blah can't be resolved\.\r?\n"
(defn foo [x] (.blah x))))
(testing "reflection cannot resolve instance method"
(should-print-err-message
- #"Reflection warning, NO_SOURCE_PATH:\d+ - call to zap can't be resolved\.\r?\n"
+ #"Reflection warning, .*:\d+ - call to zap can't be resolved\.\r?\n"
(defn foo [x] (.zap x 1))))
(testing "reflection cannot resolve static method"
(should-print-err-message
- #"Reflection warning, NO_SOURCE_PATH:\d+ - call to valueOf can't be resolved\.\r?\n"
+ #"Reflection warning, .*:\d+ - call to valueOf can't be resolved\.\r?\n"
(defn foo [] (Integer/valueOf #"boom"))))
(testing "reflection cannot resolve constructor"
(should-print-err-message
- #"Reflection warning, NO_SOURCE_PATH:\d+ - call to java.lang.String ctor can't be resolved\.\r?\n"
+ #"Reflection warning, .*:\d+ - call to java.lang.String ctor can't be resolved\.\r?\n"
(defn foo [] (String. 1 2 3)))))
(def example-var)
Please sign in to comment.
Something went wrong with that request. Please try again.