Skip to content
Fetching contributors…
Cannot retrieve contributors at this time
158 lines (110 sloc) 8.28 KB
# Using RhoSimulator
RhoSimulator allows to [run](#run-application-in-rhosimulator) Rhodes applications without lengthy build process and to [debug](#debugging-with-rhostudio) them in [RhoStudio](../rhostudio.tutorial). Currently RhoSimulator works on <b>Windows</b> only.
## Install RhoSimulator
If you have [Rhodes gem](/install#installing-rhodes-from-the-command-line), then RhoSimulator is installed already.
If you would like to run RhoSimulator without Rhodes gem, download [Windows](http://rhosimulator.s3.amazonaws.com/RhoSimulator.zip) or
[Mac OS X](http://rhosimulator.s3.amazonaws.com/RhoSimulator.tbz2) version, extract it and specify path to `rhosimulator.exe` or `RhoSimulator.app` respectively at `rhodes/rhobuild.yml`:
env:
paths:
rhosimulator: <RhoSimulator folder>
Alternatively you may [build](#build-rhosimulator) your own customized version of RhoSimulator as described [below](#build-rhosimulator).
## Run application in RhoSimulator
To run application in RhoSimulator just run in rhodes or application folder:
#run RhoSimulator to simulate specific platform:
rake run:android:rhosimulator
rake run:iphone:rhosimulator
#bbver from build.yml will be used as System.get_property('os_version')
rake run:bb:rhosimulator
rake run:wm:rhosimulator
rake run:wp:rhosimulator
#run RhoSimulator to simulate 'WINDOWS_DESKTOP' platform:
rake run:win32:rhosimulator
If you modified Rhodes application sources, just press 'Refresh' in RhoSimulator to reload application, i.e. generally no RhoSimulator restart is required.
The restart of RhoSimulator is required only if a model was added/modified or some code was added to the AppApplication class.
## Debugging with RhoStudio
### Prerequisites
* Install [RhoStudio](../rhostudio.tutorial)
* Install [RhoSimulator](#install-rhosimulator)
* Ensure your application is configured properly and successfully [runs in RhoSimulator](#run-application-in-rhosimulator) (from command line as described above)
### Starting debug session in RhoStudio
* Select Run » Debug Configurations... from top menu
* Find 'Rhodes Application' section on the left and add new (or modify existing) configuration
* On 'Common setting' tab select a project by clicking 'Browse...' button next to 'Project name:'
* Select 'Rho simulator' as the platform
* Click 'Apply' and then 'Debug'
### Debug capabilities
In present version of RhoStudio you may:
* Set breakpoints in Ruby code (.rb files)
* Watch variable values (global, local, class and instance) - currently auto-watch list is displayed in Expressions window
* View application log in Console window
## Build RhoSimulator
If you use custom native extensions, then running and debugging your applications in RhoSimulator requires a custom build.
Follow these instructions to build your own customized version of RhoSimulator.
### Preliminary steps for Windows
* Currently only <b>Visual Studio 2008</b> is supported
* Follow [Build for Windows - Prerequisites](build#build-for-windows)
* Clean temporary and generated files by running the rake command in the `rhodes` source folder:
rake clean:win32
### Preliminary steps for Mac OS X
* Follow [Building a Rhodes Application for iPhone/iPad - Prerequisites](build#building-a-rhodes-application-for-iphoneipad), but do not install the Rhodes gem since you're going to use Rhodes SDK source.
* Get the `rhodes` source (if haven't done it already) as described [here](build#setup-rhodes-source-code). Don't forget to add the `bin` folder to your path, run `rhodes-setup` and update Rhodes SDK path in `build.yml` at your application root folder.
* If you're using Xcode 4.4 or later, then you must install the OS 10.6 SDK as follows:
1. [Download](https://developer.apple.com/downloads/index.action) a version of Xcode for OS 10.7 Lion (such as Xcode 4.3.3.)
2. Mount the disk image file by double-clicking on it (do not drag-install this older version of Xcode!)
3. On the disk image, control-click on the Xcode icon and select Show Package Contents.
4. Browse to the directory `Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs`. You should see a folder named `MacOSX10.6.sdk`
5. Control-click on your newer Xcode icon (which you previously installed on your hard drive) and select Show Package Contents.
6. In your newer Xcode Browse to the directory `Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs`.
7. Copy the `MacOSX10.6.sdk` folder from the SDKs folder on the older disk image to the SDKs folder in the newer Xcode.
8. Unmount the disk image by dragging it to the trash.
* First build the Qt libraries for Mac from sources to enable HTTPS protocol support in RhoSimulator:
* Download the Qt source:
* Go to [http://qt-project.org/downloads](http://qt-project.org/downloads)
* Jump to `Qt libraries`
* Download the [source code as a zipped tar](http://releases.qt-project.org/qt4/source/qt-everywhere-opensource-src-4.8.2.tar.gz) (228 MB)
* Extract the downloaded archive, e.g. into `~/qt-4.8.2`
* Make sure that your `PATH` environment variable does not contain the path to any previously installed Qt binaries
* Add to your `~/.bash_profile` the new environment variable `QTDIR` by adding the line (or by changing the existing `QTDIR` variable):
export QTDIR=/Developer/SDKs/Qt
* Restart terminal windows to enable new environment setting.
* Patch Qt sources by replacing all occurrences of '/Developer/SDKs/MacOSX10' to '.*MacOSX10' in two project files:
* `~/qt-4.8.2/src/3rdparty/webkit/Source/WebKit/qt/QtWebKit.pro`
* `~/qt-4.8.2/src/plugins/bearer/corewlan/corewlan.pro`
* Open `Terminal.app` and issue commands:
$ cd ~/qt-4.8.2
$ ./configure -opensource -platform macx-g++
-nomake examples -nomake demos -nomake docs
-qt-libpng -qt-libjpeg -qt-libtiff -qt-libmng
-no-qt3support -webkit -release
-prefix /Developer/SDKs/Qt
-sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.6.sdk
$ make
$ sudo make install
If you're using Xcode 4.2 or earlier, then change the last line of `./configure` command to:
-sdk /Developer/SDKs/MacOSX10.6.sdk
Be aware that it will take a while to build the Qt libraries from sources (maybe few hours or so).
### Enable bundled native extensions
To enable `digest` native extensions bundled with Rhodes SDK make sure that the default application in your `rhobuild.yml` is the `framework_spec`:
app: [...]/rhodes/spec/framework_spec
To compile RhoSimulator with the custom native extensions change this path to your own Rhodes application home folder.
It should be noted that extensions you'd like to compile into RhoSimulator should be listed in the main `extensions`
section of your Rhodes application `build.yml` (but not in its platform-specific `extensions` sections).
### Build RhoSimulator with rake command:
When you've finished all the preliminary steps for your OS, the only thing you need to do is to run the rake command in the `rhodes` source folder:
rake build:rhosimulator
To run Rhodes applications in the custom built RhoSimulator, please ensure that no `env:` » `paths:` » `rhosimulator:` line is present at your `rhobuild.yml` (if present, remove that line).
### Build RhoSimulator for Windows in Visual Studio 2008:
* Open the solution:
`<path-to-ruby>\lib\ruby\gems\<version-number>\gems\rhodes-<version-number>\platform\wm\rhodes.sln`
* Build solution for the configuration `SimulatorRelease|Win32`
* Specify the path to custom built RhoSimulator at `rhobuild.yml`:
env:
paths:
rhosimulator: platform/wm/bin/win32/rhodes/SimulatorRelease
### Build RhoSimulator for OS X in Qt Creator:
* Follow all the preliminary steps for Mac OS X
* Make sure you have the latest revision of Qt SDK 4.8 installed and that it is configured in Qt Creator
* Run `rake build:rhosimulator` command in the `rhodes` source folder (it will generate all necessary temporary files and compile required extensions to `.a` library files)
* Delete folder: `<path-to-rhodes-source-folder>/platform/osx/bin/RhoSimulator`
* Open project file in Qt Creator: `<path-to-rhodes-source-folder>/platform/shared/qt/RhoSimulator.pro`
* Build for Release or Debug configuration
Something went wrong with that request. Please try again.