GitHub Issue | n/a |
Type | New Feature |
Priority | High |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2012-09-04T21:29:30.000+0000 |
Affected Version/s | Release 2.1.1, Release 3.0.0 |
Fix Version/s | Release 3.0.0, Sprint 2012-18 Core, 2012 Sprint 18 |
Components | Tooling |
Labels | core, qe-port |
Reporter | Alan Leard |
Assignee | Bill Dawson |
Created | 2012-08-27T13:23:31.000+0000 |
Updated | 2012-11-19T09:48:33.000+0000 |
Add a "finalize" hook to the plug-in build script so that a plug-in gets a chance to cleanup in case a plug-in build exits before post-build hook is invoked.
Testing Notes
* Download the attached zip file, put it in the Titanium root dir (e.g., /Library/Application Support/Titanium in OSX), and unzip it. * Verify that Titanium/plugins/my.plugin exists. * Create a new Titanium Mobile app in Titanium Studio. * It doesn't matter what's in app.js. * Edit the tiapp.xml to include reference to the plugin:* Build the app to Android Emulator. Watch the console to see that at the end of the build there is an INFO message indicating that the my.plugin finalize function has run. * Build the app to Android Device. Again look for that message. * Build the app to iPhone Simulator. After it launches, exit the simulator, check for the finalizer INFO message. * Build the app to iPhone device, and watch for the finalizer INFO message.
Verify the finalize runs on failures too
iPhone
* I can't find a code path after the plugins are loaded in iPhone builder.py (circa line 1103) for which I can make a suggestion how to break the build easily. So _manually_ edit iphone/builder.py in the unzipped SDK folder and addraise NameError("Hi There")
right inside thetry
block that is circa line 1116. In case builder.py changes significantly by the time you run these tests, I mean thetry
block whose first executable statement isos.chdir(iphone_dir)
. * Run the app to iPhone Simulator. * It should fail and you should still see the message that the plugin's finalize method is running.Android
* Create a file in the app's Resources/ folder named_test.js
(note the leading underscore). Just put a line of Javascript in it, like maybeTi.API.info("blah");
. * Run the app to Android Emulator. * The build will fail (files starting with underscores are not allowed) but the plugin's finalize method should still show that it's running.Pull request ready: https://github.com/appcelerator/titanium_mobile/pull/2858
Verified on: Titanium Studio: 3.0.0.201211131839 Titanium SDK:3.0.0.v20121113170203