mozilla-b2g/gaia — pull request #3829 by ochameau (2012-08-25 17:46:02+00:00)
Title: Build webapp zip files in JS.

Move some more code from Makefile to JS.
Now the procces that builds webapp zips.

@vingtetun I tried to do my best to implement exactly same behavior,
but it was quite challenging as Makefile was cryptic!!

So please take some time to ensure that I've implemented expected behavior.
I can describe you what I'm doing in JS:
For each webapp from `GAIA_APP_SRCDIRS`, I put the zip file here: `profile/webapps/$(webapp-domain)/application.zip`. Then I'm adding all files (no ignore list?) from webapp folder into this zip.
Last but not least, shared files. That's the cryptic part of the Makefile.
So I'm reading all webapp's files (actually I filtered to js, css, html and htm files in order to avoid reading images files for nothing!) in order to look for shared file usages.
I'm using the following regexp: `/shared\/([^"'\s]+)("|')/g` to get a list of shared files to ship into the zip.
These files are written in `/shared/...`. For example, if the webapp use l10n.ls, it will be shipped in `/shared/js/l10n.js`.

/!\ This pull request will conflict with kaze's one - https://github.com/mozilla-b2g/gaia/pull/3706/files#L0R210
but it should be easy to implement his Makefile modification in JS.