{ "id": "92487", "key": "TIMOB-9297", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "10153", "key": "TIMOB", "name": "Titanium SDK/CLI", "projectCategory": { "id": "10100", "description": "Titanium and related SDKs used in application development", "name": "Client" } }, "fixVersions": [ { "id": "13271", "description": "Release 2.1.0", "name": "Release 2.1.0", "archived": false, "released": true, "releaseDate": "2012-06-29" }, { "id": "13403", "description": "Sprint 2012-11 Core", "name": "Sprint 2012-11 Core", "archived": true, "released": true, "releaseDate": "2012-06-03" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2012-05-31T20:17:47.000+0000", "created": "2012-05-29T12:57:15.000+0000", "priority": { "name": "High", "id": "2" }, "labels": [ "core", "qe-port" ], "versions": [ { "id": "13271", "description": "Release 2.1.0", "name": "Release 2.1.0", "archived": false, "released": true, "releaseDate": "2012-06-29" } ], "issuelinks": [], "assignee": { "name": "billdawson", "key": "billdawson", "displayName": "Bill Dawson", "active": true, "timeZone": "Europe/Berlin" }, "updated": "2012-08-28T04:43:55.000+0000", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "components": [ { "id": "10206", "name": "iOS", "description": "iOS Platform" } ], "description": "If an iOS module project has a file named {{assets/[moduleid].js}} then that javascript file is compiled and actually becomes the module itself (in lieu of the native, Objective-C code). If you create a module project and add such a file, you will only be able to compile the module project one time.\r\n\r\nh3. Fail Case / Test Case\r\n\r\n* Create an iOS module project (not going through those steps here.) For purposes of this example, let's say the module has the id \"ti.testmod\".\r\n\r\n* Create a JS file {{assets/[moduleid].js}}. In my example, you would create {{assets/ti.testmod.js}}.\r\n\r\n* Put some miscellaneous {{exports}} code in that Js file, such as:\r\n\r\n{code:name=ti.testmod.js}\r\nexports.hello = function() { return \"hello world\"; };\r\n{code}\r\n\r\n* Build the module project.\r\n\r\n* Build the module project again. This second time, it will fail with a bunch of \"redefinition of ...\" errors. Example:\r\n\r\n{code}\r\n\r\n/Users/bill/tmp/mods/barker/Classes/TiBarkerModuleAssets.m:29:16: error: redefinition of 'data'\r\n static UInt8 data[] = {\r\n ^\r\n/Users/bill/tmp/mods/barker/Classes/TiBarkerModuleAssets.m:12:16: note: previous definition is here\r\n static UInt8 data[] = {\r\n ^\r\n/Users/bill/tmp/mods/barker/Classes/TiBarkerModuleAssets.m:37:17: error: redefinition of 'ranges'\r\n static NSRange ranges[] = {\r\n ^\r\n/Users/bill/tmp/mods/barker/Classes/TiBarkerModuleAssets.m:20:17: note: previous definition is here\r\n static NSRange ranges[] = {\r\n{code}\r\n\r\n* If you're testing my fix branch, you should _not_ get the failures, of course.\r\n\r\nThe reason is that the template-replacement code (where we dump in the results of running titanium prep on the javascript) is slightly wrong and is stacking up the code each time prep is run, rather than replacing the existing code.", "attachment": [], "flagged": false, "summary": "iOS: External (native) module with commonjs file in it can only be built once", "creator": { "name": "billdawson", "key": "billdawson", "displayName": "Bill Dawson", "active": true, "timeZone": "Europe/Berlin" }, "subtasks": [], "reporter": { "name": "billdawson", "key": "billdawson", "displayName": "Bill Dawson", "active": true, "timeZone": "Europe/Berlin" }, "environment": "Titanium 2.1.0 on master branch (I'm at hash 2f3b094 when this is happening, but earlier too.)", "comment": { "comments": [ { "id": "196351", "author": { "name": "billdawson", "key": "billdawson", "displayName": "Bill Dawson", "active": true, "timeZone": "Europe/Berlin" }, "body": "PR Ready:\r\n\r\nhttps://github.com/appcelerator/titanium_mobile/pull/2287", "updateAuthor": { "name": "billdawson", "key": "billdawson", "displayName": "Bill Dawson", "active": true, "timeZone": "Europe/Berlin" }, "created": "2012-05-29T13:50:32.000+0000", "updated": "2012-05-29T13:50:32.000+0000" }, { "id": "196810", "author": { "name": "blainhamon", "key": "blainhamon", "displayName": "Blain Hamon", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Pull merged", "updateAuthor": { "name": "blainhamon", "key": "blainhamon", "displayName": "Blain Hamon", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-05-31T20:17:47.000+0000", "updated": "2012-05-31T20:17:47.000+0000" }, { "id": "216403", "author": { "name": "amittal", "key": "amittal", "displayName": "Anshu Mittal", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Verified on:\r\nSDK:2.2.0.v20120827143312\r\nStudio:2.1.2.201208201549\r\n\r\n\r\nModules with commonjs file in it can be built any number of times successfully.", "updateAuthor": { "name": "amittal", "key": "amittal", "displayName": "Anshu Mittal", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-08-28T04:43:55.000+0000", "updated": "2012-08-28T04:43:55.000+0000" } ], "maxResults": 3, "total": 3, "startAt": 0 } } }