On Jun 5, 1:33 am, Jason Smith <ja...@lilypepper.com> wrote: > The Java stubs are, ideally, a temporary thing. They don't need to be > around forever. However, I know of no way at present to generate them > automatically. > > Also, you are solving half the problem. Generating the stubs and > class files at the same time does not solve the compile-time > dependency problem. Consider: > > Clojure A references Java class B references Clojure class C > references Java class D. A, B, C, D are in a single project. > > You *must* run either gen-class or Javac first. Without some kind of > stubbing, the compile-time references are unknown, either way. Either > Java does not know about the Clojure gen-class classes that are to > come, or Clojure does not yet know about the Java classes in the > project. > > So, treating Java as the least-common-denominator, you run: > * gen-stubs > * Javac > * gen-class > > Since the stubs are around, you can also run JavaDoc. > > The stubs don't need to be saved. In the Maven world, they are part of > the build, not source files. > > On Jun 4, 8:03 am, ka <sancha...@gmail.com> wrote: > > > @Jason > > > I'm supplying a Java API (implemented in Clojure) so needed a solution > > quickly which just worked w/o me having to do special things. > > > Hence the gen-class+javadoc macro (http://gist.github.com/415269). > > But I feel there should be something like this available in contrib > > which handles the whole jing-bang of gen-class ! > > > Currently I'm using the strategy of generating .class files from gen- > > class, then generating java-stubs as required, running javadoc and > > just deleting the java-stubs (as they provide no value in their own). > > > Why do you think keeping the java-stubs is necessary? > > > - Thanks
Oh, now I understand fully your last post! I hadn't considered the cyclic dependencies situation, thanks for pointing that out. Though I can't see why right now; in future I might write some code (of mine) in Java to be used from Clojure (maybe performance). In that situation you are right we should - 1) Generate Java-stubs for Clojure gen-class, gen-interface. My macro is a half-assed attempt to generate stubs automatically using the gen-class args. One complexity is to choose return values if return type is primitive. 2) Run javac to compile all java sources properly. 3) Run gen-class to replace stubbed .class files by Clojure generated .class files. 4) Run javadoc to get the seamless documentation. I'm sure I'm not qualified enough to try to code this up, given that I haven't used maven or ant ever myself. But I'd like to give it a shot given some guidance. Do you think the right place for this is leiningen? - Thanks -- 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