Hi Rich, Currently, 'ant jar' *always* AOT-compiles the clojure .clj files. This more than halves the clojure startup time, but at the expense of increasing the jar size from ~500k to ~1400k. Since AOT-compilation in general is designed to be optional, it makes sense to keep the ant build flexible and allow the AOT-compilation step to be optional too. I'm proposing a simple patch to build.xml to add a new target: ant jar_no_aot
which would skip the AOT-compilation task. The only current problem with that is that the 'clojure.main' class currently looked for by 'java -jar clojure.jar' would not be found. I propose handling this by starting instead with a very simple generic Main class which uses the standard RT.load() mechanism to load 'clojure.main' from .class file if available, otherwise falling back to the .clj file. One (incidental) nicety about this technique is that any existing, pre-built clojure jar could be 'slimmed down' (without need for the source files) by purely removing the AOT .class files, and would otherwise operate exactly the same (except for increased startup time). (I declare this all to be public domain if you'd like to incorporate any parts) Worthwhile idea? Thanks, Jon (snippets from the attached files) ---------[snip]------------ - <target name="compile_clojure" depends="compile_java" + <target name="compile_clojure" depends="compile_java" unless="no_compile_clojure" ---------[snip]------------ - <attribute name="Main-Class" value="clojure.main"/> + <attribute name="Main-Class" value="clojure.lang.Main"/> ---------[snip]------------ + <target name="jar_no_aot" + description="Create jar file (without pre-compiling .clj files)."> + <antcall target="jar"> + <param name="no_compile_clojure" value="" /> + </antcall> + </target> ---------[snip]------------ package clojure.lang; public class Main{ public static void main(String[] args) throws Exception{ RT.load("clojure/main"); Var main_main = RT.var("clojure.main", "-main"); main_main.applyTo(RT.seqFrom(args)); } } ---------[snip]------------ --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com 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 -~----------~----~----~----~------~----~------~--~---
build.xml.patch
Description: Binary data
package clojure.lang; public class Main{ public static void main(String[] args) throws Exception{ RT.load("clojure/main"); Var main_main = RT.var("clojure.main", "-main"); main_main.applyTo(RT.seqFrom(args)); } }