Navigation Menu

Skip to content

Commit

Permalink
compile str-utils2 and other build fixes, refs #22
Browse files Browse the repository at this point in the history
  • Loading branch information
stuarthalloway committed Sep 28, 2009
1 parent 39618b6 commit 04a2272
Show file tree
Hide file tree
Showing 6 changed files with 51 additions and 126 deletions.
115 changes: 36 additions & 79 deletions build.xml
Expand Up @@ -93,6 +93,41 @@
<target name="compile_clojure" depends="init,check_hasclojure,compile_classes"
description="Compile Clojure sources."
if="hasclojure">

<!-- Seek out the namespaces to compile. Note that this will fail if the actual name of a package includes an underscore, as
all underscores are converted to dashes. -->
<echo>Locating namespaces to compile ...</echo>

<pathconvert pathsep=" " property="compile.namespaces">
<fileset dir="${src}" includes="**/*.clj">
<!-- TODO: Seperate out the source into at least three root folders: one for namespaces with :gen-class, one for
ordinary namespaces (to be AOT compiled) and one for test namespaces (which, perhaps, should not be included
in the packaged JAR).
Complicated exclude rules like this are a bad design smell for the build.xml and/or project layout.
-->
<exclude name="**/*_test.clj" />
<exclude name="**/test_*/**" />
<exclude name="clojure/contrib/javadoc.clj" />
<exclude name="clojure/contrib/jmx/*.clj" />
<exclude name="**/pprint/**"/>
<exclude name="**/with_pull.clj" />
<exclude name="**/examples*/**" />
<exclude name="**/PersistentFnMap.clj" />
<exclude name="**/Condition.clj" />
<exclude name="**/Bean.clj" />
<exclude name="**/repl_utils/javadoc.clj"/>
<exclude name="clojure/contrib/load_all.clj"/>
<exclude name="**/tests.clj"/>
</fileset>
<chainedmapper>
<packagemapper from="${src}/*.clj" to="*" />
<filtermapper>
<replacestring from="_" to="-" />
</filtermapper>
</chainedmapper>
</pathconvert>

<echo>Compiling Clojure namespaces ...</echo>
<java classname="clojure.lang.Compile">
<classpath>
<path location="${build}"/>
Expand All @@ -101,85 +136,7 @@
</classpath>
<sysproperty key="clojure.compile.path" value="${build}"/>
<sysproperty key="java.awt.headless" value="true"/>
<arg value="clojure.contrib.accumulators"/>
<arg value="clojure.contrib.agent-utils"/>
<arg value="clojure.contrib.classpath"/>
<arg value="clojure.contrib.combinatorics"/>
<arg value="clojure.contrib.command-line"/>
<arg value="clojure.contrib.complex-numbers"/>
<arg value="clojure.contrib.cond"/>
<arg value="clojure.contrib.condition"/>
<arg value="clojure.contrib.core"/>
<arg value="clojure.contrib.dataflow"/>
<arg value="clojure.contrib.datalog"/>
<arg value="clojure.contrib.datalog.database"/>
<arg value="clojure.contrib.datalog.literals"/>
<arg value="clojure.contrib.datalog.magic"/>
<arg value="clojure.contrib.datalog.rules"/>
<arg value="clojure.contrib.datalog.softstrat"/>
<arg value="clojure.contrib.datalog.util"/>
<arg value="clojure.contrib.def"/>
<arg value="clojure.contrib.duck-streams"/>
<arg value="clojure.contrib.error-kit"/>
<arg value="clojure.contrib.except"/>
<arg value="clojure.contrib.mock"/>
<arg value="clojure.contrib.mock.test-adapter"/>
<arg value="clojure.contrib.fcase"/>
<arg value="clojure.contrib.find-namespaces"/>
<arg value="clojure.contrib.fnmap"/>
<arg value="clojure.contrib.gen-html-docs"/>
<arg value="clojure.contrib.generic"/>
<arg value="clojure.contrib.generic.arithmetic"/>
<arg value="clojure.contrib.generic.collection"/>
<arg value="clojure.contrib.generic.comparison"/>
<arg value="clojure.contrib.generic.functor"/>
<arg value="clojure.contrib.generic.math-functions"/>
<arg value="clojure.contrib.graph"/>
<arg value="clojure.contrib.greatest-least"/>
<arg value="clojure.contrib.import-static"/>
<arg value="clojure.contrib.jar"/>
<arg value="clojure.contrib.java-utils"/>
<arg value="clojure.contrib.javadoc.browse"/>
<arg value="clojure.contrib.javadoc.browse-ui"/>
<arg value="clojure.contrib.jmx"/>
<arg value="clojure.contrib.json.read"/>
<arg value="clojure.contrib.json.write"/>
<arg value="clojure.contrib.lazy-seqs"/>
<arg value="clojure.contrib.lazy-xml"/>
<arg value="clojure.contrib.macro-utils"/>
<arg value="clojure.contrib.macros"/>
<arg value="clojure.contrib.map-utils"/>
<arg value="clojure.contrib.math"/>
<arg value="clojure.contrib.miglayout"/>
<arg value="clojure.contrib.miglayout.internal"/>
<arg value="clojure.contrib.mmap"/>
<arg value="clojure.contrib.monads"/>
<arg value="clojure.contrib.ns-utils"/>
<arg value="clojure.contrib.pprint.ColumnWriter"/>
<arg value="clojure.contrib.pprint.PrettyWriter"/>
<arg value="clojure.contrib.pprint"/>
<arg value="clojure.contrib.pprint.utilities"/>
<arg value="clojure.contrib.probabilities.finite-distributions"/>
<arg value="clojure.contrib.probabilities.monte-carlo"/>
<arg value="clojure.contrib.probabilities.random-numbers"/>
<arg value="clojure.contrib.prxml"/>
<arg value="clojure.contrib.repl-ln"/>
<arg value="clojure.contrib.repl-utils"/>
<arg value="clojure.contrib.seq-utils"/>
<arg value="clojure.contrib.server-socket"/>
<arg value="clojure.contrib.set"/>
<arg value="clojure.contrib.shell-out"/>
<arg value="clojure.contrib.singleton"/>
<arg value="clojure.contrib.sql"/>
<arg value="clojure.contrib.sql.internal"/>
<arg value="clojure.contrib.str-utils"/>
<arg value="clojure.contrib.stream-utils"/>
<arg value="clojure.contrib.swing-utils"/>
<arg value="clojure.contrib.trace"/>
<arg value="clojure.contrib.types"/>
<arg value="clojure.contrib.with-ns"/>
<arg value="clojure.contrib.zip-filter"/>
<arg value="clojure.contrib.zip-filter.xml"/>
<arg line="${compile.namespaces}" />
</java>
</target>

Expand Down
2 changes: 1 addition & 1 deletion src/clojure/contrib/apply_macro.clj
Expand Up @@ -18,7 +18,7 @@
;; go blind.


(ns apply-macro)
(ns clojure.contrib.apply-macro)

;; Copied from clojure.core/spread, which is private.
(defn- spread
Expand Down
1 change: 0 additions & 1 deletion src/clojure/contrib/gen_html_docs.clj
Expand Up @@ -480,7 +480,6 @@ emits the generated HTML to the path named by path."
'clojure.contrib.command-line
'clojure.contrib.complex-numbers
'clojure.contrib.cond
'clojure.contrib.condt
'clojure.contrib.def
'clojure.contrib.duck-streams
'clojure.contrib.enum
Expand Down
35 changes: 1 addition & 34 deletions src/clojure/contrib/load_all.clj
Expand Up @@ -36,7 +36,6 @@ combinatorics
command-line
complex-numbers
cond
condt
def
duck-streams
error-kit
Expand Down Expand Up @@ -76,47 +75,15 @@ server-socket
set
shell-out
sql
stacktrace
str-utils
str-utils2
stream-utils
swing-utils
template
test-is
test-is.tests
test-clojure
test-clojure.agents
test-clojure.atoms
test-clojure.clojure-main
test-clojure.clojure-set
test-clojure.clojure-xml
test-clojure.clojure-zip
test-clojure.compilation
test-clojure.control
test-clojure.data-structures
test-clojure.evaluation
test-clojure.for
test-clojure.java-interop
test-clojure.logic
test-clojure.macros
test-clojure.metadata
test-clojure.multimethods
test-clojure.ns-libs
test-clojure.numbers
test-clojure.other-functions
test-clojure.parallel
test-clojure.predicates
test-clojure.printer
test-clojure.reader
test-clojure.refs
test-clojure.sequences
test-clojure.special
test-clojure.vars
test-contrib
test-contrib.shell-out
test-contrib.str-utils
trace
types
walk
zip-filter
])

Expand Down
18 changes: 9 additions & 9 deletions src/clojure/contrib/math/tests.clj
Expand Up @@ -3,7 +3,7 @@
clojure.contrib.math))

(deftest test-expt
(are (= _1 _2)
(are [x y] (= x y)
(expt 2 3) 8
(expt (expt 2 32) 2) (expt 2 64)
(expt 4/3 2) 16/9
Expand All @@ -13,7 +13,7 @@
(expt 5.3 4) (Math/pow 5.3 4)))

(deftest test-abs
(are (= _1 _2)
(are [x y] (= x y)
(abs -2) 2
(abs 0) 0
(abs 5) 5
Expand All @@ -27,7 +27,7 @@
(abs -2.8) 2.8))

(deftest test-gcd
(are (= _1 _2)
(are [x y] (= x y)
(gcd 4 3) 1
(gcd 24 12) 12
(gcd 24 27) 3
Expand All @@ -39,7 +39,7 @@
(is (thrown? IllegalArgumentException (gcd 7.0 0))))

(deftest test-lcm
(are (= _1 _2)
(are [x y] (= x y)
(lcm 2 3) 6
(lcm 3 2) 6
(lcm -2 3) 6
Expand All @@ -54,7 +54,7 @@
(is (thrown? IllegalArgumentException (lcm 7.0 0))))

(deftest test-floor
(are (= _1 _2)
(are [x y] (= x y)
(floor 6) 6
(floor -6) -6
(floor 123456789123456789) 123456789123456789
Expand All @@ -67,7 +67,7 @@
(floor -4.3) -5.0))

(deftest test-ceil
(are (= _1 _2)
(are [x y] (= x y)
(ceil 6) 6
(ceil -6) -6
(ceil 123456789123456789) 123456789123456789
Expand All @@ -80,7 +80,7 @@
(ceil -4.3) -4.0))

(deftest test-round
(are (= _1 _2)
(are [x y] (= x y)
(round 6) 6
(round -6) -6
(round 123456789123456789) 123456789123456789
Expand All @@ -105,14 +105,14 @@
(round -4.5) -4))

(deftest test-sqrt
(are (= _1 _2)
(are [x y] (= x y)
(sqrt 9) 3
(sqrt 16/9) 4/3
(sqrt 0.25M) 0.5M
(sqrt 2) (Math/sqrt 2)))

(deftest test-exact-integer-sqrt
(are (= _1 _2)
(are [x y] (= x y)
(exact-integer-sqrt 15) [3 6]
(exact-integer-sqrt (inc (expt 2 64))) [(expt 2 32) 1]
(exact-integer-sqrt 1000000000000) [1000000 0]))
6 changes: 4 additions & 2 deletions src/clojure/contrib/test_contrib.clj
Expand Up @@ -24,8 +24,10 @@
:seq-utils-test])

(def test-namespaces
(map #(symbol (str "clojure.contrib.test-contrib." (name %)))
test-names))
(concat
['clojure.contrib.math.tests 'clojure.contrib.core.tests]
(map #(symbol (str "clojure.contrib.test-contrib." (name %)))
test-names)))

(defn run
"Runs all defined tests"
Expand Down

0 comments on commit 04a2272

Please sign in to comment.