Commits

Meikel Brandmeyer committed cbd17d2

Rewrote build systems to use ant

Comments (0)

Files changed (12)

LICENSE

-Copyright 2008 (c) Meikel Brandmeyer.
-All rights reserved.
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
+Copyright 2008 (c) Meikel Brandmeyer.
+All rights reserved.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.

Makefile

-PROJECT := clojurecheck
-
-SRCDIR  := src
-DISTDIR := classes
-
-JAVASRC != cd ${SRCDIR} && find * -type f -name \*.java
-CLJSRC  != cd ${SRCDIR} && find * -type f -name \*.clj
-DIRS    != cd ${SRCDIR} && find * -type d
-
-VERSION != shtool version -d short version.txt
-JAR     := ${PROJECT}.jar
-TGZ     := ${PROJECT}-${VERSION}.tar.gz
-
-all: jar
-
-release: jar tarball
-
-jar: ${JAR}
-
-tarball: ${TGZ}
-
-test: jar
-	env CLASSPATH=${JAR}:$${CLASSPATH} prove t
-
-doc: compile
-	( cat README.txt.in; \
-	  env CLASSPATH=classes:$${CLASSPATH} java clojure.lang.Script gen-docs.clj ) > README.txt
-
-clean:
-	rm -rf ${DISTDIR} ${JAR} ${TGZ} README.txt
-
-compile: ${CLJSRC:C/^/src\//} ${DISTDIR}
-	env CLASSPATH=src:classes:$${CLASSPATH} java clojure.lang.Script compile.clj
-
-bump-version:
-	shtool version -l txt -n ${PROJECT} -i v version.txt
-
-bump-revision:
-	shtool version -l txt -n ${PROJECT} -i r version.txt
-
-bump-level:
-	shtool version -l txt -n ${PROJECT} -i l version.txt
-
-${JAR}: doc compile
-	cp README.txt ${DISTDIR}
-	cp LICENSE ${DISTDIR}
-	jar cf ${JAR} -C ${DISTDIR} .
-
-${TGZ}: doc
-	shtool tarball -c "gzip -9" -o ${TGZ} \
-		-e '\.DS_Store,${DISTDIR},\.jar,\.hg,\.tar\.gz' .
-
-${DISTDIR}:
-	shtool mkdir -p ${DISTDIR}
-	@for dir in ${DIRS}; do \
-		echo shtool mkdir -p ${DISTDIR}/$${dir}; \
-		shtool mkdir -p ${DISTDIR}/$${dir}; \
-	done
-
-.PHONY: all release jar tarball test doc clean compile
+            ___________________________________            ______
+            __  ____/__  /_____(_)_  ____/__  /_______________  /__
+            _  /    __  /_____  /_  /    __  __ \  _ \  ___/_  //_/
+            / /___  _  / ____  / / /___  _  / / /  __/ /__ _  ,<
+            \____/  /_/  ___  /  \____/  /_/ /_/\___/\___/ /_/|_|
+                         /___/
+
+An implementation of the Test Anything Protocol. It is a simple protocol to
+transfer information from tests to a harness, which in turn extracts the
+information in various ways. The protocol itself is also human readable. It's
+widely used in the Perl community.
+
+By using TAP one separates the framework of running the tests from the
+logic which displays the information of the test results. This could be
+a console runner like Perl's „prove“ utility or a graphical program or
+even a script controlling the automatic build process. The easy structure
+of TAP makes it easy to implement parsers for it.
+
+Meikel Brandmeyer <mb@kotka.de>
+Frankfurt am Main, 2008

README.txt.in

-            ___________________________________            ______
-            __  ____/__  /_____(_)_  ____/__  /_______________  /__
-            _  /    __  /_____  /_  /    __  __ \  _ \  ___/_  //_/
-            / /___  _  / ____  / / /___  _  / / /  __/ /__ _  ,<
-            \____/  /_/  ___  /  \____/  /_/ /_/\___/\___/ /_/|_|
-                         /___/
-
-An implementation of the Test Anything Protocol. It is a simple protocol to
-transfer information from tests to a harness, which in turn extracts the
-information in various ways. The protocol itself is also human readable. It's
-widely used in the Perl community.
-
-By using TAP one separates the framework of running the tests from the
-logic which displays the information of the test results. This could be
-a console runner like Perl's „prove“ utility or a graphical program or
-even a script controlling the automatic build process. The easy structure
-of TAP makes it easy to implement parsers for it.
-
-Meikel Brandmeyer <mb@kotka.de>
-Frankfurt am Main, 2008
-
-Reference Documentation in alphabetic order:
-
+<project name="clojurecheck" default="jar">
+
+	<description>
+		Build with "ant jar".
+	</description>
+
+	<property environment="env"/>
+
+	<property name="src" location="src"/>
+	<property name="build" location="classes"/>
+	<property name="clojurecheck_jar" location="clojurecheck.jar"/>
+	<property name="clojure.lib" location="${env.CLOJURE_LIB}"/>
+
+	<path id="clojurelib">
+		<fileset dir="${clojure.lib}" includes="**/*.jar"/>
+	</path>
+
+	<target name="init">
+		<tstamp/>
+		<mkdir dir="${build}"/>
+	</target>
+
+	<target name="aot" depends="init"
+		description="Compile Clojure sources.">
+		<java classname="clojure.lang.Compile">
+			<classpath>
+				<path location="${build}"/>
+				<path location="${src}"/>
+				<path refid="clojurelib"/>
+			</classpath>
+			<sysproperty key="clojure.compile.path"
+				value="${build}"/>
+			<arg value="de.kotka.clojurecheck.FatalTestError"/>
+			<arg value="de.kotka.clojurecheck"/>
+		</java>
+	</target>
+
+	<target name="jar" depends="aot"
+		description="Create jar file.">
+		<jar jarfile="${clojurecheck_jar}">
+			<path location="README.txt"/>
+			<path location="LICENSE.txt"/>
+			<fileset dir="${src}" includes="**/*.clj"/>
+			<!-- make sure we don't include any dependencies -->
+			<fileset dir="${build}" includes="de/kotka/**/*.class"/>
+			<manifest>
+				<attribute name="Class-Path" value="."/>
+			</manifest>
+		</jar>
+	</target>
+
+	<target name="clean"
+		description="Remove autogenerated files and directories.">
+		<delete dir="${build}"/>
+		<delete file="${clojurecheck_jar}"/>
+	</target>
+
+</project>

compile.clj

-;-
-; Copyright 2008 (c) Meikel Brandmeyer.
-; All rights reserved.
-;
-; Permission is hereby granted, free of charge, to any person obtaining a copy
-; of this software and associated documentation files (the "Software"), to deal
-; in the Software without restriction, including without limitation the rights
-; to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-; copies of the Software, and to permit persons to whom the Software is
-; furnished to do so, subject to the following conditions:
-;
-; The above copyright notice and this permission notice shall be included in
-; all copies or substantial portions of the Software.
-;
-; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-; IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-; FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-; AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-; LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-; OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-; THE SOFTWARE.
-
-(binding [*compile-path* "classes"]
-  (compile 'de.kotka.clojurecheck))

gen-class.clj

-;-
-; Copyright 2008 (c) Meikel Brandmeyer.
-; All rights reserved.
-;
-; Permission is hereby granted, free of charge, to any person obtaining a copy
-; of this software and associated documentation files (the "Software"), to deal
-; in the Software without restriction, including without limitation the rights
-; to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-; copies of the Software, and to permit persons to whom the Software is
-; furnished to do so, subject to the following conditions:
-;
-; The above copyright notice and this permission notice shall be included in
-; all copies or substantial portions of the Software.
-;
-; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-; IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-; FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-; AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-; LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-; OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-; THE SOFTWARE.
-
-(def *builddir* (first *command-line-args*))
-
-(doseq c (rest *command-line-args*)
-  (load-file (str "src/" c)))

gen-docs.clj

-;-
-; Copyright 2008 (c) Meikel Brandmeyer.
-; All rights reserved.
-;
-; Permission is hereby granted, free of charge, to any person obtaining a copy
-; of this software and associated documentation files (the "Software"), to deal
-; in the Software without restriction, including without limitation the rights
-; to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-; copies of the Software, and to permit persons to whom the Software is
-; furnished to do so, subject to the following conditions:
-;
-; The above copyright notice and this permission notice shall be included in
-; all copies or substantial portions of the Software.
-;
-; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-; IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-; FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-; AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-; LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-; OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-; THE SOFTWARE.
-
-(require 'de.kotka.clojurecheck)
-
-(let [c  (proxy [java.util.Comparator] []
-           (compare
-             [a b]
-             (let [as (str a)
-                   bs (str b)]
-               (. as compareTo bs))))
-      vs (map (fn [[n v]] v) (ns-publics (find-ns 'de.kotka.clojurecheck)))]
-  (doseq [v (sort c vs)]
-    (print-doc v)))

src/de/kotka/clojurecheck.clj

   (:use
      clojure.contrib.def
      clojure.contrib.gen-interface)
+  (:import
+     (de.kotka.clojurecheck FatalTestError))
   (:load
      "clojurecheck/directives"
      "clojurecheck/harness"

src/de/kotka/clojurecheck/FatalTestError.clj

+;-
+; Copyright 2008 (c) Meikel Brandmeyer.
+; All rights reserved.
+;
+; Permission is hereby granted, free of charge, to any person obtaining a copy
+; of this software and associated documentation files (the "Software"), to deal
+; in the Software without restriction, including without limitation the rights
+; to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+; copies of the Software, and to permit persons to whom the Software is
+; furnished to do so, subject to the following conditions:
+;
+; The above copyright notice and this permission notice shall be included in
+; all copies or substantial portions of the Software.
+;
+; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+; IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+; FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+; AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+; LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+; OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+; THE SOFTWARE.
+
+(clojure.core/ns de.kotka.clojurecheck.FatalTestError
+  (:gen-class
+     :extends Exception))

src/de/kotka/clojurecheck/directives.clj

   [t reason & body]
   `(skip-if* ~t ~reason (fn [] ~@body)))
 
-(when *compile-files*
-  (gen-and-save-class *compile-path* 'de.kotka.clojurecheck.FatalTestError
-    :extends Exception)
-  (gen-and-load-class 'de.kotka.clojurecheck.FatalTestError
-    :extends Exception))
-
-(import '(de.kotka.clojurecheck FatalTestError))
-
 (defvar- *fatal* false)
 
 (defn fatal*