[TIMOB-3313] Android: JS Compiler in Production Mode Should Detect Compile Failures
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Medium |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2011-05-24T14:30:31.000+0000 |
Affected Version/s | n/a |
Fix Version/s | Release 1.7.0, Sprint 2011-20 |
Components | Android |
Labels | android, defect, release-1.7.0, reported-1.6.1, tooling |
Reporter | Don Thorp |
Assignee | Bill Dawson |
Created | 2011-04-15T03:41:55.000+0000 |
Updated | 2011-05-24T14:30:31.000+0000 |
Description
This problem was found with a non-breaking space in a source
file that appeared because the encoding flag wasn't being passed to
the compiler. The problem doesn't exist in test
or
development
mode because we handle passing the string
to the compiler.
Please put in release-1.6.1 and release-1.7.0 and open tags.
Now the question is how to test this fix, since in order to test it you somehow need to force a compiler error. Since we've fixed the two known compiler errors that we've so far encountered, I'm not sure what to do. THinking about it.
And here we go: So our goal here is to *cause* a compiler error, and demonstrate that the packaging-for-distribution process will now stop on that error rather than continue on its merry way as if nothing happened. In your test app.js, just put two backslashes by themselves on a line. That should choke it.
Verified error stops production run with Titanium Studio, build: 1.0.0.201105201912. Hat tip to Natalie and Bill for help on this one. Error: [ERROR] js: "/Volumes/Data/Titanium/titanium_mobile/demos/KitchenSink/build/android/bin/assets/Resources/app.js", line 21: illegal character js: \\var win2 = Titanium.UI.createWindow({ js: .^ Exception in thread "main" org.mozilla.javascript.EvaluatorException: Compilation produced 1 syntax errors. (/Volumes/Data/Titanium/titanium_mobile/demos/KitchenSink/build/android/bin/assets/Resources/app.js#1) at org.mozilla.javascript.tools.ToolErrorReporter.runtimeError(ToolErrorReporter.java:144) at org.mozilla.javascript.Parser.parse(Parser.java:597) at org.mozilla.javascript.Parser.parse(Parser.java:506) at org.mozilla.javascript.optimizer.ClassCompiler.compileToClassFiles(ClassCompiler.java:166) at org.mozilla.javascript.tools.jsc.Main.processSource(Main.java:276) at org.mozilla.javascript.tools.jsc.Main.main(Main.java:73)