Base, Sean,
Several of us are actively working on getting some of these issues
resolved.  I have a patch that I am finishing up testing on this week
that will allow libraries to specify externs, libs and foreign-libs
inside the library.  This should fix some of the upstream dependency
issues like the extern issue you described.  I haven't ran across
the :use issue but will try to reproduce.  I tend to use required so
that doesn't surprise me too much.  Depending on the version of
ClojureScript you are running, you may, or may not, be able to pull
externs and libs from the classpath.  Luke pushed my patch for this
into the main branch a couple of weeks ago.  If you do have the most
recent and still see an issue with externs not pulling from the
classpath let me know.  Its probably a bug in the code I added.

CK

On Feb 7, 1:11 pm, Sean Corfield <seancorfi...@gmail.com> wrote:
> On Tue, Feb 7, 2012 at 8:18 AM, Base <basselh...@gmail.com> wrote:
> > For the former, it is easy enough to just add the reference to the
> > project.clj and it automagically appears in the lib.
>
> > Does the same hold true for Clojurescript libraries?  I cannot seem to
> > get this to work correctly and end up dropping the files in the
> > directory defined in the :source-path in the project.clj.
>
> I just went thru this last night with Chris Granger's jayq wrapper for jQuery.
>
> I added a standard project.clj dependency on the library [jayq
> "0.1.0-SNAPSHOT"] and lein deps brought it in as expected.
>
> Things worked fine in :whitespace and :simple mode (:optimizations)
> but broke in :advanced mode. The reason was that externs (declarations
> of library names) was not picked up from the classpath (yet). The fix
> was to run:
>
> jar xf lib/jayq-*.jar externs
>
> in my project to extract the externs folder (containing the jquery.js
> declarations) into the top-level of my project. Forcing a recompile of
> the cljs then solved the problem.
>
> Another problem I ran into initially was not specifying :output-dir in
> the compilation options. The compiler caches the source cljs and
> compiled js and when I updated the jayq library (to pick up a fix from
> Chris - thank you!), the old source was still being used. Once I
> specified :output-dir I could see the problem and removing the
> generated files (or using lein cljsbuild clean) emptied that cache and
> forcing a recompile picked up the new source from the jayq JAR.
>
> Oh, and my first problem was that with multiple :use clauses for
> different cljs files in my ns declaration, the compiler seemed to get
> confused about which namespace symbols lived in so it would produce
> example.core.$.call(...) instead of jayq.core.$.call(...) or
> example.core.by_id(...) instead of example.util.by_id(...). I finally
> gave up on :use'ing multiple cljs code packages. I've had similar
> problems with :require but can't track down the specific situation
> that works vs fails (yet).
>
> Small problems but frustratingly hard to debug because a) the
> compilation produces giant JS files in non-advanced mode and
> incomprehensible JS files in advanced mode and b) the g-Closure
> compiler is a big black box so it's really hard to tell what's going
> on. I also (sometimes) got an HTTP request for /deps.js which no one
> on IRC seemed to be able to explain (so I just created an empty
> deps.js file to shut it up).
>
> ClojureScript is very promising - and I much prefer writing Clojure to
> writing JS - but as soon as you stray from a specific published
> example or from the simplest possible thing that works, you can get
> into a landmine-filled world of frustration at the moment. Things are
> improving rapidly tho'...
> --
> Sean A Corfield -- (904) 302-SEAN
> An Architect's View --http://corfield.org/
> World Singles, LLC. --http://worldsingles.com/
>
> "Perfection is the enemy of the good."
> -- Gustave Flaubert, French realist novelist (1821-1880)

-- 
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

Reply via email to