This page is no longer maintained — Please continue to the home page at www.scala-lang.org

Scala and ProGuard

8 replies
Mason Green
Joined: 2009-06-07,
User offline. Last seen 42 years 45 weeks ago.
Has anyone had success with ProGuard? I have a small Scala application, and the executable jar is almost 5MB!
michaelg
Joined: 2009-06-11,
User offline. Last seen 1 year 23 weeks ago.
Re: Scala and ProGuard
Yes, it works well with Scala. I have used it for Android applications written in Scala.
-- Michael
On Fri, Sep 18, 2009 at 8:29 PM, Mason Green <mason [dot] green [at] gmail [dot] com> wrote:
Has anyone had success with ProGuard? I have a small Scala application, and the executable jar is almost 5MB!

Rob Dickens
Joined: 2008-12-20,
User offline. Last seen 42 years 45 weeks ago.
Re: Scala and ProGuard
If you're into Maven, have a go with http://lafros.com/maven/plugins/proguard

2009/9/19 Mason Green <mason [dot] green [at] gmail [dot] com>
Has anyone had success with ProGuard? I have a small Scala application, and the executable jar is almost 5MB!



--
Rob, Lafros.com
Tim Perrett 2
Joined: 2009-04-06,
User offline. Last seen 42 years 45 weeks ago.
Re: Scala and ProGuard

If you look through the archives there is a good thread that discusses
this in relation to building applets with Scala.

Cheers, Tim

On Sat, Sep 19, 2009 at 4:29 AM, Mason Green wrote:
> Has anyone had success with ProGuard? I have a small Scala application, and
> the executable jar is almost 5MB!
>

Mason Green
Joined: 2009-06-07,
User offline. Last seen 42 years 45 weeks ago.
Re: Scala and ProGuard
Hi,

I've tried adding the fix outlined here, although I'm still having issues. Attached are the Scala specific warning messages I get with ProGuard 4.5.1 beta, and Scala 2.7.5 library. I've also attached  the error log I get when I run the output jar, after ignoring all warnings, and my Proguard configuration file.

If anyone can spare the time I would definitely appreciate the help.  Scala is my favorite language, but efficiently distributing applications without the giant executable jar is a big issue!

I think it would be a big help to the community if someone could create a small tutorial for tips on Scala w/ ProGuard!

Many thanks,
Mason

On Sat, Sep 19, 2009 at 4:45 AM, Tim Perrett <tperrett [at] googlemail [dot] com> wrote:
If you look through the archives there is a good thread that discusses
this in relation to building applets with Scala.

Cheers, Tim

On Sat, Sep 19, 2009 at 4:29 AM, Mason Green <mason [dot] green [at] gmail [dot] com> wrote:
> Has anyone had success with ProGuard? I have a small Scala application, and
> the executable jar is almost 5MB!
>

Mason Green
Joined: 2009-06-07,
User offline. Last seen 42 years 45 weeks ago.
Re: Scala and ProGuard
Would you be willing to share your ProGuard configuration file, or write a tutorial?

Thanks,
Mason

On Sat, Sep 19, 2009 at 12:47 AM, Michael Galpin <mike.sr@gmail.com> wrote:
Yes, it works well with Scala. I have used it for Android applications written in Scala.
-- Michael
On Fri, Sep 18, 2009 at 8:29 PM, Mason Green <mason [dot] green [at] gmail [dot] com> wrote:
Has anyone had success with ProGuard? I have a small Scala application, and the executable jar is almost 5MB!


Johannes Rudolph
Joined: 2008-12-17,
User offline. Last seen 29 weeks 19 hours ago.
Re: Scala and ProGuard

I used the patched proguard.jar and this file:

-injars bin:/home/johannes/download/scala-2.7.3.final/lib/scala-library.jar
-outjars out.jar
-libraryjars /home/johannes/download/andriod/android-sdk-linux_x86-1.1_r1/android.jar
-dontobfuscate
-dontoptimize
-keepclasseswithmembers class * extends android.app.Activity
-keepclasseswithmembers class scala.ScalaObject

Perhaps it may help you. It's some time ago, since I used it, so I'm
not sure if it still works...

Johannes

On Sat, Sep 19, 2009 at 4:37 PM, Mason Green wrote:
> Would you be willing to share your ProGuard configuration file, or write a
> tutorial?
>
> Thanks,
> Mason
>
> On Sat, Sep 19, 2009 at 12:47 AM, Michael Galpin wrote:
>>
>> Yes, it works well with Scala. I have used it for Android applications
>> written in Scala.

michaelg
Joined: 2009-06-11,
User offline. Last seen 1 year 23 weeks ago.
Re: Scala and ProGuard
For Android usage, I used this: http://chneukirchen.org/blog/archive/2009/04/programming-for-android-with-scala.html. The Ant task listed no longer works with the Android 1.5, so I have done this manually instead. Here is another, more recent example that I haven't tried: http://codingnaked.wordpress.com/2009/08/07/setting-up-maven-for-scala-and-proguard/.
-- Michael

On Sat, Sep 19, 2009 at 7:37 AM, Mason Green <mason [dot] green [at] gmail [dot] com> wrote:
Would you be willing to share your ProGuard configuration file, or write a tutorial?

Thanks,
Mason

On Sat, Sep 19, 2009 at 12:47 AM, Michael Galpin <mike.sr@gmail.com> wrote:
Yes, it works well with Scala. I have used it for Android applications written in Scala.
-- Michael
On Fri, Sep 18, 2009 at 8:29 PM, Mason Green <mason [dot] green [at] gmail [dot] com> wrote:
Has anyone had success with ProGuard? I have a small Scala application, and the executable jar is almost 5MB!



tolsen77
Joined: 2008-10-08,
User offline. Last seen 1 year 38 weeks ago.
Re: Scala and ProGuard
I'm including my proguard file I used for my applet. I've stopped using ProGuard and is using Pak200 compression instead which brings the library.jar down to 1.2mb. It is automated with applets so I'm not sure how to use it with ordinary applications. As Johannes Rudolph uses in his proguard file I see you're missing the ScalaObject class in the ProGuard file.


-injars  build\lib-prepared\project.jar
-outjars build\lib\project.jar

-injars  build\lib-prepared\scala-library.jar
-outjars build\lib\scala-library.jar

-dontobfuscate
-dontoptimize
-dontpreverify
-dontnote
-dontwarn
-ignorewarnings
-keepattributes

-keep class scala.ScalaObject {
    public protected *;
}


On Sat, Sep 19, 2009 at 4:35 PM, Mason Green <mason [dot] green [at] gmail [dot] com> wrote:
Hi,

I've tried adding the fix outlined here, although I'm still having issues. Attached are the Scala specific warning messages I get with ProGuard 4.5.1 beta, and Scala 2.7.5 library. I've also attached  the error log I get when I run the output jar, after ignoring all warnings, and my Proguard configuration file.

If anyone can spare the time I would definitely appreciate the help.  Scala is my favorite language, but efficiently distributing applications without the giant executable jar is a big issue!

I think it would be a big help to the community if someone could create a small tutorial for tips on Scala w/ ProGuard!

Many thanks,
Mason

On Sat, Sep 19, 2009 at 4:45 AM, Tim Perrett <tperrett [at] googlemail [dot] com> wrote:
If you look through the archives there is a good thread that discusses
this in relation to building applets with Scala.

Cheers, Tim

On Sat, Sep 19, 2009 at 4:29 AM, Mason Green <mason [dot] green [at] gmail [dot] com> wrote:
> Has anyone had success with ProGuard? I have a small Scala application, and
> the executable jar is almost 5MB!
>


Copyright © 2012 École Polytechnique Fédérale de Lausanne (EPFL), Lausanne, Switzerland