Hey all,

I've been working on internal build tools where I work, and when looking 
into how other build tools like lein do their aot :all compilation, it 
seems that they all rely on some brittle namespace finder library, which 
searches either the classpath, or a folder of files and tries to identity 
all the ns declarations.

>From that, they call compile in a loop for every namespace they found. But, 
compile just goes ahead and converts the namespace into a resource path in 
a very brittle way, just replaces dots for forward slashes, and dashes by 
underscores. That's because, `load-one` is actually used to compile, which 
internally relies on `load`. Load takes a resource path which needs to be 
found on the classpath, not a namespace.

Now, there are some packages which have source files that have either a 
different ns name then their file name, or they use in-ns and are actually 
evaluating into an existing namespace defined in another file.

Lein actually fails to compile these, because the namespace it finds are 
looked up as resources on the classpath by compile and it can't find the 
resource, because the resource path does not match the namespace.

So, for my build tool aot :all compilation, I decided to instead use `load` 
with *compile-files* bound to true. And I just convert each source file in 
the source dir to a classpath resource path.

>From my perspective, this seems a better way to do it, that is more 
reliable, and frankly a lot simpler. But since no one else did it this way, 
I'm curious if there is any known issue with this approach?

Regards!

-- 
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
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to