| 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 | |
| David Ostrovsky | dcee572 | 2013-05-15 00:10:55 +0200 | [diff] [blame^] | 4 | Facebook Buck is needed to compile the code, and an SQL database to |
| 5 | 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 | |
| David Pursehouse | fec5879 | 2013-05-10 15:34:02 +0100 | [diff] [blame] | 8 | |
| 9 | Getting the Source |
| 10 | ------------------ |
| Shawn O. Pearce | d2b73db | 2009-01-09 11:55:47 -0800 | [diff] [blame] | 11 | |
| Shawn O. Pearce | 18f1f7f | 2009-12-16 11:32:39 -0800 | [diff] [blame] | 12 | Create a new client workspace: |
| Shawn O. Pearce | d2b73db | 2009-01-09 11:55:47 -0800 | [diff] [blame] | 13 | |
| Shawn O. Pearce | 18f1f7f | 2009-12-16 11:32:39 -0800 | [diff] [blame] | 14 | ---- |
| David Pursehouse | 4f2be53 | 2013-05-09 13:47:17 +0100 | [diff] [blame] | 15 | git clone --recursive https://gerrit.googlesource.com/gerrit |
| Shawn O. Pearce | 18f1f7f | 2009-12-16 11:32:39 -0800 | [diff] [blame] | 16 | cd gerrit |
| 17 | ---- |
| Shawn O. Pearce | d2b73db | 2009-01-09 11:55:47 -0800 | [diff] [blame] | 18 | |
| David Pursehouse | 4f2be53 | 2013-05-09 13:47:17 +0100 | [diff] [blame] | 19 | The `--recursive` option is needed on `git clone` to ensure that |
| 20 | the core plugins, which are included as git submodules, are also |
| 21 | cloned. |
| Shawn O. Pearce | d2b73db | 2009-01-09 11:55:47 -0800 | [diff] [blame] | 22 | |
| David Pursehouse | fec5879 | 2013-05-10 15:34:02 +0100 | [diff] [blame] | 23 | |
| David Pursehouse | 6de7ee2 | 2013-05-20 11:08:51 +0900 | [diff] [blame] | 24 | Compiling |
| 25 | --------- |
| 26 | |
| David Ostrovsky | dcee572 | 2013-05-15 00:10:55 +0200 | [diff] [blame^] | 27 | For details on how to build the source code Buck, refer to: |
| David Pursehouse | 6de7ee2 | 2013-05-20 11:08:51 +0900 | [diff] [blame] | 28 | |
| David Ostrovsky | dcee572 | 2013-05-15 00:10:55 +0200 | [diff] [blame^] | 29 | 1. link:dev-buck.html#build[Building on the command line with Buck] |
| David Pursehouse | 6de7ee2 | 2013-05-20 11:08:51 +0900 | [diff] [blame] | 30 | |
| 31 | |
| Shawn O. Pearce | d2b73db | 2009-01-09 11:55:47 -0800 | [diff] [blame] | 32 | Configuring Eclipse |
| 33 | ------------------- |
| 34 | |
| Shawn O. Pearce | 18f1f7f | 2009-12-16 11:32:39 -0800 | [diff] [blame] | 35 | To use the Eclipse IDE for development, please see |
| David Pursehouse | fec5879 | 2013-05-10 15:34:02 +0100 | [diff] [blame] | 36 | link:dev-eclipse.html[Eclipse Setup]. |
| Shawn O. Pearce | d2b73db | 2009-01-09 11:55:47 -0800 | [diff] [blame] | 37 | |
| David Ostrovsky | dcee572 | 2013-05-15 00:10:55 +0200 | [diff] [blame^] | 38 | For details on how to configure the Eclipse workspace with Buck: |
| David Pursehouse | 5861a9a | 2013-05-15 10:25:19 +0900 | [diff] [blame] | 39 | |
| David Ostrovsky | dcee572 | 2013-05-15 00:10:55 +0200 | [diff] [blame^] | 40 | 1. link:dev-buck.html#eclipse[Eclipse integration with Buck] |
| Shawn O. Pearce | d2b73db | 2009-01-09 11:55:47 -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 |
| David Pursehouse | fec5879 | 2013-05-10 15:34:02 +0100 | [diff] [blame] | 44 | -------- |
| 45 | |
| Shawn O. Pearce | 18f1f7f | 2009-12-16 11:32:39 -0800 | [diff] [blame] | 46 | On Mac OS X ensure "Java For Mac OS X 10.5 Upate 4" (or later) has |
| 47 | been installed, and that `JAVA_HOME` is set to |
| 48 | "/System/Library/Frameworks/JavaVM.framework/Versions/1.6/Home". |
| 49 | Check the installed version by running `java -version` and looking |
| 50 | for 'build 1.6.0_13-b03-211'. Versions of Java 6 prior to this |
| 51 | 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] | 52 | |
| Shawn O. Pearce | 18f1f7f | 2009-12-16 11:32:39 -0800 | [diff] [blame] | 53 | |
| 54 | [[init]] |
| 55 | Site Initialization |
| 56 | ------------------- |
| 57 | |
| 58 | After compiling (above), run Gerrit's 'init' command to create a |
| 59 | testing site for development use: |
| 60 | |
| 61 | ---- |
| 62 | java -jar gerrit-war/target/gerrit-*.war init -d ../test_site |
| 63 | ---- |
| 64 | |
| 65 | Accept defaults by pressing Enter until 'init' completes, or add |
| 66 | the '\--batch' command line option to avoid them entirely. It is |
| 67 | recommended to change the listen addresses from '*' to 'localhost' to |
| 68 | prevent outside connections from contacting the development instance. |
| 69 | |
| 70 | The daemon will automatically start in the background and a web |
| 71 | browser will launch to the start page, enabling login via OpenID. |
| 72 | |
| 73 | Shutdown the daemon after registering the administrator account |
| 74 | through the web interface: |
| 75 | |
| 76 | ---- |
| 77 | ../test_site/bin/gerrit.sh stop |
| 78 | ---- |
| 79 | |
| 80 | |
| 81 | Testing |
| 82 | ------- |
| 83 | |
| David Pursehouse | fec5879 | 2013-05-10 15:34:02 +0100 | [diff] [blame] | 84 | |
| David Pursehouse | 5861a9a | 2013-05-15 10:25:19 +0900 | [diff] [blame] | 85 | [[tests]] |
| Edwin Kempin | 4a3fc3f | 2013-02-27 15:18:43 +0100 | [diff] [blame] | 86 | Running the Acceptance Tests |
| 87 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 88 | |
| 89 | Gerrit has a set of integration tests that test the Gerrit daemon via |
| 90 | REST, SSH and the git protocol. |
| 91 | |
| 92 | A new review site is created for each test and the Gerrit daemon is |
| 93 | started on that site. When the test has finished the Gerrit daemon is |
| 94 | shutdown. |
| 95 | |
| David Ostrovsky | dcee572 | 2013-05-15 00:10:55 +0200 | [diff] [blame^] | 96 | For instructions on running the integration tests with Buck, |
| David Pursehouse | 5861a9a | 2013-05-15 10:25:19 +0900 | [diff] [blame] | 97 | please refer to: |
| 98 | |
| David Ostrovsky | dcee572 | 2013-05-15 00:10:55 +0200 | [diff] [blame^] | 99 | 1. link:dev-buck.html#tests[Running integration tests with Buck] |
| Edwin Kempin | 4a3fc3f | 2013-02-27 15:18:43 +0100 | [diff] [blame] | 100 | |
| Edwin Kempin | 4a3fc3f | 2013-02-27 15:18:43 +0100 | [diff] [blame] | 101 | |
| Shawn O. Pearce | 18f1f7f | 2009-12-16 11:32:39 -0800 | [diff] [blame] | 102 | Running the Daemon |
| 103 | ~~~~~~~~~~~~~~~~~~ |
| 104 | |
| 105 | The daemon can be directly launched from the build area, without |
| 106 | copying to the test site: |
| 107 | |
| 108 | ---- |
| 109 | java -jar gerrit-war/target/gerrit-*.war daemon -d ../test_site |
| 110 | ---- |
| 111 | |
| 112 | |
| 113 | Querying the Database |
| 114 | ~~~~~~~~~~~~~~~~~~~~~ |
| 115 | |
| 116 | The embedded H2 database can be queried and updated from the |
| 117 | command line. If the daemon is not currently running: |
| 118 | |
| 119 | ---- |
| 120 | java -jar gerrit-war/target/gerrit-*.war gsql -d ../test_site |
| 121 | ---- |
| 122 | |
| 123 | Or, if it is running and the database is in use, connect over SSH |
| 124 | using an administrator user account: |
| 125 | |
| 126 | ---- |
| 127 | ssh -p 29418 user@localhost gerrit gsql |
| 128 | ---- |
| 129 | |
| 130 | |
| Edwin Kempin | 57fa179 | 2013-03-27 10:43:41 +0100 | [diff] [blame] | 131 | [[debug-javascript]] |
| Shawn O. Pearce | 18f1f7f | 2009-12-16 11:32:39 -0800 | [diff] [blame] | 132 | Debugging JavaScript |
| 133 | ~~~~~~~~~~~~~~~~~~~~ |
| 134 | |
| Shawn Pearce | d07a622 | 2013-03-21 00:11:45 -0700 | [diff] [blame] | 135 | When debugging browser specific issues add `?dbg=1` to the URL so the |
| 136 | resulting JavaScript more closely matches the Java sources. The debug |
| 137 | pages use the GWT pretty format, where function and variable names |
| 138 | match the Java sources. |
| 139 | |
| 140 | ---- |
| 141 | http://localhost:8080/?dbg=1 |
| 142 | ---- |
| 143 | |
| 144 | To use the GWT DETAILED style the package must be recompiled and |
| 145 | `?dbg=1` must be omitted from the URL: |
| Shawn O. Pearce | 18f1f7f | 2009-12-16 11:32:39 -0800 | [diff] [blame] | 146 | |
| 147 | ---- |
| Shawn O. Pearce | 4d4afa7 | 2009-12-19 18:51:33 -0800 | [diff] [blame] | 148 | mvn package -Dgwt.style=DETAILED |
| Shawn O. Pearce | 18f1f7f | 2009-12-16 11:32:39 -0800 | [diff] [blame] | 149 | ---- |
| Shawn O. Pearce | 461c2cc | 2009-02-25 09:09:31 -0800 | [diff] [blame] | 150 | |
| Shawn O. Pearce | 6ddb6ca | 2009-09-18 18:10:31 -0700 | [diff] [blame] | 151 | |
| Shawn O. Pearce | 18f1f7f | 2009-12-16 11:32:39 -0800 | [diff] [blame] | 152 | Release Builds |
| 153 | -------------- |
| Shawn O. Pearce | 8d2f184 | 2009-05-13 07:59:04 -0700 | [diff] [blame] | 154 | |
| Shawn O. Pearce | 18f1f7f | 2009-12-16 11:32:39 -0800 | [diff] [blame] | 155 | To create a release build for a production server, or deployment |
| 156 | through the download site: |
| Shawn O. Pearce | 8d2f184 | 2009-05-13 07:59:04 -0700 | [diff] [blame] | 157 | |
| 158 | ---- |
| Shawn O. Pearce | d46db64 | 2009-12-18 14:47:55 -0800 | [diff] [blame] | 159 | ./tools/release.sh |
| Shawn O. Pearce | 8d2f184 | 2009-05-13 07:59:04 -0700 | [diff] [blame] | 160 | ---- |
| 161 | |
| Shawn O. Pearce | e6fc72f | 2010-02-22 09:31:18 -0800 | [diff] [blame] | 162 | If AsciiDoc isn't installed or is otherwise unavailable, the WAR |
| 163 | can still be built without the embedded documentation by passing |
| 164 | an additional flag: |
| 165 | |
| 166 | ---- |
| 167 | ./tools/release.sh --without-documentation |
| 168 | ---- |
| 169 | |
| Shawn O. Pearce | 06b48c3 | 2009-05-10 16:21:05 -0700 | [diff] [blame] | 170 | |
| Shawn O. Pearce | d2b73db | 2009-01-09 11:55:47 -0800 | [diff] [blame] | 171 | Client-Server RPC |
| 172 | ----------------- |
| 173 | |
| 174 | The client-server RPC implementation is gwtjsonrpc, not the stock RPC |
| 175 | system that comes with GWT. This buys us automatic XSRF protection. |
| 176 | It also makes all of the messages readable and writable by any JSON |
| 177 | implementation, facilitating "mashups" and 3rd party clients. |
| 178 | |
| Shawn O. Pearce | 18f1f7f | 2009-12-16 11:32:39 -0800 | [diff] [blame] | 179 | The programming API is virtually identical, except service interfaces |
| 180 | extend RemoteJsonService instead of RemoteService. |
| Shawn O. Pearce | d2b73db | 2009-01-09 11:55:47 -0800 | [diff] [blame] | 181 | |
| 182 | |
| 183 | Why GWT? |
| 184 | -------- |
| 185 | |
| 186 | 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] | 187 | the browser and on the server side. |
| Shawn O. Pearce | 5500e69 | 2009-05-28 15:55:01 -0700 | [diff] [blame] | 188 | |
| Shawn O. Pearce | 18f1f7f | 2009-12-16 11:32:39 -0800 | [diff] [blame] | 189 | |
| 190 | External Links |
| 191 | -------------- |
| 192 | |
| 193 | Google Web Toolkit: |
| 194 | |
| 195 | * http://code.google.com/webtoolkit/download.html[Download] |
| 196 | |
| Shawn O. Pearce | 18f1f7f | 2009-12-16 11:32:39 -0800 | [diff] [blame] | 197 | Apache SSHD: |
| 198 | |
| 199 | * http://mina.apache.org/sshd/[SSHD] |
| 200 | |
| 201 | H2: |
| 202 | |
| 203 | * http://www.h2database.com/[H2] |
| 204 | * http://www.h2database.com/html/grammar.html[SQL Reference] |
| 205 | |
| 206 | PostgreSQL: |
| 207 | |
| 208 | * http://www.postgresql.org/download/[Download] |
| 209 | * http://www.postgresql.org/docs/[Documentation] |
| 210 | |
| 211 | |
| Shawn O. Pearce | 5500e69 | 2009-05-28 15:55:01 -0700 | [diff] [blame] | 212 | GERRIT |
| 213 | ------ |
| 214 | Part of link:index.html[Gerrit Code Review] |