android_rhodes_activity_listener |
Java class name implemented interface com.rhomobile.rhodes.RhodesActivityListener (used for attach to main Rhodes application activity) |
android_manifest_changes |
filename with Android manifest items (in format of Android manifest) 0 this file will join to main AndroidManifest.xml of application |
android_resources_addons |
folder with any additional files for add to main application build folder (can contain any resources, layouts, etc.) |
android_additional_sources_list |
filename with list of *.java files for building with main Rhodes application package |
Here is an example of an ext.yml file for an NFC extension. This example is taken from the Rhodes installation, located at [Rhodes root]/lib/extensions/Nfc.
entry: Init_Nfc
android_rhodes_activity_listener: com.rhomobile.nfc.Nfc
android_manifest_changes: ext/nfc/platform/android/AndroidManifest.xml
android_resources_addons: ext/nfc/platform/android/additional_files
android_additional_sources_list: ext/nfc/platform/android/ext_build.files
libraries: ["Nfc"]
### Create Your Build Script
In the "ext" folder, such as `accel/extensions/accelerometer/ext`, you will create your build scripts and your native extension code.
Create a build script file. Name this file `build` for Macintosh and `build.bat` for Windows. This file executes a rake file that contains all your compiling commands for your extension. (You can instead put your compiling commands in the build file, but this chapter uses the Rakefile method.)
When running on Linux and Macintosh, make sure the build files are executable.
For the Macintosh, the build file contains:
#!/bin/sh
rake
For Windows, the build.bat file contains:
rake --trace
The above build scripts execute a Rakefile script which you create: this Rakefile compiles your extension code and produces the libraries. When Rhodes creates the final binary for your application, it will search for and link with the library that was generated for your extension. For an extension called `accelerometer`, the build script for iPhone and Android should be name the library `libaccelerometer.a`; for Windows, it should be named `accelerometer.lib`. The build script (in this case, in the Rakefile) should place the library in the folder named by TARGET_TEMP_DIR.
**NOTE: You do not need to use a rakefile. You can put your compiling commands in the build or build.bat scripts. The only requirement is that you have a file named build and that it is executable.
## Environment Variables Used in the Build Script
Before you build the build script (in this case, a Rakefile), you should be aware of the environmental variables that you can use in the script. These variables give you the path to the Rhodes root and information about your application platform. In the example used here, the Rakefile for the iPhone accelerometer uses several of these variables.
The following environment variables are used by all the platforms.