andreasgal/j2me.js — pull request #784 by mykmelez (2014-12-24 00:08:07+00:00)
Title: reflect download JAD into SuiteProperties

Some midlets need the properties of their JAD to be reflected into SuiteProperties, which the main script does by setting *MIDP.manifest* properties for *SuiteProperties.load*. But the *downloadJAD* parameter doesn't get saved locally, and it isn't reflected into SuiteProperties, so builds that use that parameter can fail.

Here's a first take at a fix. It's bigger than necessary, since I made a bunch of changes to narrow down the problem, not all of which are strictly necessary. In particular, this makes the JAR files load sequentially rather than in parallel, which could be a good thing (unclear if it matters, but it could affect class overrides).

I also changed the name of the downloaded JAR to *midlet.jar*, which will force a re-download (in the process re-downloading and saving the JAD file). In theory, it'd be better to check for local copies of the JAR and JAD files separately, and download each one if we don't yet have it.