roboscala / sbt-robovm

An sbt plugin for iOS development in Scala
BSD 2-Clause "Simplified" License
108 stars 16 forks source link

Executable size #64

Closed joprice closed 8 years ago

joprice commented 8 years ago

Running the 'hello' example gives me an executable of 76M. This doesn't give much room until apple's 100m wireless download limit. I turned on the aggressive treeShaker, but I got the exact same executable. Is the treeShaker not used when running the iphoneSim task?

4.0K    target/robovm.tmp/robo-vm-test.app/Info.plist
 60K    target/robovm.tmp/robo-vm-test.app/lib/boot/robovm-rt.jar
 60K    target/robovm.tmp/robo-vm-test.app/lib/boot
4.0K    target/robovm.tmp/robo-vm-test.app/lib/classes0.jar
 16K    target/robovm.tmp/robo-vm-test.app/lib/robovm-cocoatouch-1.13.0.jar
4.0K    target/robovm.tmp/robo-vm-test.app/lib/robovm-objc-1.13.0.jar
8.0K    target/robovm.tmp/robo-vm-test.app/lib/scala-library-2.11.7.jar
 92K    target/robovm.tmp/robo-vm-test.app/lib
 76M    target/robovm.tmp/robo-vm-test.app/robo-vm-test
 76M    target/robovm.tmp/robo-vm-test.app
Darkyenus commented 8 years ago

If you are running in 32bit mode (which is default IIRC), the tree shaker does not run "due to bug in linker", this is a RoboVM bug, you should find that in the logs. That, combined with heavy scala-library contributes to pretty big executables. You can always use proguard though.

joprice commented 8 years ago

That tip helped!

 robovmTarget64bit := true
4.0K    target/robovm.tmp/robo-vm-test.app/Info.plist
 60K    target/robovm.tmp/robo-vm-test.app/lib/boot/robovm-rt.jar
 60K    target/robovm.tmp/robo-vm-test.app/lib/boot
4.0K    target/robovm.tmp/robo-vm-test.app/lib/classes0.jar
 16K    target/robovm.tmp/robo-vm-test.app/lib/robovm-cocoatouch-1.13.0.jar
4.0K    target/robovm.tmp/robo-vm-test.app/lib/robovm-objc-1.13.0.jar
8.0K    target/robovm.tmp/robo-vm-test.app/lib/scala-library-2.11.7.jar
 92K    target/robovm.tmp/robo-vm-test.app/lib
 39M    target/robovm.tmp/robo-vm-test.app/robo-vm-test
 39M    target/robovm.tmp/robo-vm-test.app

Perhaps this should be mentioned in the readme?

joprice commented 8 years ago

Do you know of an example sbt-rovovm ios proguard project?

Darkyenus commented 8 years ago

I can't think of any, but it shouldn't be hard. Simply configure sbt-proguard plugin and plug it into the RoboVM plugin with something like:

robovmInputJars := (proguard in Proguard).value