Re: aot compilation: minimise the scope of the resulting classes

2012-05-22 Thread Philip Aston
On Tuesday, May 22, 2012 6:06:21 PM UTC+1, Hugo Duncan wrote:
>
> Phil Hagelberg writes: 
> > One solution is to call require at runtime inside function bodies 
> > rather than at the top-level. Then to call the functions from the 
> > runtime-required namespace, use the resolve function. 
>
> Another is to use :impl-ns option in genclass and implement the java class 
> in a separate 
> namespace (assuming you are using genclass). 
>
>
Thank you both for the rapid assistance.

- Phil

-- 
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
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: aot compilation: minimise the scope of the resulting classes

2012-05-22 Thread Hugo Duncan
Phil Hagelberg  writes:

> On Mon, May 21, 2012 at 10:56 AM, Philip Aston  wrote:
>> I'd like to compile the bare minimum, even if this means some sort of
>> thunk in Bootstrap. How can I do this?
>
> One solution is to call require at runtime inside function bodies
> rather than at the top-level. Then to call the functions from the
> runtime-required namespace, use the resolve function.

Another is to use :impl-ns option in genclass and implement the java class in a 
separate
namespace (assuming you are using genclass).

Hugo

-- 
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
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: aot compilation: minimise the scope of the resulting classes

2012-05-22 Thread Phil Hagelberg
On Mon, May 21, 2012 at 10:56 AM, Philip Aston  wrote:
> I'm using lein2 to aot compile a namespace than generates a Java
> "Bootstrap" class. Bootstrap implements an interface and delegates
> calls to other namespaces.
>
> For some reason, the resulting jar file includes compiled classes for
> the delegate namespaces, and many of their transitive dependencies.

This is a known bug in Clojure with a patch in Jira:
http://dev.clojure.org/jira/browse/CLJ-322

> I'd like to compile the bare minimum, even if this means some sort of
> thunk in Bootstrap. How can I do this?

One solution is to call require at runtime inside function bodies
rather than at the top-level. Then to call the functions from the
runtime-required namespace, use the resolve function.

-Phil

-- 
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
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


aot compilation: minimise the scope of the resulting classes

2012-05-22 Thread Philip Aston
I'm using lein2 to aot compile a namespace than generates a Java
"Bootstrap" class. Bootstrap implements an interface and delegates
calls to other namespaces.

For some reason, the resulting jar file includes compiled classes for
the delegate namespaces, and many of their transitive dependencies.

I tried to use jar-exclusions to remove the extra class files from the
jar, but the graph of generated Java class appears to link to them as
it fails at runtime with NoClassDefFoundExceptions.

I'd like to compile the bare minimum, even if this means some sort of
thunk in Bootstrap. How can I do this? 

Thanks for any pointers.

- Phil

-- 
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
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en