Wednesday, November 29, 2017

Re: compilerArgs setProperty multi values - [ERROR] Unable to parse JavaScript

I'm curious, what is the code size difference? We end up using always emulated bc the performance and size doesn't worth. But it depends on each app. Or do you do native for performance (speed)?


El mié., 29 nov. 2017 14:36, Thomas Broyer <t.broyer@gmail.com> escribió:
So you need to provide a <property-provider> so the correct permutation can be chosen at runtime: http://www.gwtproject.org/doc/latest/DevGuideOrganizingProjects.html#DevGuideModuleXml
(this would likely fix your tests too; but you could also pass a -setProperty for the tests)


On Wednesday, November 29, 2017 at 11:25:15 AM UTC+1, Freddy Boucher wrote:
Hi @Thomas

Yes it works perfectly when I declare it in my *.gwt.xml but not when using Maven <set-property>.

The whole story is: 
For production, I want to compile with both values (native and emulated). 
By default User loads native permutation but if an Unexpected Exception occurs in client code, I send it to server, deobfuscate it, log it, then reload User's browser with emulated permutation.

Why doing that? Because it's likely to happen again if User retry to do exactly the same thing and with emulated permutation, the Deobfuscated StackTrace is 100% accurate about line number (vs not really with native permutation, PS: you can experience it by yourself on my demo app https://gwt-storage-objectify.appspot.com/ native it says View.java:150 vs emulated View.java:151 )

But for dev env and test env, I only need emulated.

And since I only have one *.gwt.xml for all envs, I would prefer to keep only one value otherwise GWTTestCase will complain:

INFO: /launch error: While attempting to load the module, property "compiler.stackMode" was not specifiedAllowed values: emulated,native,strip
Nov 29, 2017 9:22:19 PM com.gargoylesoftware.htmlunit.WebClient printContentIfNecessary
[WARN] 404 - GET /com.learnkeeper.App.JUnit/undefined.cache.js (127.0.0.1) 328 bytes
logging for HtmlUnit thread
   [ERROR] Load Script Error: java.io.IOException: Unable to download JavaScript from 'http://localhost:51160/com.learnkeeper.App.JUnit/undefined.cache.js' (status 404).
java.io.IOException: Unable to download JavaScript from 'http://localhost:51160/com.learnkeeper.App.JUnit/undefined.cache.js' (status 404).
at com.gargoylesoftware.htmlunit.html.HtmlPage.loadJavaScriptFromUrl(HtmlPage.java:1047)
INFO: statusCode=[404] contentType=[text/html]
Nov 29, 2017 9:22:19 PM com.gargoylesoftware.htmlunit.WebClient printContentIfNecessary
INFO: <html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<title>Error 404 Not Found</title>
</head>
<body><h2>HTTP ERROR 404</h2>
<p>Problem accessing /com.learnkeeper.App.JUnit/undefined.cache.js. Reason:
<pre>    Not Found</pre></p><hr><i><small>Powered by Jetty://</small></i><hr/>

</body>
</html>






On Wednesday, November 29, 2017 at 7:15:01 PM UTC+11, Thomas Broyer wrote:
I would say that you're not supposed to set compiler.stackMode to anything but a single value, because it doesn't have a property-provider; and that's exactly the problem with the generated JS: the snippet where the error occurs is a property provider, but because there's no <property-provider> for that property, it generates invalid JS (granted, it could have failed instead).
What I don't quite understand is that you're saying (IIUC) it only occurs with -setProperty and not <set-property>.

On Tuesday, November 28, 2017 at 8:57:38 AM UTC+1, Freddy Boucher wrote:
Hi,

On a GWT 2.8.2 Maven project using tbroyer/gwt-maven-plugin

When I declare:

<compilerArgs>
  <arg>-setProperty</arg>
  <arg>compiler.stackMode=native,emulated</arg>
</compilerArgs>


it fails:

[INFO]    Compiling 10 permutations

[INFO]       Compiling permutation 0...

[INFO]       Compiling permutation 1...

[INFO]       Compiling permutation 2...

[INFO]       Compiling permutation 3...

[INFO]       Compiling permutation 4...

[INFO]       Compiling permutation 5...

[INFO]       Compiling permutation 6...

[INFO]       Compiling permutation 7...

[INFO]       Compiling permutation 8...

[INFO]       Compiling permutation 9...

[INFO]    Compile of permutations succeeded

[INFO]    Compilation succeeded -- 53.925s

[INFO] Linking into /Users/freddyboucher/Private/Programming/gwt-storage-objectify/gwt-storage-objectify-client/target/gwt-storage-objectify-client-0.0.1-SNAPSHOT/app; Writing extras to /Users/freddyboucher/Private/Programming/gwt-storage-objectify/gwt-storage-objectify-client/target/gwt-storage-objectify-client-0.0.1-SNAPSHOT/WEB-INF/deploy/app

[INFO]    Invoking Linker Cross-Site-Iframe

[INFO]       Attempting to optimize JS

[INFO]          [ERROR] Unable to parse JavaScript

[INFO] com.google.gwt.dev.js.JsParserException: StandardLinkerContext.optimizeJavaScript(647): missing { before function body

[INFO] >   providers['compiler.stackMode'] = function()null;values['compiler.stackMode'] = {'emulated':0,'native':1,'strip':2};providers['user.agent'] = function(){

[INFO] > --------------------------------------------------^

[INFO] at com.google.gwt.dev.js.JsParser$1.error(JsParser.java:111)

[INFO] at com.google.gwt.dev.js.rhino.Context.reportError(Context.java:459)

[INFO] at com.google.gwt.dev.js.rhino.TokenStream.reportSyntaxError(TokenStream.java:1594)

[INFO] at com.google.gwt.dev.js.rhino.Parser.reportError(Parser.java:72)

[INFO] at com.google.gwt.dev.js.rhino.Parser.mustMatchToken(Parser.java:64)

[INFO] at com.google.gwt.dev.js.rhino.Parser.function(Parser.java:254)

[INFO] at com.google.gwt.dev.js.rhino.Parser.primaryExpr(Parser.java:1224)

[INFO] at com.google.gwt.dev.js.rhino.Parser.memberExpr(Parser.java:1163)

[INFO] at com.google.gwt.dev.js.rhino.Parser.unaryExpr(Parser.java:1079)

[INFO] at com.google.gwt.dev.js.rhino.Parser.mulExpr(Parser.java:1031)

[INFO] at com.google.gwt.dev.js.rhino.Parser.addExpr(Parser.java:1015)

[INFO] at com.google.gwt.dev.js.rhino.Parser.shiftExpr(Parser.java:1003)

[INFO] at com.google.gwt.dev.js.rhino.Parser.relExpr(Parser.java:987)

[INFO] at com.google.gwt.dev.js.rhino.Parser.eqExpr(Parser.java:976)

[INFO] at com.google.gwt.dev.js.rhino.Parser.bitAndExpr(Parser.java:966)

[INFO] at com.google.gwt.dev.js.rhino.Parser.bitXorExpr(Parser.java:956)

[INFO] at com.google.gwt.dev.js.rhino.Parser.bitOrExpr(Parser.java:946)

[INFO] at com.google.gwt.dev.js.rhino.Parser.andExpr(Parser.java:935)

[INFO] at com.google.gwt.dev.js.rhino.Parser.orExpr(Parser.java:924)

[INFO] at com.google.gwt.dev.js.rhino.Parser.condExpr(Parser.java:908)

[INFO] at com.google.gwt.dev.js.rhino.Parser.assignExpr(Parser.java:890)

[INFO] at com.google.gwt.dev.js.rhino.Parser.assignExpr(Parser.java:897)

[INFO] at com.google.gwt.dev.js.rhino.Parser.expr(Parser.java:880)

[INFO] at com.google.gwt.dev.js.rhino.Parser.statementHelper(Parser.java:775)

[INFO] at com.google.gwt.dev.js.rhino.Parser.statement(Parser.java:360)

[INFO] at com.google.gwt.dev.js.rhino.Parser.parseFunctionBody(Parser.java:156)

[INFO] at com.google.gwt.dev.js.rhino.Parser.function(Parser.java:257)

[INFO] at com.google.gwt.dev.js.rhino.Parser.parseFunctionBody(Parser.java:154)

[INFO] at com.google.gwt.dev.js.rhino.Parser.function(Parser.java:257)

[INFO] at com.google.gwt.dev.js.rhino.Parser.parse(Parser.java:116)

[INFO] at com.google.gwt.dev.js.JsParser.parseImpl(JsParser.java:133)

[INFO] at com.google.gwt.dev.js.JsParser.parse(JsParser.java:88)

[INFO] at com.google.gwt.dev.js.JsParser.parseInto(JsParser.java:93)

[INFO] at com.google.gwt.core.ext.linker.impl.StandardLinkerContext.optimizeJavaScript(StandardLinkerContext.java:443)

[INFO] at com.google.gwt.core.ext.linker.impl.SelectionScriptLinker.generateSelectionScript(SelectionScriptLinker.java:428)

[INFO] at com.google.gwt.core.ext.linker.impl.SelectionScriptLinker.generateSelectionScript(SelectionScriptLinker.java:416)

[INFO] at com.google.gwt.core.ext.linker.impl.SelectionScriptLinker.emitSelectionScript(SelectionScriptLinker.java:310)

[INFO] at com.google.gwt.core.ext.linker.impl.SelectionScriptLinker.link(SelectionScriptLinker.java:212)

[INFO] at com.google.gwt.core.ext.linker.impl.StandardLinkerContext.invokeFinalLink(StandardLinkerContext.java:339)

[INFO] at com.google.gwt.dev.Link.doSimulatedShardingLink(Link.java:459)

[INFO] at com.google.gwt.dev.Link.link(Link.java:178)

[INFO] at com.google.gwt.dev.Compiler.compile(Compiler.java:244)

[INFO] at com.google.gwt.dev.Compiler.compile(Compiler.java:155)

[INFO] at com.google.gwt.dev.Compiler.compile(Compiler.java:144)

[INFO] at com.google.gwt.dev.Compiler$1.run(Compiler.java:118)

[INFO] at com.google.gwt.dev.CompileTaskRunner.doRun(CompileTaskRunner.java:55)

[INFO] at com.google.gwt.dev.CompileTaskRunner.runWithAppropriateLogger(CompileTaskRunner.java:50)

[INFO] at com.google.gwt.dev.Compiler.main(Compiler.java:125)

[INFO] ------------------------------------------------------------------------

[INFO] Reactor Summary:

[INFO] 

[INFO] gwt-storage-objectify .............................. SUCCESS [  0.173 s]

[INFO] gwt-storage-objectify-shared ....................... SUCCESS [  1.390 s]

[INFO] gwt-storage-objectify-client ....................... FAILURE [ 56.988 s]

[INFO] gwt-storage-objectify-server ....................... SKIPPED




Reverting the commit fixes the build.

Thanks

--
You received this message because you are subscribed to the Google Groups "GWT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "GWT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment