Shawn O. Pearce | e31d02c | 2009-12-08 12:21:37 -0800 | [diff] [blame] | 1 | Gerrit Code Review - Developer Setup |
| 2 | ==================================== |
Shawn O. Pearce | d2b73db | 2009-01-09 11:55:47 -0800 | [diff] [blame] | 3 | |
Shawn O. Pearce | 18f1f7f | 2009-12-16 11:32:39 -0800 | [diff] [blame] | 4 | Apache Maven is needed to compile the code, and a SQL database |
| 5 | to house the review metadata. H2 is recommended for development |
| 6 | databases, as it requires no external server process. |
Shawn O. Pearce | d2b73db | 2009-01-09 11:55:47 -0800 | [diff] [blame] | 7 | |
Shawn O. Pearce | 18f1f7f | 2009-12-16 11:32:39 -0800 | [diff] [blame] | 8 | Get the Source |
| 9 | -------------- |
Shawn O. Pearce | d2b73db | 2009-01-09 11:55:47 -0800 | [diff] [blame] | 10 | |
Shawn O. Pearce | 18f1f7f | 2009-12-16 11:32:39 -0800 | [diff] [blame] | 11 | Create a new client workspace: |
Shawn O. Pearce | d2b73db | 2009-01-09 11:55:47 -0800 | [diff] [blame] | 12 | |
Shawn O. Pearce | 18f1f7f | 2009-12-16 11:32:39 -0800 | [diff] [blame] | 13 | ---- |
| 14 | git clone git://android.git.kernel.org/tools/gerrit.git |
| 15 | cd gerrit |
| 16 | ---- |
Shawn O. Pearce | d2b73db | 2009-01-09 11:55:47 -0800 | [diff] [blame] | 17 | |
| 18 | |
| 19 | Configuring Eclipse |
| 20 | ------------------- |
| 21 | |
Shawn O. Pearce | 18f1f7f | 2009-12-16 11:32:39 -0800 | [diff] [blame] | 22 | To use the Eclipse IDE for development, please see |
| 23 | link:dev-eclipse.html[Eclipse Setup] for more details on how to |
| 24 | configure the workspace with the Maven build scripts. |
Shawn O. Pearce | d2b73db | 2009-01-09 11:55:47 -0800 | [diff] [blame] | 25 | |
| 26 | |
Shawn O. Pearce | 18f1f7f | 2009-12-16 11:32:39 -0800 | [diff] [blame] | 27 | [[build]] |
Shawn O. Pearce | d2b73db | 2009-01-09 11:55:47 -0800 | [diff] [blame] | 28 | Building |
| 29 | -------- |
| 30 | |
| 31 | From the command line: |
| 32 | |
Shawn O. Pearce | 18f1f7f | 2009-12-16 11:32:39 -0800 | [diff] [blame] | 33 | ---- |
| 34 | mvn package |
| 35 | ---- |
Shawn O. Pearce | d2b73db | 2009-01-09 11:55:47 -0800 | [diff] [blame] | 36 | |
Shawn O. Pearce | 18f1f7f | 2009-12-16 11:32:39 -0800 | [diff] [blame] | 37 | Output executable WAR will be placed in: |
Shawn O. Pearce | d2b73db | 2009-01-09 11:55:47 -0800 | [diff] [blame] | 38 | |
Shawn O. Pearce | 18f1f7f | 2009-12-16 11:32:39 -0800 | [diff] [blame] | 39 | ---- |
Shawn O. Pearce | 44671f5 | 2009-11-07 12:55:26 -0800 | [diff] [blame] | 40 | gerrit-war/target/gerrit-*.war |
Shawn O. Pearce | 18f1f7f | 2009-12-16 11:32:39 -0800 | [diff] [blame] | 41 | ---- |
Shawn O. Pearce | d2b73db | 2009-01-09 11:55:47 -0800 | [diff] [blame] | 42 | |
Shawn O. Pearce | 18f1f7f | 2009-12-16 11:32:39 -0800 | [diff] [blame] | 43 | Mac OS X |
| 44 | ~~~~~~~~ |
| 45 | On Mac OS X ensure "Java For Mac OS X 10.5 Upate 4" (or later) has |
| 46 | been installed, and that `JAVA_HOME` is set to |
| 47 | "/System/Library/Frameworks/JavaVM.framework/Versions/1.6/Home". |
| 48 | Check the installed version by running `java -version` and looking |
| 49 | for 'build 1.6.0_13-b03-211'. Versions of Java 6 prior to this |
| 50 | version crash during the build due to a bug in the JIT compiler. |
Shawn O. Pearce | 461c2cc | 2009-02-25 09:09:31 -0800 | [diff] [blame] | 51 | |
Shawn O. Pearce | 18f1f7f | 2009-12-16 11:32:39 -0800 | [diff] [blame] | 52 | |
| 53 | [[init]] |
| 54 | Site Initialization |
| 55 | ------------------- |
| 56 | |
| 57 | After compiling (above), run Gerrit's 'init' command to create a |
| 58 | testing site for development use: |
| 59 | |
| 60 | ---- |
| 61 | java -jar gerrit-war/target/gerrit-*.war init -d ../test_site |
| 62 | ---- |
| 63 | |
| 64 | Accept defaults by pressing Enter until 'init' completes, or add |
| 65 | the '\--batch' command line option to avoid them entirely. It is |
| 66 | recommended to change the listen addresses from '*' to 'localhost' to |
| 67 | prevent outside connections from contacting the development instance. |
| 68 | |
| 69 | The daemon will automatically start in the background and a web |
| 70 | browser will launch to the start page, enabling login via OpenID. |
| 71 | |
| 72 | Shutdown the daemon after registering the administrator account |
| 73 | through the web interface: |
| 74 | |
| 75 | ---- |
| 76 | ../test_site/bin/gerrit.sh stop |
| 77 | ---- |
| 78 | |
| 79 | |
| 80 | Testing |
| 81 | ------- |
| 82 | |
| 83 | Running the Daemon |
| 84 | ~~~~~~~~~~~~~~~~~~ |
| 85 | |
| 86 | The daemon can be directly launched from the build area, without |
| 87 | copying to the test site: |
| 88 | |
| 89 | ---- |
| 90 | java -jar gerrit-war/target/gerrit-*.war daemon -d ../test_site |
| 91 | ---- |
| 92 | |
| 93 | |
| 94 | Querying the Database |
| 95 | ~~~~~~~~~~~~~~~~~~~~~ |
| 96 | |
| 97 | The embedded H2 database can be queried and updated from the |
| 98 | command line. If the daemon is not currently running: |
| 99 | |
| 100 | ---- |
| 101 | java -jar gerrit-war/target/gerrit-*.war gsql -d ../test_site |
| 102 | ---- |
| 103 | |
| 104 | Or, if it is running and the database is in use, connect over SSH |
| 105 | using an administrator user account: |
| 106 | |
| 107 | ---- |
| 108 | ssh -p 29418 user@localhost gerrit gsql |
| 109 | ---- |
| 110 | |
| 111 | |
| 112 | Debugging JavaScript |
| 113 | ~~~~~~~~~~~~~~~~~~~~ |
| 114 | |
Shawn O. Pearce | 4d4afa7 | 2009-12-19 18:51:33 -0800 | [diff] [blame^] | 115 | When debugging browser specific issues use `-Dgwt.style=DETAILED` |
Shawn O. Pearce | 18f1f7f | 2009-12-16 11:32:39 -0800 | [diff] [blame] | 116 | so the resulting JavaScript more closely matches the Java sources. |
| 117 | This can be used to help narrow down what code line 30,400 in the |
| 118 | JavaScript happens to be. |
| 119 | |
| 120 | ---- |
Shawn O. Pearce | 4d4afa7 | 2009-12-19 18:51:33 -0800 | [diff] [blame^] | 121 | mvn package -Dgwt.style=DETAILED |
Shawn O. Pearce | 18f1f7f | 2009-12-16 11:32:39 -0800 | [diff] [blame] | 122 | ---- |
Shawn O. Pearce | 461c2cc | 2009-02-25 09:09:31 -0800 | [diff] [blame] | 123 | |
Shawn O. Pearce | 6ddb6ca | 2009-09-18 18:10:31 -0700 | [diff] [blame] | 124 | |
Shawn O. Pearce | 18f1f7f | 2009-12-16 11:32:39 -0800 | [diff] [blame] | 125 | Release Builds |
| 126 | -------------- |
Shawn O. Pearce | 8d2f184 | 2009-05-13 07:59:04 -0700 | [diff] [blame] | 127 | |
Shawn O. Pearce | 18f1f7f | 2009-12-16 11:32:39 -0800 | [diff] [blame] | 128 | To create a release build for a production server, or deployment |
| 129 | through the download site: |
Shawn O. Pearce | 8d2f184 | 2009-05-13 07:59:04 -0700 | [diff] [blame] | 130 | |
| 131 | ---- |
Shawn O. Pearce | d46db64 | 2009-12-18 14:47:55 -0800 | [diff] [blame] | 132 | ./tools/release.sh |
Shawn O. Pearce | 8d2f184 | 2009-05-13 07:59:04 -0700 | [diff] [blame] | 133 | ---- |
| 134 | |
Shawn O. Pearce | 06b48c3 | 2009-05-10 16:21:05 -0700 | [diff] [blame] | 135 | |
Shawn O. Pearce | d2b73db | 2009-01-09 11:55:47 -0800 | [diff] [blame] | 136 | Client-Server RPC |
| 137 | ----------------- |
| 138 | |
| 139 | The client-server RPC implementation is gwtjsonrpc, not the stock RPC |
| 140 | system that comes with GWT. This buys us automatic XSRF protection. |
| 141 | It also makes all of the messages readable and writable by any JSON |
| 142 | implementation, facilitating "mashups" and 3rd party clients. |
| 143 | |
Shawn O. Pearce | 18f1f7f | 2009-12-16 11:32:39 -0800 | [diff] [blame] | 144 | The programming API is virtually identical, except service interfaces |
| 145 | extend RemoteJsonService instead of RemoteService. |
Shawn O. Pearce | d2b73db | 2009-01-09 11:55:47 -0800 | [diff] [blame] | 146 | |
| 147 | |
| 148 | Why GWT? |
| 149 | -------- |
| 150 | |
| 151 | We like it. Plus we can write Java code once and run it both in |
Shawn O. Pearce | e2bd1b1 | 2009-08-20 11:08:32 -0700 | [diff] [blame] | 152 | the browser and on the server side. |
Shawn O. Pearce | 5500e69 | 2009-05-28 15:55:01 -0700 | [diff] [blame] | 153 | |
Shawn O. Pearce | 18f1f7f | 2009-12-16 11:32:39 -0800 | [diff] [blame] | 154 | |
| 155 | External Links |
| 156 | -------------- |
| 157 | |
| 158 | Google Web Toolkit: |
| 159 | |
| 160 | * http://code.google.com/webtoolkit/download.html[Download] |
| 161 | |
| 162 | Apache Maven: |
| 163 | |
| 164 | * http://maven.apache.org/download.html[Download] |
| 165 | * http://maven.apache.org/run-maven/index.html[Running] |
| 166 | |
| 167 | Apache SSHD: |
| 168 | |
| 169 | * http://mina.apache.org/sshd/[SSHD] |
| 170 | |
| 171 | H2: |
| 172 | |
| 173 | * http://www.h2database.com/[H2] |
| 174 | * http://www.h2database.com/html/grammar.html[SQL Reference] |
| 175 | |
| 176 | PostgreSQL: |
| 177 | |
| 178 | * http://www.postgresql.org/download/[Download] |
| 179 | * http://www.postgresql.org/docs/[Documentation] |
| 180 | |
| 181 | |
Shawn O. Pearce | 5500e69 | 2009-05-28 15:55:01 -0700 | [diff] [blame] | 182 | GERRIT |
| 183 | ------ |
| 184 | Part of link:index.html[Gerrit Code Review] |