Why com.google.gwt.dev.DevMode doesn't recognize the argument -style?

426 views
Skip to first unread message

hallmit

unread,
Dec 20, 2011, 6:05:14 AM12/20/11
to Google Web Toolkit
Hi folks,

I'm experiencing a little bit problem. I would like to launch my
application in development mode (known also as Hosted mode). My
current GWT version is 2.3.0.
For debug reasons, I want to inspect the generated JavaScript in my
browser but the default format is a non-human readable (obfuscated).
So, I'm trying to pass the argument -style PRETTY in my launch
configuration and I got this:
----------------------------------------------------------------------------------------------------------------------------------------------------------------
Unknown argument: -style
Google Web Toolkit 2.3.0
DevMode [-noserver] [-port port-number | "auto"] [-whitelist whitelist-
string] [-blacklist blacklist-string] [-logdir directory] [-logLevel
level] [-gen dir] [-bindAddress host-name-or-address] [-codeServerPort
port-number | "auto"] [-server servletContainerLauncher[:args]] [-
startupUrl url] [-war dir] [-deploy dir] [-extra dir] [-workDir dir]
module[s]

where
-noserver Prevents the embedded web server from running
-port Specifies the TCP port for the embedded web server
(defaults to 8888)
-whitelist Allows the user to browse URLs that match the
specified regexes (comma or space separated)
-blacklist Prevents the user browsing URLs that match the
specified regexes (comma or space separated)
-logdir Logs to a file in the given directory, as well as
graphically
-logLevel The level of logging detail: ERROR, WARN, INFO,
TRACE, DEBUG, SPAM, or ALL
-gen Debugging: causes normally-transient generated
types to be saved in the specified directory
-bindAddress Specifies the bind address for the code server and
web server (defaults to 127.0.0.1)
-codeServerPort Specifies the TCP port for the code server
(defaults to 9997)
-server Specify a different embedded web server to run
(must implement ServletContainerLauncher)
-startupUrl Automatically launches the specified URL
-war The directory into which deployable output files
will be written (defaults to 'war')
-deploy The directory into which deployable but not
servable output files will be written (defaults to 'WEB-INF/deploy'
under the -war directory/jar, and may be the same as the -extra
directory/jar)
-extra The directory into which extra files, not intended
for deployment, will be written
-workDir The compiler's working directory for internal use
(must be writeable; defaults to a system temp dir)
and
module[s] Specifies the name(s) of the module(s) to host
----------------------------------------------------------------------------------------------------------------------------------------------------------------


After searching on GWT repository [1], I figured out that the last
support for the argument -style was in GWT 1.6 when you were using
GwtShell. For the new classes, HostedMode and DevMode (class to use
instead), this argument isn't longer supported. Why?

So, it's possible to launch an application in development mode and get
a pretty Javascript generated (passing style argument to DevMode)?

Regards,
Hallmit

[1] Last time the -style was supported :
===>
http://code.google.com/p/google-web-toolkit/source/diff?spec=svn4262&r=4262&format=side&path=/releases/1.6/dev/core/src/com/google/gwt/dev/GWTShell.java
[2] Same problem here but no resolution?
===> http://groups.google.com/group/google-web-toolkit/browse_thread/thread/c1a258f3ba97dc86/d9c32090c78cebbe
===> http://groups.google.com/group/google-web-toolkit/browse_thread/thread/6e1d54bc856ec233/4948babf7e8de3b8

Thomas Broyer

unread,
Dec 20, 2011, 9:54:19 AM12/20/11
to google-we...@googlegroups.com


On Tuesday, December 20, 2011 12:05:14 PM UTC+1, hallmit wrote:
Hi folks,

I'm experiencing a little bit problem. I would like to launch my
application in development mode (known also as Hosted mode). My
current GWT version is 2.3.0.
For debug reasons, I want to inspect the generated JavaScript in my
browser but the default format is a non-human readable (obfuscated).
So, I'm trying to pass the argument -style PRETTY in my launch
configuration and I got this:
----------------------------------------------------------------------------------------------------------------------------------------------------------------
Unknown argument: -style
Google Web Toolkit 2.3.0

[...] 

----------------------------------------------------------------------------------------------------------------------------------------------------------------


After searching on GWT repository [1], I figured out that the last
support for the argument -style was in GWT 1.6 when you were using
GwtShell. For the new classes, HostedMode and DevMode (class to use
instead), this argument isn't longer supported. Why?


Because DevMode doesn't generate JavaScript *at all* (well, except for a the *.nocache.js if you don't have it already, but it doesn't contain anything related to your Java code).
The -style argument was there because you could call the Compiler from within the DevMode (by the click of a button); and because this has been removed, there's no reason to keep the -style argument.

So, it's possible to launch an application in development mode and get
a pretty Javascript generated (passing style argument to DevMode)?

No, because as I said, DevMode doesn't generate any JS at all. Either you run in DevMode, and your Java code runs in a JVM, only minimal JS involved (but not much things to debug); or you compile to JS (possibly passing -style PRETTY) and run in what's known as "production mode" (pure JS, no plugin in the browser, no Java involved).

hallmit

unread,
Dec 21, 2011, 5:42:14 AM12/21/11
to Google Web Toolkit
Many thanks Thomas for your clear explanation...You're right, in
development mode the GWT-JVM is actually executing the application
code as compiled Java bytecode, as described at GWT Doc [1] :), and
no JS is generated. So, pretty mode for JS generation doesn't make
sense here.

Hallmit

[1] http://code.google.com/intl/fr-FR/webtoolkit/doc/latest/DevGuideCompilingAndDebugging.html#DevGuideDevMode

Cristiano

unread,
Sep 23, 2013, 4:40:42 PM9/23/13
to google-we...@googlegroups.com, noleto....@gmail.com
Hi,
sorry if I open back an old discussion, 
I have a question for Thomas:

do the *.nocache.js generated by DevMode is the same as the one generated by the compiler?
The compiler in facts honors the -style options also for the *.nocache.js and generate different output depending on the -style value.

And what does change from *.nocache.js between different applications if it does not contains anything related to my java code?
Is it the same in any application?

Thank you,

Cristiano

Cristiano Costantini

unread,
Sep 23, 2013, 5:15:24 PM9/23/13
to google-we...@googlegroups.com, noleto....@gmail.com
Ok... 
I did hacked the code to force DevMode to write "pretty" output,
following is the diff of a "DemoApp.nocache.js" generated by DevMode and one compiled with 2 permutations (for 'gecko1_8' and 'safari'):

194,201d193
<   function unflattenKeylistIntoAnswers(propValArray, value){
<     var answer = answers;
<     for (var i = 0, n = propValArray.length - 1; i < n; ++i) {
<       answer = answer[propValArray[i]] || (answer[propValArray[i]] = []);
<     }
<     answer[propValArray[n]] = value;
<   }
302,304c294,295
<       unflattenKeylistIntoAnswers(['gecko1_8'], '797FC065259EE0BC34B64DCEEAB32816');
<       unflattenKeylistIntoAnswers(['safari'], '983F7F7FBB718A8A007A6EC2C16D2079');
<       strongName = answers[computePropValue('user.agent')];
---
>       alert("GWT module 'DemoApp' may need to be (re)compiled");
>       return;

Now I have a more clear idea on what it happen under the hood.

Bye,
Cristiano


2013/9/23 Cristiano <cristiano....@gmail.com>

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

Reply all
Reply to author
Forward
0 new messages