-
Notifications
You must be signed in to change notification settings - Fork 205
Architecture of a plugin
Here's some information on the file structure with respect to the architecture of a plugin. The example plugin used here is BB10-Cordova/NowPlaying.
It uses a shell script like nowplaying_build.sh to build and run a sample application called debug1, which uses boilerplate code from an application called sample and the NowPlaying plugin on the blackberry 10 platform.
#!/bin/bash
rm -rf debug1
cordova create debug1
cd debug1
cordova plugin add ../plugin
rm -rf www/
cp -r ../sample/* ./
cordova platform add blackberry10
cordova run
The plugin is in "plugin". "sample" is a sample app that uses the plugin. nowplaying_build.sh automatically creates another app called "debug1" and adds the plugin to it. It then uses the "sample" app as boilerplate code to copy into the newly created "debug1" app. The script then adds blackberry10 as a platform, and does a cordova run. You can use this script to run and test changes, because the first thing it always does is remove the "debug1" app.
Below, you'll see the layers wrt the drawing Tim made on the whiteboard during the code sprint. The first file listed in each layer is what you need to change (I like to open the non-.cpp/hpp files in order side by side on my editor, then the .cpp/hpp files in order side-by-side on momentics). If I remember correctly, the second file (second "->") is where the file is copied to when you add the plugin or when it gets copied from the "sample" app to the newly created "debug1" app; the third file is where the file is copied to when you add blackberry10 as a platform or is what the file is compiled to (a library).
App "main" html:
- sample/www/index.html
- debug1/www/index.html
- debug1/platforms/blackberry10/www/index.html
App "main" js:
- sample/www/js/index.js
- debug1/www/js/index.js
- debug1/platforms/blackberry10/www/js/index.js
App:
- plugin/www/client.js
- debug1/plugins/com.blackberry.community.nowplaying/www/client.js
- debug1/platforms/blackberry10/www/plugins/com.blackberry.community.nowplaying/www/client.js
Cordova:
- debug1/platforms/blackberry10/platform_www/cordova.js
Controller:
- plugin/src/blackberry10/index.js
- debug1/plugins/com.blackberry.community.nowplaying/src/blackberry10/index.js
- debug1/platforms/blackberry10/native/device/chrome/plugin/com.blackberry.community.nowplaying/index.js
TemplateJS:
- plugin/src/blackberry10/native/src/NowPlaying_js.cpp
- debug1/plugins/com.blackberry.community.nowplaying/src/blackberry10/native/src/NowPlaying_js.cpp
- debug1/platforms/blackberry10/native/device/plugins/jnext/libNowPlaying.so
TemplateNDK:
- plugin/src/blackberry10/native/src/NowPlaying_ndk.cpp
- debug1/plugins/com.blackberry.community.nowplaying/src/blackberry10/native/src/NowPlaying_ndk.cpp
- debug1/platforms/blackberry10/native/device/plugins/jnext/libNowPlaying.so