build.html 12.8 KB
Newer Older
1 2
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<!--
3
Copyright 2004-2010 H2 Group. Multiple-Licensed under the H2 License, Version 1.0,
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
and under the Eclipse Public License, Version 1.0
(http://h2database.com/html/license.html).
Initial Developer: H2 Group
-->
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head><meta http-equiv="Content-Type" content="text/html;charset=utf-8" /><title>
Build
</title><link rel="stylesheet" type="text/css" href="stylesheet.css" />
<!-- [search] { -->
<script type="text/javascript" src="navigation.js"></script>
</head><body onload="frameMe();">
<table class="content"><tr class="content"><td class="content"><div class="contentDiv">
<!-- } -->

<h1>Build</h1>
<a href="#portability">
    Portability</a><br />
<a href="#environment">
    Environment</a><br />
<a href="#building">
    Building the Software</a><br />
<a href="#build_targets">
    Build Targets</a><br />
<a href="#maven2">
    Using Maven 2</a><br />
<a href="#translating">
    Translating</a><br />
<a href="#providing_patches">
    Providing Patches</a><br />
33 34
<a href="#support">
    Reporting Problems or Requests</a><br />
35 36
<a href="#automated">
    Automated Build</a><br />
37 38
<a href="#railroad">
    Generating Railroad Diagrams</a><br />
39

Thomas Mueller's avatar
Thomas Mueller committed
40
<h2 id="portability">Portability</h2>
41 42 43 44
<p>
This database is written in Java and therefore works on many platforms.
It can also be compiled to a native executable using GCJ.
</p>
45 46 47 48
<p>
For Java 1.4, the jar file needs to be converted first using
<a href="http://retrotranslator.sourceforge.net">Retrotranslator</a>.
</p>
49

Thomas Mueller's avatar
Thomas Mueller committed
50
<h2 id="environment">Environment</h2>
51
<p>
Thomas Mueller's avatar
Thomas Mueller committed
52
A Java Runtime Environment (JRE) version 1.5 or higher is required to run this database.
53 54 55 56 57
</p>
<p>
To build the database executables, the following software stack was used.
Newer version or compatible software works too.
</p>
58
<ul><li>Mac OS X and Windows XP
Thomas Mueller's avatar
Thomas Mueller committed
59
</li><li><a href="http://java.sun.com/javase/downloads">Sun JDK Version 1.5 and 1.6</a>
60 61 62 63 64 65 66 67 68 69
</li><li><a href="http://www.eclipse.org">Eclipse Version 3.4</a>
</li><li>Eclipse Plugins:
    <a href="http://subclipse.tigris.org">Subclipse 1.4.6</a>,
    <a href="http://eclipse-cs.sourceforge.net">Eclipse Checkstyle Plug-in 4.4.2</a>,
    <a href="http://www.eclemma.org">EclEmma Java Code Coverage 1.3.0</a>
</li><li><a href="http://emma.sourceforge.net">Emma Java Code Coverage</a>
</li><li><a href="http://www.mozilla.com/firefox">Mozilla Firefox 3.0</a>
</li><li><a href="http://www.openoffice.org">OpenOffice 3.0</a>
</li><li><a href="http://nsis.sourceforge.net">NSIS 2.38</a> (Nullsoft Scriptable Install System)
</li><li><a href="http://maven.apache.org">Maven 2.0.9</a>
70 71
</li></ul>

Thomas Mueller's avatar
Thomas Mueller committed
72
<h2 id="building">Building the Software</h2>
73
<p>
Thomas Mueller's avatar
Thomas Mueller committed
74
You need to install a JDK, for example the Sun JDK version 1.5 or 1.6.
75 76 77
Ensure that Java binary directory is included in the <code>PATH</code> environment variable, and that
the environment variable <code>JAVA_HOME</code> points to your Java installation.
On the command line, go to the directory <code>h2</code> and execute the following command:
78
</p>
79
<pre>
80 81 82
build -?
</pre>
<p>
83
For Linux and OS X, use <code>./build.sh</code> instead of <code>build</code>.
84 85
</p>
<p>
86
You will get a list of targets. If you want to build the <code>jar</code> file, execute (Windows):
87
</p>
88
<pre>
89 90 91 92 93
build jar
</pre>

<h3>Switching the Source Code</h3>
<p>
Thomas Mueller's avatar
Thomas Mueller committed
94
By default the source code uses Java 1.5 features, however Java 1.6 is supported as well.
95
To switch the source code to the installed version of Java, run:
96
</p>
97
<pre>
98 99 100
build switchSource
</pre>

Thomas Mueller's avatar
Thomas Mueller committed
101
<h2 id="build_targets">Build Targets</h2>
102 103 104
<p>
The build system can generate smaller jar files as well. The following targets are currently supported:
</p>
105 106 107 108
<ul><li><code>jarClient</code>
    creates the file <code>h2client.jar</code>. This only contains the JDBC client.
</li><li><code>jarSmall</code>
    creates the file <code>h2small.jar</code>.
109
    This only contains the embedded database. Debug information is disabled.
110 111
</li><li><code>jarJaqu</code>
    creates the file <code>h2jaqu.jar</code>.
112
    This only contains the JaQu (Java Query) implementation. All other jar files do not include JaQu.
113
</li><li><code>javadocImpl</code> creates the Javadocs of the implementation.
114 115
</li></ul>
<p>
116
To create the file <code>h2client.jar</code>, go to the directory <code>h2</code> and execute the following command:
117
</p>
118
<pre>
119 120 121
build jarClient
</pre>

Thomas Mueller's avatar
Thomas Mueller committed
122
<h2 id="maven2">Using Maven 2</h2>
123 124 125 126 127
<h3>Using a Central Repository</h3>
<p>
You can include the database in your Maven 2 project as a dependency.
Example:
</p>
128
<pre>
129 130 131 132 133 134 135 136
&lt;dependency&gt;
    &lt;groupId&gt;com.h2database&lt;/groupId&gt;
    &lt;artifactId&gt;h2&lt;/artifactId&gt;
    &lt;version&gt;${version}&lt;/version&gt;
&lt;/dependency&gt;
</pre>
<p>
New versions of this database are first uploaded to http://hsql.sourceforge.net/m2-repo/ and then automatically
137
synchronized with the main Maven repository; however after a new release it may take a few hours before
138 139 140 141 142
they are available there.
</p>

<h3>Using Snapshot Version</h3>
<p>
143
To build a <code>h2-*-SNAPSHOT.jar</code> file and upload it the to the local Maven 2 repository, execute the following command:
144
</p>
145
<pre>
146 147 148 149 150
build mavenInstallLocal
</pre>
<p>
Afterwards, you can include the database in your Maven 2 project as a dependency:
</p>
151
<pre>
152 153 154 155 156 157 158
&lt;dependency&gt;
    &lt;groupId&gt;com.h2database&lt;/groupId&gt;
    &lt;artifactId&gt;h2&lt;/artifactId&gt;
    &lt;version&gt;1.0-SNAPSHOT&lt;/version&gt;
&lt;/dependency&gt;
</pre>

Thomas Mueller's avatar
Thomas Mueller committed
159
<h2 id="translating">Translating</h2>
160 161 162 163
<p>
The translation of this software is split into the following parts:
</p>
<ul>
164 165 166
<li>H2 Console: <code>src/main/org/h2/server/web/res/_text_*.properties</code>
</li><li>Error messages: <code>src/main/org/h2/res/_messages_*.properties</code>
</li><li>Web site: <code>src/docsrc/text/_docs_*.utf8.txt</code>
167 168
</li></ul>
<p>
169
To translate the H2 Console, start it and select Preferences / Translate.
170 171 172
The conversion between UTF-8 and Java encoding (using the <code>\u</code> syntax),
as well as the HTML entities (<code>&amp;#..;</code>)
is automated by running the tool <code>PropertiesToUTF8</code>.
173
The web site translation is automated as well,
174
using <code>build docs</code>.
175 176
</p>

Thomas Mueller's avatar
Thomas Mueller committed
177
<h2 id="providing_patches">Providing Patches</h2>
178 179 180
<p>
If you like to provide patches, please consider the following guidelines to simplify merging them:
</p>
181
<ul><li>Only use Java 1.5 features (do not use Java 1.6) (see <a href="#environment">Environment</a>).
182 183
</li><li>Follow the coding style used in the project, and use Checkstyle (see above) to verify.
    For example, do not use tabs (use spaces instead).
184
    The checkstyle configuration is in <code>src/installer/checkstyle.xml</code>.
Thomas Mueller's avatar
Thomas Mueller committed
185 186 187
</li><li>A template of the Eclipse settings are in
    <code>src/installer/eclipse.settings/*</code>. If you want to use them,
    you need to copy them to the <code>.settings</code> directory.
Thomas Mueller's avatar
Thomas Mueller committed
188
    The formatting options (<code>eclipseCodeStyle</code>) are also included.
189
</li><li>Please provide test cases and integrate them into the test suite.
190 191 192
    For Java level tests, see <code>src/test/org/h2/test/TestAll.java</code>.
    For SQL level tests, see <code>src/test/org/h2/test/test.in.txt</code> or
    <code>testSimple.in.txt</code>.
193 194
</li><li>The test cases should cover at least 90% of the changed and new code;
    use a code coverage tool to verify that (see above).
195
    or use the build target <code>coverage</code>.
196
</li><li>Verify that you did not break other features: run the test cases by executing
197 198
    <code>build test</code>.
</li><li>Provide end user documentation if required (<code>src/docsrc/html/*</code>).
199
</li><li>Document grammar changes in <code>src/docsrc/help/help.csv</code>
200 201 202
</li><li>Provide a change log entry (<code>src/docsrc/html/changelog.html</code>).
</li><li>Verify the spelling using <code>build spellcheck</code>. If required
    add the new words to <code>src/tools/org/h2/build/doc/dictionary.txt</code>.
203
</li><li>Run <code>src/installer/buildRelease</code> to find and fix formatting errors.
204 205 206
</li><li>Verify the formatting using <code>build docs</code> and
    <code>build javadoc</code>.
</li><li>Submit patches as <code>.patch</code> files (compressed if big).
207
    To create a patch using Eclipse, use Team / Create Patch.
208
</li></ul>
209 210 211 212 213 214
<p>
For legal reasons, patches need to be public in the form of an email to the
<a href="http://groups.google.com/group/h2-database">group</a>, or in the form
of an <a href="http://code.google.com/p/h2database/issues/list">issue report or attachment</a>.
Significant contributions need to include the following statement:
</p>
215
<p>
216 217 218
"I wrote the code, it's mine, and I'm contributing it to H2 for distribution
multiple-licensed under the H2 License, version 1.0, and under the
Eclipse Public License, version 1.0 (http://h2database.com/html/license.html)."
219
</p>
220

221 222
<h2 id="support">Reporting Problems or Requests</h2>
<p>
223
Please consider the following checklist if you have a question, want to report a problem,
224 225
or if  you have a feature request:
</p>
226
<ul><li>Feature requests are always welcome, even if the feature is already on the
227 228
    <a href="roadmap.html">roadmap</a>. Your mail will help prioritize feature requests.
    If you urgently need a feature, consider <a href="#providing_patches">providing a patch</a>.
229
</li><li>Before posting problems, check the
230
    <a href="faq.html">FAQ</a> and do a <a href="http://google.com">Google search</a>.
231
</li><li>When got an unexpected exception, please try the
232
    <a href="sourceError.html">Error Analyzer tool</a>. If this doesn't help,
233
    please report the problem, including the complete error message and stack trace,
234 235 236 237 238 239 240 241
    and the root cause stack trace(s).
</li><li>When sending source code, please use a public web clipboard such as
    <a href="http://pastebin.com">Pastebin</a>,
    <a href="http://cl1p.net">Cl1p</a>, or
    <a href="http://www.mysticpaste.com/new">Mystic Paste</a>
    to avoid formatting problems.
    Please keep test cases as simple and short as possible,
    but so that the problem can still be reproduced.
242 243
    As a template, use:
    <a href="http://h2database.googlecode.com/svn/trunk/h2/src/test/org/h2/samples/HelloWorld.java">HelloWorld.java</a>.
244 245 246 247 248 249 250 251
    Method that simply call other methods should be avoided,
    as well as unnecessary exception handling.
    Please use the JDBC API and no external tools or libraries.
    The test should include all required initialization code, and
    should be started with the main method.
</li><li>For large attachments, use a public temporary storage such as
    <a href="http://rapidshare.com">Rapidshare</a>.
</li><li>Google Group versus issue tracking:
252
    Use the
253 254
    <a href="http://groups.google.com/group/h2-database">Google Group</a>
    for questions or if you are not sure it's a bug.
255
    If you are sure it's a bug, you can create an
256 257 258
    <a href="http://code.google.com/p/h2database/issues/list">issue</a>,
    but you don't need to (sending an email to the group is enough).
    Please note that only few people monitor the issue tracking system.
Thomas Mueller's avatar
Thomas Mueller committed
259
</li><li>For out-of-memory problems, please analyze the problem yourself first,
Thomas Mueller's avatar
Thomas Mueller committed
260
    for example using the command line option
Thomas Mueller's avatar
Thomas Mueller committed
261
    <code>-XX:+HeapDumpOnOutOfMemoryError</code>
Thomas Mueller's avatar
Thomas Mueller committed
262
    and a memory analysis tool such as the
Thomas Mueller's avatar
Thomas Mueller committed
263
    <a href="http://www.eclipse.org/mat">Eclipse Memory Analyzer (MAT)</a>.
264 265 266
</li><li>It may take a few days to get an answers. Please do not double post.
</li></ul>

Thomas Mueller's avatar
Thomas Mueller committed
267
<h2 id="automated">Automated Build</h2>
268
<p>
269
This build process is automated and runs regularly.
270
The build process includes running the tests and code coverage, using the command line
271
<code>./build.sh clean jar coverage -Dh2.ftpPassword=... uploadBuild</code>.
272
The last results are available here:
273
</p>
274 275 276
<ul><li><a href="http://h2database.com/html/testOutput.html">Test Output</a>
</li><li><a href="http://h2database.com/coverage/overview.html">Code Coverage Summary</a>
</li><li><a href="http://h2database.com/coverage/coverage.zip">Code Coverage Details (download, 1.3 MB)</a>
277
</li><li><a href="http://www.h2database.com/automated/news.xml">Build Newsfeed</a>
278
</li><li><a href="http://www.h2database.com/automated/h2-latest.jar">Latest Jar File (download, 1 MB)</a>
279 280
</li></ul>

281 282 283 284 285 286 287 288 289 290 291 292 293 294
<h2 id="railroad">Generating Railroad Diagrams</h2>
<p>
The railroad diagrams are HTML, formatted as nested tables.
The diagrams are generated as follows:
</p>
<ul><li>The BNF parser (<code>org.h2.bnf.Bnf</code>) reads and parses the BNF from the file <code>help.csv</code>.
</li><li>The page parser (<code>org.h2.server.web.PageParser</code>) reads the template HTML file and fills in the diagrams.
</li><li>The rail images (one straight, four junctions, two turns) are generated using a simple Java application.
</li></ul>
<p>
To generate railroad diagrams for other grammars, see the package <code>org.h2.jcr</code>.
This package is used to generate the SQL-2 railroad diagrams for the JCR 2.0 specification.
</p>

295 296
<!-- [close] { --></div></td></tr></table><!-- } --><!-- analytics --></body></html>