Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-16059] CLI: JavaScript syntax errors breaks build with cryptic message

GitHub Issuen/a
TypeBug
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2014-01-02T08:36:24.000+0000
Affected Version/sRelease 3.2.0
Fix Version/s2013 Sprint 26, 2013 Sprint 26 Core, Release 3.2.0, Release 3.3.0
ComponentsCLI
Labelsqe-closed-3.2.0, qe-testadded
ReporterChris Barber
AssigneeChris Barber
Created2013-12-20T16:24:02.000+0000
Updated2014-07-23T07:36:47.000+0000

Description

When building an app for device or distribution that contains an JavaScript error, a Node.js crash occurs.
[INFO]  Processing JavaScript files

/Users/chris/Library/Application Support/Titanium/mobilesdk/osx/3.3.0/node_modules/titanium-sdk/lib/jsanalyze.js:64
		var errmsg = [ __('Failed to minify %s', opts.filename) ];
		               ^
ReferenceError: __ is not defined
    at Object.analyzeJs (/Users/chris/Library/Application Support/Titanium/mobilesdk/osx/3.3.0/node_modules/titanium-sdk/lib/jsanalyze.js:64:18)
    at Object.analyzeJsFile (/Users/chris/Library/Application Support/Titanium/mobilesdk/osx/3.3.0/node_modules/titanium-sdk/lib/jsanalyze.js:35:17)
    at iOSBuilder.<anonymous> (/Users/chris/Library/Application Support/Titanium/mobilesdk/osx/3.3.0/iphone/cli/commands/_build.js:2860:24)
    at /Users/chris/Library/Application Support/Titanium/mobilesdk/osx/3.3.0/node_modules/node-appc/node_modules/async/lib/async.js:548:21
    at /Users/chris/Library/Application Support/Titanium/mobilesdk/osx/3.3.0/node_modules/node-appc/node_modules/async/lib/async.js:224:13
    at iterate (/Users/chris/Library/Application Support/Titanium/mobilesdk/osx/3.3.0/node_modules/node-appc/node_modules/async/lib/async.js:131:13)
    at async.eachSeries (/Users/chris/Library/Application Support/Titanium/mobilesdk/osx/3.3.0/node_modules/node-appc/node_modules/async/lib/async.js:147:9)
    at _asyncMap (/Users/chris/Library/Application Support/Titanium/mobilesdk/osx/3.3.0/node_modules/node-appc/node_modules/async/lib/async.js:223:9)
    at Object.mapSeries (/Users/chris/Library/Application Support/Titanium/mobilesdk/osx/3.3.0/node_modules/node-appc/node_modules/async/lib/async.js:213:23)
    at async.series (/Users/chris/Library/Application Support/Titanium/mobilesdk/osx/3.3.0/node_modules/node-appc/node_modules/async/lib/async.js:546:19)
To reproduce, run the following app.js code:
var win = Ti.UI.createWindow();

win.crash(arg){};
Expected results:
[INFO]  Processing JavaScript files
[ERROR] Failed to minify /Users/chris/appc/workspace/testapp2/Resources/app.js
[ERROR] Unexpected token: punc ({) [line 3, column 14]
[ERROR]   
[ERROR]     win.crash(arg){};
[ERROR]     --------------^
[ERROR]

Comments

  1. Chris Barber 2013-12-20

    Master pull request: https://github.com/appcelerator/titanium_mobile/pull/5153 3.2.x pull request: https://github.com/appcelerator/titanium_mobile/pull/5154 3.2.x_hybrid pull request: https://github.com/appcelerator/titanium_mobile/pull/5155
  2. Priya Agarwal 2014-01-02

    Verified with environment: Appc-Studio: 3.2.0.201312191455 Sdk:3.2.0.GA acs:1.0.11 alloy:1.3.0 npm:1.3.2 titanium:3.2.0 titanium-code-processor:1.1.0 Osx: Maverick 10.9 Xcode: xCode 5.0.2 Getting the expected result as per above comments. Hence Closing as fixed and verified.
  3. Priya Agarwal 2014-01-02

    Reopening just to add qe-closed label
  4. Priya Agarwal 2014-01-02

    Closing as updated label.

JSON Source