Jimmy Schementi
2009-Jul-21 09:13 UTC
[Ironruby-core] [Code Review] Beginnings of "XAP-less" Silverlight application support
(This already went out to the IronPython mailing list, but for some reason it didn''t get out to the IronRuby list ...) http://github.com/jschementi/ironruby/commit/da6b54e226adfd3a18d8ad98d618c2350ebd8351 Beginnings of "XAP-less" Silverlight application support. Adds a "downloadScripts" initParam to indicate whether paths to script files and XAML files should be resolved to the web-server (relative to the XAP), if the file is not found in the XAP. Also adds "downloadScriptsFrom" to customize what path they are based off of. Files are downloaded synchronously as code runs, by having the PlatformAdaptationLayer use a new BrowserVirtualFilesystem: HttpVirtualFilesystem. So when a language''s include mechanism is used (require, load, import, etc), it will download the file by using XmlHttpRequest in synchronous mode. It will also cache each downloaded file''s contents, so a file will only be downloaded once, even if it is included multiple times. Note: this change decreases the need for Chiron significantly. In this mode, Chiron only creates a XAP file with the necessary assemblies and AppManifest.xaml, if it doesn''t exist already. One could imagine providing a XAP file for each language, and then Chiron wouldn''t be needed for development. However, for using the latest language assemblies, and auto-detection of languages used, it''s still useful. So some changes have been made to Chiron to support this better: A "localApplicationRoot" appSetting has been added to Chiron to adjust where it looks for script files (when determining what languages are used). This allows you to make sure Chiron is looking in the same place your application is downloading scripts or xaml from, so it can still generate a correct XAP file for you. "application/ruby" and "application/python" mime-types have been also added to Chrion also to enable downloading of those script files. All appSettings are now overridable as command-line switches: /u[rlPrefix], /e[xtUrlPrefix], /l[ocalAppRoot] See Merlin/Main/Hosts/SilverLight/Tests/tests/manual/test_foox for an example of how this works. Adds a stub for similar support through IsolatedStorage, but that will come later. Also tweaks the DynamicEngine.CreateRuntimeSetup method to better support other DLR-hosts in Silverlight.