Thursday 18 October 2012

Creating an Offline-Version of O2

If you are going to use O2 in a location without a good network connection or if you have some corporate proxy that prevents the download of some of O2 external dependencies (that happen on first use/compile of some O2 Scripts), the best thing to do is to create an Offline Copy of O2

Note: You can download the latest version of the O2 Offline folder (created by the workflow described below) from here:  O2_Offline v4.3.zip

Here are the steps required to create an Offline copy of O2 Platform:

1) Download the latest version from http://tiny.cc/O2Platform


2) Copy the O2 Platform - Main O2 Gui v4.3.exe to a local folder:


At this stage there should only be one file in that folder

3) Open the O2 Platform 


After first run there will now be a couple extra folders (for example the O2.Platform.Scripts repository (embedded as a zip in the original exe) was unzipped into the O2.Platform.Scripts folder)


 3) Execute the 'Compile All Scripts' menu item (from Debug Menu) 


This is actually the 'Compile All Local O2 Scripts.h2' O2 script which will compile all current 700 scripts (in  O2.Platform.Scripts folder), and will have the (desired) side effect of downloading all dependencies (it will also create a cached version of the compiled scripts, making them start faster):


The main DataGridView will give you feedback on failed compilations, and if you also want to see the scripts that are compiling OK, tick the 'Show Ok' checkbox:


While the script is executing, if you look in the _ToolsOrApis folder, you will see a number of tools already downloaded:
\

And in the _ReferencesDownloaded you will see another set of dependencies:


The _ReferencesDownloaded  folder contains files downloaded directly from the O2_Platform_ReferencedAssemblies repository

The _ToolsOrApis folder contains files created by downloaded installers or MSI extractions (with the download happening from the tool creator's website)

The _EmbeddedAssemblies folder contains the assemblies that where embedded with the original 20Mb O2 download

4) Review compilation failures - to see if the script you want is in there


With the current 4.3 release there about 17 scripts that failed to compile. Some of these are due to the fact that they need to compiled with O2 running as a 32bit app (for example the Chrome ones).

For reference, the 'Compiler Mode #1' is the snippet compiler (for the *.h2 scripts) and the 'Compiler Mode #2' is the normal .Net compiler (for the *.cs files). This is why you will see some *.cs files with a green false mapping in the  'Compiler Mode #1 column and *.h2 files with a green false mapping on the  'Compiler Mode #2 column

4) Create a zip of the folder created and put in a place you can get it later (web or usb stick).

In this case I copied the  114Mb file to a public DropBox location:  O2_Offline v4.3.zip