I have used proguard to obfuscate clojure in the past.  I've not had a
chance to attempt to duplicate your specific case, but I do seem to
remember that proguard did not appreciate working with classes in the
default package (which is where both public and magic are in your
example).

Additionally, your main method won't be available -- you do not have
a :gen-class specification in public's ns form, and the main fn should
be named '-main'.  Doing those things will allow you to simplify your
proguard obfuscation spec so that it simply keeps all classes with a
main method:

http://proguard.sourceforge.net/manual/examples.html#applications

- Chas

On May 11, 2:09 pm, Andreas Franke <a.f.r.a.n....@gmx.de> wrote:
> Hello!
>
> Since I'm new to this group, let me say that
> recently I got interested in clojure, coming from
> Mozart/Oz, Common Lisp, and scheme.
> And I like it. A lot, in fact.:)
>
> Now... does anyone know whether ProGuard works
> with clojure? (I'm using proguard4.4beta2 with
> clojure 1.0.0.RC1.)
>
> In the following simple example:
>
> ===== public.clj:
> (ns public
>   (:use magic))
>
> (defn main []
>   (println (magic/get-the-answer)))
>
> ===== magic.clj:
> (ns magic)
>
> (defn get-the-answer []
>   42)
> =====
>
> which compiles to four .class files:
>   magic$get_the_answer__4.class
>   magic__init.class
>   public$main__7.class
>   public__init.class
>
> I'd like to keep public/main, but have
> magic/get-the-answer renamed.
>
> If I try to specify that e.g. with
>   -keep class public__init {<methods>;}
>   -keep class public$main__7 {<methods>;}
> then for some reason the magic-related
> classes are thrown away by ProGuard.
>
> If I prevent this with
>   -dontshrink
> then clojure complains about (load "public")
> with an ExceptionInInitializerError  [Thrown class
> clojure.lang.Compiler$CompilerException],
> whereas (load "public") works fine on the
> original .class files.
>
> Am I missing something?  Or is this a problem
> in ProGuard or in clojure?  Is there a workaround?
>
> Cheers,
> Andreas
--~--~---------~--~----~------------~-------~--~----~
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 
clojure+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to