TurboManage

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…

    March 2011
    S M T W T F S
     12345
    6789101112
    13141516171819
    20212223242526
    2728293031  
  • Blog Stats

    • 1,029,898 hits

Archive for March 18th, 2011

Working on GWT

Posted by David Chandler on March 18, 2011

Lately, I’ve been working on a GWT patch to enable server-side inheritance in RequestFactory services. Along the way, I’ve picked up a few tips about working on the GWT source itself and thought I’d share them with others who may be interested. (By the way, the Web-based code review tool at the patch link above is used by many teams at Google and is itself an open source project written by Guido vonRossum, creator of python. It runs on App Engine, and is a powerful tool for any open source project).

Check out the GWT source from SVN

> mkdir gwt
> cd gwt
> svn checkout https://google-web-toolkit.googlecode.com/svn/trunk/ trunk
> svn checkout https://google-web-toolkit.googlecode.com/svn/tools/ tools

Import the gwt-dev and gwt-user projects into Eclipse

In Eclipse, go to File | Import | Existing project and browse to gwt/trunk/eclipse. This will find many pre-built projects you can import. Check the boxes to import gwt-dev and gwt-user.

Configure Eclipse

  1. Go to Preferences | General > Workspace > Linked Resources and create a new resource named GWT_ROOT that points the trunk folder above.
  2. Go to Preferences | Java > Build path > Classpath variables and create a new variable named GWT_TOOLS that points to the tools folder above.

At this point, the gwt-dev and gwt-user projects in your workspace should build without errors. If you’re planning to contribute code to GWT, you’ll also want to import the GWT style formatter for Eclipse.

Run Tests

There are a couple gotchas to running the GWT unit tests in Eclipse. First, some tests seem to require more stack memory than the Eclipse defaults, so you’ll want to add the following parameter under the -vmargs in your eclipse.ini:

-Xss1024k

Second, any tests that extend GWTTestCase, whether directly or up the inheritance chain, must be run as GWT JUnit tests, not regular JUnit tests. Google Plugin for Eclipse automatically makes the “Run as GWT JUnit test” option available in the context menu for GWT projects, but gwt-user itself is not a GWT project. To run a test located in gwt-user as a GWT JUnit test, do the following:

  1. Right-click on the gwt-user project and go to Properties | Google | Web Toolkit. Check the box that says “Use Google Web Toolkit”. The version numbers will be grayed out, but that’s OK. Click OK.
  2. Right-click on the test you’re interested in, say, RequestFactoryJreTest, and select Run As | Run Configurations… In the dialog, click GWT JUnit Test and then the New icon in the upper left corner of the dialog. This will create a new launch config for the test. Click the Run button to run it.

For further reading, here are the detailed instructions on setting up Eclipse to work on GWT source. If you want to contribute a patch to GWT, please see the Making GWT Better page for further instructions.

Happy coding!

Posted in Google Web Toolkit | 3 Comments »

 
%d bloggers like this: