Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-14629] CLI: iOS Symbols wrongly imported from metadata.json

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionFixed
Resolution Date2013-11-02T00:02:12.000+0000
Affected Version/sn/a
Fix Version/s2013 Sprint 22, 2013 Sprint 22 Core, Release 3.2.0
ComponentsCLI, iOS
Labelscli, exports, ios, json, metadata, module, qe-closed-3.2.0
ReporterMartin Guillon
AssigneeChris Barber
Created2013-07-20T15:11:12.000+0000
Updated2013-12-20T01:04:37.000+0000

Description

Issue

When you want a module to export symbols for the app build you create a metadata.json and put something like this in it {"exports": ["Ti.Media"]} Now in CLI at [that](https://github.com/appcelerator/titanium_mobile/blob/master/iphone/cli/commands/_build.js#L2760) line, symbols are wrongly imported because the "Ti." should be first removed. Consequently we get the wrong #define and we get link errors. The "addSymbol" method should handle this with something like this: - symbol = symbol.replace(/^(Ti|Titanium)./, "");

PR

Actually the find symbols process was very dirty for iOS. Decided to clean it: https://github.com/Akylas/titanium_mobile/commit/79efdba3d89cd536c7e84d037a1126030d92dff9 I will create a PR if asked to do so

Comments

  1. Martin Guillon 2013-07-20

    [Moved to description]
  2. Chris Barber 2013-10-04

    UPDATE! I've actually redone this logic. First I have a platform agnostic symbol locator called jsanalyze.js: https://github.com/cb1kenobi/titanium_mobile/blob/timob-14976/node_modules/titanium-sdk/lib/jsanalyze.js. I've already implemented this in the new Android build and I'll be updating iOS in the next week or two. :)
  3. Martin Guillon 2013-10-05

    wow i see a lot of things that i want :P Thanks for the clarification Chris. Merging right away! :D
  4. Chris Barber 2013-11-01

    Pull request: https://github.com/appcelerator/titanium_mobile/pull/4898
  5. Eric Merriman 2013-12-16

    Guidance for testing?
  6. Chris Barber 2013-12-16

    To test, you need a module that is written in JavaScript, but wrapped in a native module. I have no clue how to do this from scratch.
  7. Martin Guillon 2013-12-18

    Sadly i can't attach a file :s Here you go it should be working http://www.sendspace.com/file/pkw3kw
  8. Martin Guillon 2013-12-18

    Also for future reference, i update the module build system to make sure assets are updated correctly before module build. I know it s done in the command line but it s REALLy good to have it from xcode. Cant really make a PR for that right now but here is the diff for future reference !http://i.imgur.com/cY2To5n.png!
  9. Wilson Luu 2013-12-20

    Closing ticket as fixed. While using [this sample test case](http://www.sendspace.com/file/pkw3kw), I was able to verify the following: 0. After building the module from build.py, verified the metadata.json appears in the root level of the module 1. After importing the module into a Titanium app, was able to install to device, run on simulator, and adhoc package the app without any errors 2. With this code in app.js:
       var CommonJSTest = require('commonjs.test');
       Ti.API.info("module is => " + CommonJSTest);
       
       CommonJSTest.test();
       
    Verified the native camera controls appear after launching app (see commonjs.test.js from the test case). Tested on: Appcelerator Studio, build: 3.2.0.201312181652 SDK build: 3.2.0.v20131218153242 CLI: 3.2.0-cr3 Alloy: 1.3.0-cr2 Xcode: 5.0.2 Devices: ios simulator (6.1, 7.0.3), iphone 5 (6.1.3), iphone 5s (7.0.2)

JSON Source