David Chandler's Journal of Java Web and Mobile Development

  • David M. Chandler

    Web app developer since 1994 and Google Cloud Platform Instructor now residing in Colorado. Besides tech, I enjoy landscape photography and share my work at ColoradoPhoto.gallery.

  • Subscribe

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 223 other followers

  • Sleepless Nights…

    April 2010
    S M T W T F S
  • Blog Stats

    • 1,029,897 hits

Archive for April 14th, 2010

GWT compiler options

Posted by David Chandler on April 14, 2010

There doesn’t appear to be much documentation on GWT compiler options, and what there is refers to an old version (1.6). Fortunately, you can always invoke the compiler on the command line to see a list of options. If you’ve installed GWT using the Google plugin for Eclipse, you’ll find GWT_HOME in your eclipse/plugins directory.

C:\...\gwt-2.0.3>java -cp gwt-dev.jar com.google.gwt.dev.Compiler
Missing required argument 'module[s]'
Google Web Toolkit 2.0.3
Compiler [-logLevel level] [-workDir dir] [-gen dir] [-style style] [-ea] [-XdisableClassMetadata] [-XdisableCastChecking] [-validateOnly] [-draftCompile] [-compileReport] [-localWorkers count] [-war dir] [-extra dir] module[s]

  -logLevel               The level of logging detail: ERROR, WARN, INFO, TRACE, DEBUG, SPAM, or ALL
  -workDir                The compiler's working directory for internal use (must be writeable; defaults to a system tem
p dir)
  -gen                    Debugging: causes normally-transient generated types to be saved in the specified directory
  -style                  Script output style: OBF[USCATED], PRETTY, or DETAILED (defaults to OBF)
  -ea                     Debugging: causes the compiled output to check assert statements
  -XdisableClassMetadata  EXPERIMENTAL: Disables some java.lang.Class methods (e.g. getName())
  -XdisableCastChecking   EXPERIMENTAL: Disables run-time checking of cast operations
  -validateOnly           Validate all source code, but do not compile
  -draftCompile           Enable faster, but less-optimized, compilations
  -compileReport          Create a compile report that tells the Story of Your Compile
  -localWorkers           The number of local workers to use when compiling permutations
  -war                    The directory into which deployable output files will be written (defaults to 'war')
  -extra                  The directory into which extra files, not intended for deployment, will be written
  module[s]               Specifies the name(s) of the module(s) to compile

To pass one of these options to the GWT compiler within Eclipse, click Advanced in the GWT Compile dialog.

I was particularly interested in the -gen option, which outputs the Java code emitted by GWT generators used by projects such as gwittir and GWTP to somewhat simplify GWT development using MVP and code splitting. More on this forthcoming…

If you haven’t tried it yet, definitely have a look at the -compileReport option also. It generates an HTML report showing the “story of your compile,” including the size of each package and any split points. You’ll find the report in your project’s build directory under extras/project_name/soycReport/compile-report/index.html.

Posted in Google Web Toolkit | 11 Comments »

%d bloggers like this: