Skip to content

Resaving Models in the Newest Release

Connor Bain edited this page Jan 15, 2021 · 4 revisions

Note: if you'd like to use the Models Resaver, you need to be working on the models module of the larger NetLogo/NetLogo repo. To do that, follow the below:

$ git clone -b hexy https://github.com/NetLogo/NetLogo.git NetLogo
$ cd NetLogo

This will put the NetLogo code in the NetLogo directory. In the steps that follow, you will have to run some commands from the nl directory and other commands from the models directory under it. To make clear which location you have to run them from, we will try to prefix commands with either a nl$ or a nl/models$ prompt.

Don't forget the -b hexy part of the git clone command. This will tell git to get the hexy branch

At this point, your models directory will be created, but empty. To download the content from the models repo, do:

nl$ git submodule update --init

This will initialize and update all the NetLogo submodules, including the models library but also the bundled extensions, Behviorsearch, and the Mathematica-Link.

At this point, you should try to build NetLogo:

nl$ ./sbt all

Hopefully, all will go well. If it doesn't, talk visit the Building NetLogo wiki page.

Resave models in the library with the latest NetLogo version

This step requires that the NetLogo version you just cloned be identified as the version we are about to release, not as the previous one. You can check that by running NetLogo (nl$ ./sbt run) and looking at the About item in the Help menu or by running:

nl$ head -1 resources/system/version.txt

If the version number is not updated yet, ask someone from the dev team.

The original motivation for this step was that the version number saved in the model file appears on the Modeling Commons website and it looked weird to have most model from the NetLogo Model Library appear to have been saved with various older earlier versions of NetLogo.

This step is handled by a ModelResaver object in the org.nlogo.tools package. To run it, fire up sbt:

nl$ ./sbt

This will take you to the sbt command prompt, indicated by a >. Now run the ModelResaver:

> netlogo/test:runMain org.nlogo.tools.ModelResaver

It opens and saves all models in the library, excluding 3D models. To resave the 3D models, you will need to run it again separately, starting sbt with ./sbt -Dorg.nlogo.is3d=true.

It's possible that you see some error message during the process (e.g., "MIDI is not available") but those should not interfere with the process. If some models truly fail, you should get a list of FAILED MODELS: at the end.

Assuming the model repo was clean when you started (it should be), you can check what the script actually did to your model files by going back to the models repo and running:

nl/models$ git diff

If all looks well, just commit everything:

nl/models$ git add -A
nl/models$ git commit -m "update model version numbers"

Resaving all the models like that with require regenerating all the model checksums, which is the next step in the process anyway.

Clone this wiki locally