Skip to content

Producing an alternate NetLogoLite.jar

Seth Tisue edited this page Dec 11, 2013 · 3 revisions

The NW extension is written in Scala. When producing NetLogoLite.jar (a smaller version of NetLogo.jar to be used by applets), the ProGuard utility strips away classes from the Scala standard library that are not used by NetLogo itself. It has no way, however, to know which classes are needed by the NW extension.

As it turns, the NW extension needs some stuff that is not normally kept in NetLogoLite.jar (see https://github.com/NetLogo/NW-Extension/issues/54).

It is possible to tell ProGuard to keep more stuff in NetLogoLite.jar by editing https://github.com/NetLogo/NetLogo/blob/5.0.x/project/proguard/lite.txt.

Finding out what extra stuff needs to be kept for the NW extension is mostly done by a process trial and error, and verification of correctness is hard. It is currently done by building an applet from https://github.com/NetLogo/NW-Extension/blob/master/test/applet-test.nlogo and making sure that it runs correctly.

The extra stuff makes NetLogoLite.jar about 1MB larger. When the issue first arose, it was decided that such an increase was inappropriate for the main NetLogo distribution, and that an alternate NetLogoLite.jar should be shipped with the extension. This is why the extension includes an alternate lite.txt: https://github.com/NetLogo/NW-Extension/blob/master/proguard/lite.txt. To produces the alternate NetLogoLite.jar, the regular 5.0.x lite.txt should be temporarily overwritten with this file, sbt package should be run for the NetLogo project, and the NetLogoLite.jar thereby produced should be copied to the extension's alternate-netlogolite directory, where the build script will get it to package it in nw.zip.

Keeping an alternate NetLogoLite.jar will not be ideal in terms of usability, if/when we package the NW extension with NetLogo itself.

As far as I can tell, there are two easy ways to simplify things:

  • Bite the bullet and add what's needed to lite.txt in 5.0.x, thereby shipping a slightly bigger NetLogoLite.jar for everyone.
  • Renounce applet support for the NW extension.

If neither of those are options are retained, the alternate NetLogoLite.jar will have to be either distributed with NetLogo itself or made available for download somewhere. If it is distributed with NetLogo, it would be conceivable to modify the applet saver to include the alternate jar instead of the regular one when a model using the nw extension is saved as an applet.

Clone this wiki locally