blob: 7bacbbd3cb8aaf46f03c40616fb22b6c3570c75e [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
Shawn O. Pearce18f1f7f2009-12-16 11:32:39 -08004Apache Maven is needed to compile the code, and a SQL database
5to house 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
Shawn O. Pearce18f1f7f2009-12-16 11:32:39 -08008Get the Source
9--------------
Shawn O. Pearced2b73db2009-01-09 11:55:47 -080010
Shawn O. Pearce18f1f7f2009-12-16 11:32:39 -080011Create a new client workspace:
Shawn O. Pearced2b73db2009-01-09 11:55:47 -080012
Shawn O. Pearce18f1f7f2009-12-16 11:32:39 -080013----
Shawn O. Pearce54765512012-02-13 18:53:49 -080014 git clone https://gerrit.googlesource.com/gerrit
Shawn O. Pearce18f1f7f2009-12-16 11:32:39 -080015 cd gerrit
16----
Shawn O. Pearced2b73db2009-01-09 11:55:47 -080017
18
19Configuring Eclipse
20-------------------
21
Shawn O. Pearce18f1f7f2009-12-16 11:32:39 -080022To use the Eclipse IDE for development, please see
23link:dev-eclipse.html[Eclipse Setup] for more details on how to
24configure the workspace with the Maven build scripts.
Shawn O. Pearced2b73db2009-01-09 11:55:47 -080025
26
Shawn O. Pearce18f1f7f2009-12-16 11:32:39 -080027[[build]]
Shawn O. Pearced2b73db2009-01-09 11:55:47 -080028Building
29--------
30
31From the command line:
32
Shawn O. Pearce18f1f7f2009-12-16 11:32:39 -080033----
34 mvn package
35----
Shawn O. Pearced2b73db2009-01-09 11:55:47 -080036
Shawn O. Pearce18f1f7f2009-12-16 11:32:39 -080037Output executable WAR will be placed in:
Shawn O. Pearced2b73db2009-01-09 11:55:47 -080038
Shawn O. Pearce18f1f7f2009-12-16 11:32:39 -080039----
Shawn O. Pearce44671f52009-11-07 12:55:26 -080040 gerrit-war/target/gerrit-*.war
Shawn O. Pearce18f1f7f2009-12-16 11:32:39 -080041----
Shawn O. Pearced2b73db2009-01-09 11:55:47 -080042
Shawn O. Pearce18f1f7f2009-12-16 11:32:39 -080043Mac OS X
44~~~~~~~~
45On Mac OS X ensure "Java For Mac OS X 10.5 Upate 4" (or later) has
46been installed, and that `JAVA_HOME` is set to
47"/System/Library/Frameworks/JavaVM.framework/Versions/1.6/Home".
48Check the installed version by running `java -version` and looking
49for 'build 1.6.0_13-b03-211'. Versions of Java 6 prior to this
50version crash during the build due to a bug in the JIT compiler.
Shawn O. Pearce461c2cc2009-02-25 09:09:31 -080051
Shawn O. Pearce18f1f7f2009-12-16 11:32:39 -080052
53[[init]]
54Site Initialization
55-------------------
56
57After compiling (above), run Gerrit's 'init' command to create a
58testing site for development use:
59
60----
61 java -jar gerrit-war/target/gerrit-*.war init -d ../test_site
62----
63
64Accept defaults by pressing Enter until 'init' completes, or add
65the '\--batch' command line option to avoid them entirely. It is
66recommended to change the listen addresses from '*' to 'localhost' to
67prevent outside connections from contacting the development instance.
68
69The daemon will automatically start in the background and a web
70browser will launch to the start page, enabling login via OpenID.
71
72Shutdown the daemon after registering the administrator account
73through the web interface:
74
75----
76 ../test_site/bin/gerrit.sh stop
77----
78
79
80Testing
81-------
82
Edwin Kempin4a3fc3f2013-02-27 15:18:43 +010083[[run-acceptance-tests]]
84Running the Acceptance Tests
85~~~~~~~~~~~~~~~~~~~~~~~~~~~~
86
87Gerrit has a set of integration tests that test the Gerrit daemon via
88REST, SSH and the git protocol.
89
90A new review site is created for each test and the Gerrit daemon is
91started on that site. When the test has finished the Gerrit daemon is
92shutdown.
93
94Since the acceptance tests are too expensive to run every time
95Gerrit is built, they are only executed during the Maven verify phase
96if the Maven profile `acceptance` is enabled.
97
98To execute the acceptance tests run:
99
100----
101 mvn clean verify -Pacceptance
102----
103
Shawn O. Pearce18f1f7f2009-12-16 11:32:39 -0800104Running the Daemon
105~~~~~~~~~~~~~~~~~~
106
107The daemon can be directly launched from the build area, without
108copying to the test site:
109
110----
111 java -jar gerrit-war/target/gerrit-*.war daemon -d ../test_site
112----
113
114
115Querying the Database
116~~~~~~~~~~~~~~~~~~~~~
117
118The embedded H2 database can be queried and updated from the
119command line. If the daemon is not currently running:
120
121----
122 java -jar gerrit-war/target/gerrit-*.war gsql -d ../test_site
123----
124
125Or, if it is running and the database is in use, connect over SSH
126using an administrator user account:
127
128----
129 ssh -p 29418 user@localhost gerrit gsql
130----
131
132
133Debugging JavaScript
134~~~~~~~~~~~~~~~~~~~~
135
Shawn Pearced07a6222013-03-21 00:11:45 -0700136When debugging browser specific issues add `?dbg=1` to the URL so the
137resulting JavaScript more closely matches the Java sources. The debug
138pages use the GWT pretty format, where function and variable names
139match the Java sources.
140
141----
142 http://localhost:8080/?dbg=1
143----
144
145To use the GWT DETAILED style the package must be recompiled and
146`?dbg=1` must be omitted from the URL:
Shawn O. Pearce18f1f7f2009-12-16 11:32:39 -0800147
148----
Shawn O. Pearce4d4afa72009-12-19 18:51:33 -0800149 mvn package -Dgwt.style=DETAILED
Shawn O. Pearce18f1f7f2009-12-16 11:32:39 -0800150----
Shawn O. Pearce461c2cc2009-02-25 09:09:31 -0800151
Shawn O. Pearce6ddb6ca2009-09-18 18:10:31 -0700152
Shawn O. Pearce18f1f7f2009-12-16 11:32:39 -0800153Release Builds
154--------------
Shawn O. Pearce8d2f1842009-05-13 07:59:04 -0700155
Shawn O. Pearce18f1f7f2009-12-16 11:32:39 -0800156To create a release build for a production server, or deployment
157through the download site:
Shawn O. Pearce8d2f1842009-05-13 07:59:04 -0700158
159----
Shawn O. Pearced46db642009-12-18 14:47:55 -0800160 ./tools/release.sh
Shawn O. Pearce8d2f1842009-05-13 07:59:04 -0700161----
162
Shawn O. Pearcee6fc72f2010-02-22 09:31:18 -0800163If AsciiDoc isn't installed or is otherwise unavailable, the WAR
164can still be built without the embedded documentation by passing
165an additional flag:
166
167----
168 ./tools/release.sh --without-documentation
169----
170
Shawn O. Pearce06b48c32009-05-10 16:21:05 -0700171
Shawn O. Pearced2b73db2009-01-09 11:55:47 -0800172Client-Server RPC
173-----------------
174
175The client-server RPC implementation is gwtjsonrpc, not the stock RPC
176system that comes with GWT. This buys us automatic XSRF protection.
177It also makes all of the messages readable and writable by any JSON
178implementation, facilitating "mashups" and 3rd party clients.
179
Shawn O. Pearce18f1f7f2009-12-16 11:32:39 -0800180The programming API is virtually identical, except service interfaces
181extend RemoteJsonService instead of RemoteService.
Shawn O. Pearced2b73db2009-01-09 11:55:47 -0800182
183
184Why GWT?
185--------
186
187We like it. Plus we can write Java code once and run it both in
Shawn O. Pearcee2bd1b12009-08-20 11:08:32 -0700188the browser and on the server side.
Shawn O. Pearce5500e692009-05-28 15:55:01 -0700189
Shawn O. Pearce18f1f7f2009-12-16 11:32:39 -0800190
191External Links
192--------------
193
194Google Web Toolkit:
195
196* http://code.google.com/webtoolkit/download.html[Download]
197
198Apache Maven:
199
200* http://maven.apache.org/download.html[Download]
201* http://maven.apache.org/run-maven/index.html[Running]
202
203Apache SSHD:
204
205* http://mina.apache.org/sshd/[SSHD]
206
207H2:
208
209* http://www.h2database.com/[H2]
210* http://www.h2database.com/html/grammar.html[SQL Reference]
211
212PostgreSQL:
213
214* http://www.postgresql.org/download/[Download]
215* http://www.postgresql.org/docs/[Documentation]
216
217
Shawn O. Pearce5500e692009-05-28 15:55:01 -0700218GERRIT
219------
220Part of link:index.html[Gerrit Code Review]