[ALOY-852] Android: closure-compiler warns for suspicious Alloy code
GitHub Issue | n/a |
---|---|
Type | Improvement |
Priority | n/a |
Status | Closed |
Resolution | Won't Fix |
Resolution Date | 2014-01-06T19:21:00.000+0000 |
Affected Version/s | n/a |
Fix Version/s | Alloy 1.3.0 |
Components | Tooling |
Labels | alloy, android, build, compiler |
Reporter | Mauro Parra-Miranda |
Assignee | Tony Lukasavage |
Created | 2013-10-17T07:09:39.000+0000 |
Updated | 2014-02-28T23:57:14.000+0000 |
Description
It looks like the
closure-compiler
doesn't like the optimized Alloy code. Though it works fine, a log with all these warnings doesn't show off well on Appcelerator I would think.
Steps to reproduce
1. Create a project:titanium create -p android -n suspicious --id ti.suspicious -d .
2. Initialize Alloy: cd suspicious && alloy new
3. Build for Play Store to trigger the closure-compiler: titanium build -p android -T dist-playstore -K ~/some.keystore -L someAlias -P somePassword -O ~/
4. You'll see lots of warnings like these:
[INFO] Compiling javascript: alloy/controllers/index.js
[DEBUG] java -jar "/Users/zandbergen/Library/Application Support/Titanium/mobilesdk/osx/3.1.3.GA/android/lib/closure-compiler.jar" --js /Users/zandbergen/dev/tests/suspecious/build/android/bin/assets/Resources/alloy/controllers/index.js --js_output_file /Users/zandbergen/dev/tests/suspecious/build/android/bin/assets/Resources/alloy/controllers/index.js-compiled --jscomp_off=internetExplorerChecks --accept_const_keyword
[WARN] /Users/zandbergen/dev/tests/suspecious/build/android/bin/assets/Resources/alloy/controllers/index.js:7: WARNING - Suspicious code. This code lacks side-effects. Is there a bug?
arguments[0] ? arguments[0]["__parentSymbol"] : null;
^
/Users/zandbergen/dev/tests/suspecious/build/android/bin/assets/Resources/alloy/controllers/index.js:8: WARNING - Suspicious code. This code lacks side-effects. Is there a bug?
arguments[0] ? arguments[0]["$model"] : null;
^
/Users/zandbergen/dev/tests/suspecious/build/android/bin/assets/Resources/alloy/controllers/index.js:9: WARNING - Suspicious code. This code lacks side-effects. Is there a bug?
arguments[0] ? arguments[0]["__itemTemplate"] : null;
^
0 error(s), 3 warning(s)
[INFO] Compiling javascript: alloy.js
[DEBUG] java -jar "/Users/zandbergen/Library/Application Support/Titanium/mobilesdk/osx/3.1.3.GA/android/lib/closure-compiler.jar" --js /Users/zandbergen/dev/tests/suspecious/build/android/bin/assets/Resources/alloy.js --js_output_file /Users/zandbergen/dev/tests/suspecious/build/android/bin/assets/Resources/alloy.js-compiled --jscomp_off=internetExplorerChecks --accept_const_keyword
[WARN] /Users/zandbergen/dev/tests/suspecious/build/android/bin/assets/Resources/alloy.js:156: WARNING - If this if/for/while really shouldnt have a body, use {}
if (style.isId && opts.id && style.key === opts.id || style.isClass && _.contains(classes, style.key)) ; else {
^
0 error(s), 1 warning(s)
[~cbarber] I thought I heard mention that we might be doing something differently with respect to the closure-compiler for android. Is that true, and if so, could those changes perhaps be relevant here?
[~tlukasavage] Closure compiler has been ripped out and replaced by UglifyJS in 3.2.0. 3.1.x and older still uses Closure Compiler.
As [~cbarber] has stated, a different compiler is now being used as of TiSDK 3.2.0+ for these builds. This ticket is is no longer valid WRT to TiSDK, and we won't be backporting fixes for prior versions.