Patch attached. This uses clojure.core/compile. But it still doesn't
work. I get the same error Stephen reported:
[java] java.lang.IllegalStateException: Var null/null is unbound.
(core.clj:21)
[java] at
org.apache.tools.ant.taskdefs.ExecuteJava.execute(ExecuteJava.java:194)
[java] at org.apache.tools.ant.taskdefs.Java.run(Java.java:747)
...
[java] Caused by: java.lang.IllegalStateException: Var null/null
is unbound. (core.clj:21)
[java] at clojure.lang.Compiler.analyzeSeq(Compiler.java:4067)
[java] at clojure.lang.Compiler.analyze(Compiler.java:3896)
...
[java] Caused by: java.lang.IllegalStateException: Var null/null
is unbound.
[java] at clojure.lang.Var.get(Var.java:129)
[java] at clojure.lang.Compiler$FnExpr.parse(Compiler.java:2947)
[java] at clojure.lang.Compiler.analyzeSeq(Compiler.java:4058)
[java] ... 42 more
[java] --- Nested Exception ---
[java] java.lang.IllegalStateException: Var null/null is unbound.
(core.clj:21)
[java] at clojure.lang.Compiler.analyzeSeq(Compiler.java:4067)
[java] at clojure.lang.Compiler.analyze(Compiler.java:3896)
...
[java] Caused by: java.lang.IllegalStateException: Var null/null
is unbound.
[java] at clojure.lang.Var.get(Var.java:129)
[java] at clojure.lang.Compiler$FnExpr.parse(Compiler.java:2947)
[java] at clojure.lang.Compiler.analyzeSeq(Compiler.java:4058)
[java] ... 42 more
-Stuart Sierra
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Clojure" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---
Index: src/clj/precompile.clj
===================================================================
--- src/clj/precompile.clj (revision 1106)
+++ src/clj/precompile.clj (working copy)
@@ -1,11 +0,0 @@
-;; This script is run by the Ant build task to precompile the core
-;; Clojure source files.
-
-(println "Compiling Clojure core sources...")
-
-(binding [*compile-path* (System/getProperty "clojure.compile.path")]
- (compile 'clojure.core)
- (compile 'clojure.set)
- (compile 'clojure.xml)
- (compile 'clojure.zip)
- (compile 'clojure.inspector))
Index: src/jvm/clojure/lang/CompileFiles.java
===================================================================
--- src/jvm/clojure/lang/CompileFiles.java (revision 0)
+++ src/jvm/clojure/lang/CompileFiles.java (revision 0)
@@ -0,0 +1,58 @@
+/**
+ * Copyright (c) Rich Hickey. All rights reserved.
+ * The use and distribution terms for this software are covered by the
+ * Common Public License 1.0 (http://opensource.org/licenses/cpl.php)
+ * which can be found in the file CPL.TXT 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.
+ **/
+
+package clojure.lang;
+
+import java.io.OutputStreamWriter;
+import java.io.PrintWriter;
+import java.io.IOException;
+import java.io.File;
+import java.io.Reader;
+import java.io.FileReader;
+import java.io.BufferedReader;
+import java.util.List;
+import java.util.Arrays;
+
+/** Static compiler for .clj files. All files given on the command
+ * line will be compiled and saved to the directory named in the Java
+ * system property "clojure.compile.path". That directory must also
+ * be on the classpath. */
+public class CompileFiles {
+
+ private static final String PATH_PROP = "clojure.compile.path";
+ private static final Var COMPILE = RT.var("clojure.core", "compile");
+ private static final IFn COMPILE_FN = COMPILE.fn();
+ private static final Var NS = RT.var("clojure.core", "*ns*");
+ static final Symbol USER = Symbol.create("user");
+ static final Symbol CLOJURE = Symbol.create("clojure.core");
+
+ static final Var in_ns = RT.var("clojure.core", "in-ns");
+ static final Var refer = RT.var("clojure.core", "refer");
+
+ public static void main(String[] args) throws Exception {
+ if (System.getProperty(PATH_PROP) == null) {
+ System.err.println("ERROR: Must set system property " + PATH_PROP +
+ "\nto the location for compiled .class files." +
+ "\nThis directory must also be on your CLASSPATH.");
+ System.exit(1);
+ }
+ Var.pushThreadBindings(RT.map(NS, NS.get(),
+ Compiler.COMPILE_FILES, RT.T,
+ Compiler.COMPILE_PATH, System.getProperty(PATH_PROP),
+ RT.WARN_ON_REFLECTION, RT.WARN_ON_REFLECTION.get()));
+ in_ns.invoke(USER);
+ refer.invoke(CLOJURE);
+ for (String lib : args) {
+ COMPILE_FN.invoke(Symbol.create(lib));
+ }
+ Var.popThreadBindings();
+ }
+}
+
Index: build.xml
===================================================================
--- build.xml (revision 1106)
+++ build.xml (working copy)
@@ -11,7 +11,6 @@
<property name="build" location="classes"/>
<property name="clojure_jar" location="clojure.jar"/>
<property name="bootclj" location="${cljsrc}/clojure/core.clj"/>
- <property name="precompile" location="${cljsrc}/precompile.clj"/>
<target name="init">
<tstamp/>
@@ -25,10 +24,14 @@
<target name="core" depends="compile"
description="Precompile Clojure core sources.">
- <java classname="clojure.lang.Script"
+ <java classname="clojure.lang.CompileFiles"
classpath="${build}:${cljsrc}">
<sysproperty key="clojure.compile.path" value="${build}"/>
- <arg value="${precompile}"/>
+ <arg value="clojure.core"/>
+ <arg value="clojure.set"/>
+ <arg value="clojure.xml"/>
+ <arg value="clojure.zip"/>
+ <arg value="clojure.inspector"/>
</java>
</target>