Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-10674] Tooling: Add a Finalize Hook into the plugin build script

GitHub Issuen/a
TypeNew Feature
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2012-09-04T21:29:30.000+0000
Affected Version/sRelease 2.1.1, Release 3.0.0
Fix Version/sRelease 3.0.0, Sprint 2012-18 Core, 2012 Sprint 18
ComponentsTooling
Labelscore, qe-port
ReporterAlan Leard
AssigneeBill Dawson
Created2012-08-27T13:23:31.000+0000
Updated2012-11-19T09:48:33.000+0000

Description

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.

Attachments

FileDateSize
my.plugin-0.1.zip2012-08-30T17:45:33.000+0000905

Comments

  1. Bill Dawson 2012-08-30

    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:
       <plugins>
         <plugin version="0.1">my.plugin</plugin>
       </plugins>
       
    * 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 add raise NameError("Hi There") right inside the try block that is circa line 1116. In case builder.py changes significantly by the time you run these tests, I mean the try block whose first executable statement is os.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 maybe Ti.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.
  2. Bill Dawson 2012-08-30

    Pull request ready: https://github.com/appcelerator/titanium_mobile/pull/2858
  3. Satyam Sekhri 2012-11-19

    Verified on: Titanium Studio: 3.0.0.201211131839 Titanium SDK:3.0.0.v20121113170203

JSON Source