summaryrefslogtreecommitdiffstats
path: root/Documentation/dev-readme.txt
blob: ee7d0ff43547403b9c370789e0848a63da1e8d56 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
Gerrit2 - Developer Setup
=========================

You need Apache Maven to compile the code, and a SQL database
to house the Gerrit2 metadata.  PostgreSQL is currently the only
supported database.

To create a new client workspace:

====
  mkdir gerrit2
  cd gerrit2
  repo init -u git://android.git.kernel.org/tools/manifest.git
====

Important Links
---------------

Google Web Toolkit:

* http://code.google.com/webtoolkit/download.html[Download]
* http://code.google.com/docreader/#p=google-web-toolkit-doc-1-5[Developer's Guide]

Apache Maven:

* http://maven.apache.org/download.html[Download]
* http://maven.apache.org/run-maven/index.html[Running Maven]

PostgreSQL:

* http://www.postgresql.org/docs/[Documentation]


Setting up the Database
-----------------------

You'll need to configure your development workspace to use a database
gwtorm supports (or add the necessary dialect support to gwtorm,
and then configure your workspace anyway).

====
  cd src/main/java
  cp GerritServer.properties_example GerritServer.properties
====

Now edit GerritServer.properties to uncomment the database you are
going to use, and possibly update properties such as "user" and
"password" to reflect the actual connection information used.

====
  # PostgreSQL
  database.driver = org.postgresql.Driver
  database.url = jdbc:postgresql:reviewdb
  database.user = gerrit2
  database.password = letmein
====

PostgreSQL Setup
~~~~~~~~~~~~~~~~

Create the JDBC user as a normal user (no superuser access) and
assign it an encrypted password:

====
  createuser -A -D -P -E gerrit2
====

Create the database listed in your GerritServer.properties and set
the JDBC user as the owner of that database:

====
  createdb -E UTF-8 -O gerrit2 reviewdb
====


Configuring Eclipse
-------------------

If you want to use the Eclipse IDE for development work, please
see link:dev-eclipse.html[Eclipse Setup] for more details on how
to configure your workspace.


Dependencies
------------

You need to ensure all dependencies have been installed into your
local maven repository if Gerrit is relying on snapshots and not
release versions of them.

====
  (cd ../jgit/jgit-maven/jgit && mvn clean install)
  (cd ../mina_sshd && mvn clean install)
====


Building
--------

From the command line:

====
  mvn package
====

Output WAR will be placed in:

====
  target/gerrit-*.war
====


Client-Server RPC
-----------------

The client-server RPC implementation is gwtjsonrpc, not the stock RPC
system that comes with GWT.  This buys us automatic XSRF protection.
It also makes all of the messages readable and writable by any JSON
implementation, facilitating "mashups" and 3rd party clients.

The programming API is virtually identical (you just need to extend
RemoteJsonService instead of RemoteService).


Why GWT?
--------

We like it.  Plus we can write Java code once and run it both in
the browser and on the server side.  This will be very useful as
we implement offline support in Gerrit.