blob: 43df72b6d9c9fe6ddb9cd303972937e58f5c1daa [file] [log] [blame]
Shawn O. Pearcee31d02c2009-12-08 12:21:37 -08001Gerrit Code Review - Developer Setup
2====================================
Shawn O. Pearced2b73db2009-01-09 11:55:47 -08003
David Ostrovskydcee5722013-05-15 00:10:55 +02004Facebook Buck is needed to compile the code, and an SQL database to
5house the review metadata. H2 is recommended for development
6databases, as it requires no external server process.
Shawn O. Pearced2b73db2009-01-09 11:55:47 -08007
David Pursehousefec58792013-05-10 15:34:02 +01008
9Getting the Source
10------------------
Shawn O. Pearced2b73db2009-01-09 11:55:47 -080011
Shawn O. Pearce18f1f7f2009-12-16 11:32:39 -080012Create a new client workspace:
Shawn O. Pearced2b73db2009-01-09 11:55:47 -080013
Shawn O. Pearce18f1f7f2009-12-16 11:32:39 -080014----
David Pursehouse4f2be532013-05-09 13:47:17 +010015 git clone --recursive https://gerrit.googlesource.com/gerrit
Shawn O. Pearce18f1f7f2009-12-16 11:32:39 -080016 cd gerrit
17----
Shawn O. Pearced2b73db2009-01-09 11:55:47 -080018
David Pursehouse4f2be532013-05-09 13:47:17 +010019The `--recursive` option is needed on `git clone` to ensure that
20the core plugins, which are included as git submodules, are also
21cloned.
Shawn O. Pearced2b73db2009-01-09 11:55:47 -080022
David Pursehousefec58792013-05-10 15:34:02 +010023
David Pursehouse6de7ee22013-05-20 11:08:51 +090024Compiling
25---------
26
David Ostrovskydcee5722013-05-15 00:10:55 +020027For details on how to build the source code Buck, refer to:
David Pursehouse6de7ee22013-05-20 11:08:51 +090028
David Ostrovskydcee5722013-05-15 00:10:55 +0200291. link:dev-buck.html#build[Building on the command line with Buck]
David Pursehouse6de7ee22013-05-20 11:08:51 +090030
31
Shawn O. Pearced2b73db2009-01-09 11:55:47 -080032Configuring Eclipse
33-------------------
34
Shawn O. Pearce18f1f7f2009-12-16 11:32:39 -080035To use the Eclipse IDE for development, please see
David Pursehousefec58792013-05-10 15:34:02 +010036link:dev-eclipse.html[Eclipse Setup].
Shawn O. Pearced2b73db2009-01-09 11:55:47 -080037
David Ostrovskydcee5722013-05-15 00:10:55 +020038For details on how to configure the Eclipse workspace with Buck:
David Pursehouse5861a9a2013-05-15 10:25:19 +090039
David Ostrovskydcee5722013-05-15 00:10:55 +0200401. link:dev-buck.html#eclipse[Eclipse integration with Buck]
Shawn O. Pearced2b73db2009-01-09 11:55:47 -080041
Shawn O. Pearced2b73db2009-01-09 11:55:47 -080042
Shawn O. Pearce18f1f7f2009-12-16 11:32:39 -080043Mac OS X
David Pursehousefec58792013-05-10 15:34:02 +010044--------
45
Shawn O. Pearce18f1f7f2009-12-16 11:32:39 -080046On Mac OS X ensure "Java For Mac OS X 10.5 Upate 4" (or later) has
47been installed, and that `JAVA_HOME` is set to
48"/System/Library/Frameworks/JavaVM.framework/Versions/1.6/Home".
49Check the installed version by running `java -version` and looking
50for 'build 1.6.0_13-b03-211'. Versions of Java 6 prior to this
51version crash during the build due to a bug in the JIT compiler.
Shawn O. Pearce461c2cc2009-02-25 09:09:31 -080052
Shawn O. Pearce18f1f7f2009-12-16 11:32:39 -080053
54[[init]]
55Site Initialization
56-------------------
57
58After compiling (above), run Gerrit's 'init' command to create a
59testing site for development use:
60
61----
62 java -jar gerrit-war/target/gerrit-*.war init -d ../test_site
63----
64
65Accept defaults by pressing Enter until 'init' completes, or add
66the '\--batch' command line option to avoid them entirely. It is
67recommended to change the listen addresses from '*' to 'localhost' to
68prevent outside connections from contacting the development instance.
69
70The daemon will automatically start in the background and a web
71browser will launch to the start page, enabling login via OpenID.
72
73Shutdown the daemon after registering the administrator account
74through the web interface:
75
76----
77 ../test_site/bin/gerrit.sh stop
78----
79
80
81Testing
82-------
83
David Pursehousefec58792013-05-10 15:34:02 +010084
David Pursehouse5861a9a2013-05-15 10:25:19 +090085[[tests]]
Edwin Kempin4a3fc3f2013-02-27 15:18:43 +010086Running the Acceptance Tests
87~~~~~~~~~~~~~~~~~~~~~~~~~~~~
88
89Gerrit has a set of integration tests that test the Gerrit daemon via
90REST, SSH and the git protocol.
91
92A new review site is created for each test and the Gerrit daemon is
93started on that site. When the test has finished the Gerrit daemon is
94shutdown.
95
David Ostrovskydcee5722013-05-15 00:10:55 +020096For instructions on running the integration tests with Buck,
David Pursehouse5861a9a2013-05-15 10:25:19 +090097please refer to:
98
David Ostrovskydcee5722013-05-15 00:10:55 +0200991. link:dev-buck.html#tests[Running integration tests with Buck]
Edwin Kempin4a3fc3f2013-02-27 15:18:43 +0100100
Edwin Kempin4a3fc3f2013-02-27 15:18:43 +0100101
Shawn O. Pearce18f1f7f2009-12-16 11:32:39 -0800102Running the Daemon
103~~~~~~~~~~~~~~~~~~
104
105The daemon can be directly launched from the build area, without
106copying to the test site:
107
108----
109 java -jar gerrit-war/target/gerrit-*.war daemon -d ../test_site
110----
111
112
113Querying the Database
114~~~~~~~~~~~~~~~~~~~~~
115
116The embedded H2 database can be queried and updated from the
117command line. If the daemon is not currently running:
118
119----
120 java -jar gerrit-war/target/gerrit-*.war gsql -d ../test_site
121----
122
123Or, if it is running and the database is in use, connect over SSH
124using an administrator user account:
125
126----
127 ssh -p 29418 user@localhost gerrit gsql
128----
129
130
Edwin Kempin57fa1792013-03-27 10:43:41 +0100131[[debug-javascript]]
Shawn O. Pearce18f1f7f2009-12-16 11:32:39 -0800132Debugging JavaScript
133~~~~~~~~~~~~~~~~~~~~
134
Shawn Pearced07a6222013-03-21 00:11:45 -0700135When debugging browser specific issues add `?dbg=1` to the URL so the
136resulting JavaScript more closely matches the Java sources. The debug
137pages use the GWT pretty format, where function and variable names
138match the Java sources.
139
140----
141 http://localhost:8080/?dbg=1
142----
143
144To use the GWT DETAILED style the package must be recompiled and
145`?dbg=1` must be omitted from the URL:
Shawn O. Pearce18f1f7f2009-12-16 11:32:39 -0800146
147----
Shawn O. Pearce4d4afa72009-12-19 18:51:33 -0800148 mvn package -Dgwt.style=DETAILED
Shawn O. Pearce18f1f7f2009-12-16 11:32:39 -0800149----
Shawn O. Pearce461c2cc2009-02-25 09:09:31 -0800150
Shawn O. Pearce6ddb6ca2009-09-18 18:10:31 -0700151
Shawn O. Pearce18f1f7f2009-12-16 11:32:39 -0800152Release Builds
153--------------
Shawn O. Pearce8d2f1842009-05-13 07:59:04 -0700154
Shawn O. Pearce18f1f7f2009-12-16 11:32:39 -0800155To create a release build for a production server, or deployment
156through the download site:
Shawn O. Pearce8d2f1842009-05-13 07:59:04 -0700157
158----
Shawn O. Pearced46db642009-12-18 14:47:55 -0800159 ./tools/release.sh
Shawn O. Pearce8d2f1842009-05-13 07:59:04 -0700160----
161
Shawn O. Pearcee6fc72f2010-02-22 09:31:18 -0800162If AsciiDoc isn't installed or is otherwise unavailable, the WAR
163can still be built without the embedded documentation by passing
164an additional flag:
165
166----
167 ./tools/release.sh --without-documentation
168----
169
Shawn O. Pearce06b48c32009-05-10 16:21:05 -0700170
Shawn O. Pearced2b73db2009-01-09 11:55:47 -0800171Client-Server RPC
172-----------------
173
174The client-server RPC implementation is gwtjsonrpc, not the stock RPC
175system that comes with GWT. This buys us automatic XSRF protection.
176It also makes all of the messages readable and writable by any JSON
177implementation, facilitating "mashups" and 3rd party clients.
178
Shawn O. Pearce18f1f7f2009-12-16 11:32:39 -0800179The programming API is virtually identical, except service interfaces
180extend RemoteJsonService instead of RemoteService.
Shawn O. Pearced2b73db2009-01-09 11:55:47 -0800181
182
183Why GWT?
184--------
185
186We like it. Plus we can write Java code once and run it both in
Shawn O. Pearcee2bd1b12009-08-20 11:08:32 -0700187the browser and on the server side.
Shawn O. Pearce5500e692009-05-28 15:55:01 -0700188
Shawn O. Pearce18f1f7f2009-12-16 11:32:39 -0800189
190External Links
191--------------
192
193Google Web Toolkit:
194
195* http://code.google.com/webtoolkit/download.html[Download]
196
Shawn O. Pearce18f1f7f2009-12-16 11:32:39 -0800197Apache SSHD:
198
199* http://mina.apache.org/sshd/[SSHD]
200
201H2:
202
203* http://www.h2database.com/[H2]
204* http://www.h2database.com/html/grammar.html[SQL Reference]
205
206PostgreSQL:
207
208* http://www.postgresql.org/download/[Download]
209* http://www.postgresql.org/docs/[Documentation]
210
211
Shawn O. Pearce5500e692009-05-28 15:55:01 -0700212GERRIT
213------
214Part of link:index.html[Gerrit Code Review]