gerrit/Documentation/dev-eclipse.txt
David Ostrovsky 12968f26df GWT DevMode is dead; set up SuperDevMode
The codeserver runs separately and cannot easily be embedded in Gerrit
because it depends on an outdated version of Jetty. We may change this
behavior when GWT is updated.

Prerequisite is to download gwt-codeserver.jar and dependencies:

  buck build codeserver

Start CodeServer with new launch configuration:

  tools/eclipse/gerrit_gwt_codeserver.launch

And follow the instructions: [1].

[1] http://stackoverflow.com/a/18333050/116472

Inspired-By: Thomas Broyer <t.broyer@gmail.com>
Change-Id: Ieff7190db6bc151eae1274105ccf828eaa652027
2014-08-15 21:33:18 +00:00

148 lines
4.5 KiB
Plaintext

= Gerrit Code Review - Eclipse Setup
This document is about configuring Gerrit Code Review into an
Eclipse workspace for development and debugging with GWT.
Java 6 or later SDK is also required to run GWT's compiler and
runtime debugging environment.
[[Formatting]]
== Code Formatter Settings
Import `tools/GoogleFormat.xml` using Window -> Preferences ->
Java -> Code Style -> Formatter -> Import...
This will define the 'Google Format' profile, which the project
settings prefer when formatting source code.
== Site Initialization
Build once on the command line with
link:dev-buck.html#build[Buck] and then follow
link:dev-readme.html#init[Site Initialization] in the
Developer Setup guide to configure a local site for testing.
== Testing
=== Running the Daemon
Duplicate the existing launch configuration:
* Run -> Debug Configurations ...
* Java Application -> `gerrit_daemon`
* Right click, Duplicate
* Modify the name to be unique.
* Switch to Arguments tab.
* Edit the `-d` program argument flag to match the path used during
'init'. The template launch configuration resolves to ../gerrit_testsite
since that is what the documentation recommends.
* Switch to Common tab.
* Change Save as to be Local file.
* Close the Debug Configurations dialog and save the changes when prompted.
=== Running Hosted Mode
Duplicate the existing launch configuration:
* Run -> Debug Configurations ...
* Java Application -> `buck_gwt_debug`
* Right click, Duplicate
* Modify the name to be unique.
* Switch to Arguments tab.
* Edit the `-Dgerrit.site_path=` VM argument to match the path
used during 'init'. The template launch configuration resolves
to ../gerrit_testsite since that is what the documentation recommends.
* Switch to Common tab.
* Change Save as to be Local file.
* Close the Debug Configurations dialog and save the changes when prompted.
=== Running Super Dev Mode
Install dependencies:
----
buck build codeserver
----
Due to codeserver not correctly identifying user agent problem, that was
already fixed upstream but not released yet, the used user agent must be
explicitly set in `GerritGwtUI.gwt.xml` for SDM to work:
[source,xml]
----
<set-property name="user.agent" value="geko1_8" />
----
or
[source,xml]
----
<set-property name="user.agent" value="safari" />
----
* Select in Eclipse Run -> Debug Configurations `gerrit_gwt_codeserver.launch`
* Select in Eclipse Run -> Debug Configurations `gerrit_daemon.launch`
* Only once: add bookmarks for `Dev Mode On/Off` from codeserver URL:
`http://localhost:9876/` to your bookmark bar
* Make sure to activate source maps feature in your browser
* Load Gerrit page `http://localhost:8080`
* Open developer tools, source tab
* Click on `Dev Mode On` bookmark
* Select `gerrit_ui` module to compile (the `Compile` button can also be used
as a bookmarklet).
* Navigate on the left to: sourcemaps/gerrit_ui folder (`Ctrl+O` key shortcut
can be used)
* Select a file, for example com.google.gerrit.client.change.ChangeScreen2
and put a breakpoint
* Navigate in application in change screen and confirm hitting the breakpoint
* Select `Dev Mode Off` when the debugging session is finished
After changing the client side code:
* click `Dev Mode On` then `Compile` to reflect your changes in debug session
* Hitting `F5` in the browser will just load the last compile output, without
recompiling
[[known-problems]]
== Known problems
* OpenID authentication won't work in hosted mode, so you need to change
the link:config-gerrit.html#auth.type[auth.type] configuration parameter
to `DEVELOPMENT_BECOME_ANY_ACCOUNT` to disable OpenID and allow you to
impersonate whatever account you otherwise would've used.
* Error "Cannot create ReviewDb" occurs if the test site is already running.
Stop the test site with `gerrit.sh stop` before attempting to run hosted mode
debugging.
* Gerrit site doesn't appear, only directory listing is shown. Web toolkit
developer browser plugin is missing. If there is no warning, that browser
plugin is missing with the suggestion to install it, you can install the
right extension for your browser from the following locations:
+
https://dl.google.com/dl/gwt/plugins/chrome/gwt-dev-plugin.crx[Chrome]
+
link:https://dl.google.com/dl/gwt/plugins/firefox/gwt-dev-plugin.xpi[Firefox]
+
link:http://dl.google.com/dl/gwt/plugins/ie/1.0.7263.20091208111100/gwt-dev-plugin.msi[IE]
+
https://dl.google.com/dl/gwt/plugins/safari/gwt-dev-plugin.dmg[Safari]
GERRIT
------
Part of link:index.html[Gerrit Code Review]
SEARCHBOX
---------