| 1 |
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" |
| 2 |
"http://www.w3.org/TR/html4/strict.dtd"> |
| 3 |
<html> |
| 4 |
<head> |
| 5 |
<title>Development Setup</title> |
| 6 |
<link rel="stylesheet" href="http://cs.nyu.edu/rgrimm/bedrock.css" |
| 7 |
type="text/css"> |
| 8 |
</head> |
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
<body> |
| 13 |
<h1 class="title">Development Setup</h1> |
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
<p class="head centered" /> |
| 18 |
[ <a href="#tools">Tools</a> | |
| 19 |
<a href="#dir">Directory Hierarchy</a> | |
| 20 |
<a href="#env">Environment Variables</a> | |
| 21 |
<a href="#make">Make Targets</a> | |
| 22 |
<a href="#code">Coding Conventions</a> | |
| 23 |
<a href="#pointers">Useful Pointers</a> ] |
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
<h2 class="title bar"><a name="tools">Tools</a></h2> |
| 28 |
|
| 29 |
<p />We use the <a href="http://java.sun.com/javase/index.jsp">Java |
| 30 |
Standard Edition</a> version 5 or higher and several Unix command line |
| 31 |
tools, including GNU make, find (either the GNU or BSD version will |
| 32 |
do), CVS, |
| 33 |
<a |
| 34 |
href="http://www.info-zip.org/">Info-ZIP</a>, <a |
| 35 |
href="http://expect.nist.gov/">expect</a>, |
| 36 |
and <a href="http://www.gnu.org/software/dejagnu/">DejaGnu</a>. On |
| 37 |
Windows, we recommend using |
| 38 |
the <a href="http://sources.redhat.com/cygwin">Cygwin</a> port of |
| 39 |
these tools. Note that all these programs must be part of your local |
| 40 |
path. Further note that, on Windows, <code>find</code> must be the |
| 41 |
Unix version, <em>not</em> the version shipping with Windows. |
| 42 |
|
| 43 |
<p />A complete development installation also |
| 44 |
uses <a href="http://www.junit.org/index.htm">JUnit</a> for unit |
| 45 |
testing, <a |
| 46 |
href="http://www.kclee.com/clemens/java/javancss/">JavaNCSS</a> for |
| 47 |
collecting source code statistics, |
| 48 |
and <a href="http://www.antlr.org/">ANTLR</a> for comparing the |
| 49 |
performance of different parsers. All these tools |
| 50 |
(i.e., <code>junit.jar</code> from the JUnit |
| 51 |
distribution, <code>javancss.jar</code>, |
| 52 |
<code>ccl.jar</code>, and <code>jhbasic.jar</code> from the JavaNCSS |
| 53 |
distribution, and <code>antlr.jar</code> from the ANTLR distribution) |
| 54 |
need to be installed in the <code>bin</code> directory. To build the |
| 55 |
classes or documentation, <code>junit.jar</code> |
| 56 |
and <code>antlr.jar</code> should be in the Java class path. |
| 57 |
|
| 58 |
|
| 59 |
|
| 60 |
<h2 class="title bar"><a name="dir">Directory Hierarchy</a></h2> |
| 61 |
|
| 62 |
<dl> |
| 63 |
|
| 64 |
<dt>This directory</dt> |
| 65 |
<dd>The root of the development tree, including global make files.</dd> |
| 66 |
|
| 67 |
<dt><code>./src</code></dt> |
| 68 |
<dd>Source files, using package name components for |
| 69 |
subdirectories.</dd> |
| 70 |
|
| 71 |
<dt><code>./classes</code></dt> |
| 72 |
<dd>Class files, using package name components for subdirectories.</dd> |
| 73 |
|
| 74 |
<dt><code>./doc</code></dt> |
| 75 |
<dd>The class documentation generated by <code>javadoc</code>.</dd> |
| 76 |
|
| 77 |
<dt><code>./bin</code></dt> |
| 78 |
<dd>Binaries, notably JAR files.</dd> |
| 79 |
|
| 80 |
<dt><code>./glr</code></dt> |
| 81 |
<dd>Source files for SDF- and Elkhound-generated Java parsers.</dd> |
| 82 |
|
| 83 |
<dt><code>./data</code></dt> |
| 84 |
<dd>Files for running experiments.</dd> |
| 85 |
|
| 86 |
</dl> |
| 87 |
|
| 88 |
|
| 89 |
|
| 90 |
<h2 class="title bar"><a name="env">Environment Variables</a></h2> |
| 91 |
|
| 92 |
<dl> |
| 93 |
|
| 94 |
<dt><code>JAVA_HOME</code></dt> |
| 95 |
<dd>The JDK's root directory, e.g., |
| 96 |
<code>/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Home</code> on Mac OS X or |
| 97 |
<code>C:\j2sdk1.5.0</code> on Windows.</dd> |
| 98 |
|
| 99 |
<dt><code>JAVA_RUNTIME</code></dt> |
| 100 |
<dd>The JAR file with the Java platform classes, e.g., |
| 101 |
<code>/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Classes/classes.jar</code> on Mac OS X or |
| 102 |
<code>C:\j2sdk1.5.0\jre\lib\rt.jar</code> on Windows. Only set this |
| 103 |
environment variable when using |
| 104 |
<a href="http://www-124.ibm.com/developerworks/oss/jikes/">Jikes</a> |
| 105 |
as the Java compiler.</dd> |
| 106 |
|
| 107 |
<dt><code>JAVA_DEV_ROOT</code></dt> |
| 108 |
<dd>The root of the local directory hierarchy, i.e., this |
| 109 |
directory. For example, <code>C:\user\xtc</code> on Windows or |
| 110 |
<code>~/xtc</code> on Unix.</dd> |
| 111 |
|
| 112 |
<dt><code>CLASSPATH</code></dt> |
| 113 |
<dd>The class path, |
| 114 |
e.g., <code>C:\user\xtc\classes;C:\user\xtc\bin\junit.jar;C:\user\xtc\bin\antlr.jar</code> |
| 115 |
on Windows |
| 116 |
or <code>~/xtc/classes:~/xtc/bin/junit.jar:~/xtc/bin/antlr.jar</code> |
| 117 |
on Unix systems.</dd> |
| 118 |
|
| 119 |
<dt><code>PATH_SEP</code></dt> |
| 120 |
<dd>The path separator for the local operating system, e.g., |
| 121 |
"<code>;</code>" for Windows and "<code>:</code>" for Unix.</dd> |
| 122 |
|
| 123 |
<dt><code>CVSROOT</code></dt> |
| 124 |
<dd>The root directory for the CVS repository, e.g., |
| 125 |
<code>:ext:user@machine:/home/pervasive/vault</code>. Only set this |
| 126 |
environment variable if you have access to xtc's CVS repository.</dd> |
| 127 |
|
| 128 |
<dt><code>CVS_RSH</code></dt> |
| 129 |
<dd><code>/usr/bin/ssh</code>. Only set this environment variable if |
| 130 |
you have access to xtc's CVS repository.</dd> |
| 131 |
|
| 132 |
</dl> |
| 133 |
|
| 134 |
<p />A note on path segment separators: It is OK to use backslashes |
| 135 |
'<code>\</code>' within environment variables on Windows, but all |
| 136 |
paths in make files must use forward slashes '<code>/</code>' as the |
| 137 |
path segment separator. |
| 138 |
|
| 139 |
<p />Example shell scripts for both Unix (<code>setup.sh</code>) and |
| 140 |
Windows (<code>setup.bat</code>) are contained in this directory. The |
| 141 |
Windows shell script is targeted at the native command line prompt; |
| 142 |
when running <code>bash</code> (which is part of Cygwin), it is |
| 143 |
probably easier to adapt the Unix shell script. |
| 144 |
|
| 145 |
|
| 146 |
|
| 147 |
|
| 148 |
<h2 class="title bar"><a name="make">Make Targets</a></h2> |
| 149 |
|
| 150 |
<p />The following make targets are supported:<ul> |
| 151 |
|
| 152 |
<li><code>configure</code>, which configures the local system's C |
| 153 |
limits and types.</li> |
| 154 |
|
| 155 |
<li><code>classes</code>, which is the default and builds all |
| 156 |
classes.</li> |
| 157 |
|
| 158 |
<li><code>parsers</code>, which builds all parsers.</li> |
| 159 |
|
| 160 |
<li><code>analyzers</code>, which builds all Typical type |
| 161 |
checkers.</li> |
| 162 |
|
| 163 |
<li><code>doc</code>, which builds embedded Javadoc |
| 164 |
documentation.</li> |
| 165 |
|
| 166 |
<li><code>clobber</code>, which removes all built classes, Javadoc |
| 167 |
generated documentation, JAR files, and the source distribution ZIP |
| 168 |
files.</li> |
| 169 |
|
| 170 |
<li><code>clobber-parsers</code>, which removes the source code for |
| 171 |
all parsers.</li> |
| 172 |
|
| 173 |
<li><code>jars</code>, which builds the xtc JAR |
| 174 |
files: <code>xtc.jar</code> contains all classes necessary for running |
| 175 |
xtc and <code>rats-runtime.jar</code> contains only those classes |
| 176 |
necessary for running <em>Rats!</em>-generated parsers.</li> |
| 177 |
|
| 178 |
<li><code>dist</code>, which generates two ZIP |
| 179 |
files: <code>xtc-core.zip</code> contains xtc's source distribution, |
| 180 |
and <code>xtc-testsuite.zip</code> contains xtc's regression |
| 181 |
tests.</li> |
| 182 |
|
| 183 |
<li><code>stats</code>, which prints JavaNCSS generated source code |
| 184 |
statistics.</li> |
| 185 |
|
| 186 |
<li><code>check</code>, which runs all regression tests.</li> |
| 187 |
|
| 188 |
</ul> |
| 189 |
|
| 190 |
|
| 191 |
|
| 192 |
<h2 class="title bar"><a name="code">Coding Conventions</a></h2> |
| 193 |
|
| 194 |
<p />We generally follow |
| 195 |
the <a |
| 196 |
href="http://java.sun.com/docs/codeconv/html/CodeConvTOC.doc.html">Java |
| 197 |
code conventions</a> |
| 198 |
(in <a |
| 199 |
href="ftp://ftp.javasoft.com/docs/codeconv/CodeConventions.pdf">PDF</a>) |
| 200 |
and make liberal use |
| 201 |
of <a href="http://java.sun.com/j2se/javadoc/index.html"> |
| 202 |
<code>javadoc</code> </a> comments. Though, we use <em>two spaces</em> |
| 203 |
as the unit of indentation. |
| 204 |
|
| 205 |
|
| 206 |
|
| 207 |
<h2 class="title bar"><a name="pointers">Useful Pointers</a></h2> |
| 208 |
|
| 209 |
<ul> |
| 210 |
|
| 211 |
<li class="tight"><a |
| 212 |
href="http://developer.java.sun.com/developer/TechTips/2000/tt0124.html#tip2">HPROF</a>: a Java profiler.</li> |
| 213 |
|
| 214 |
<li class="tight"><a |
| 215 |
href="http://developer.java.sun.com/developer/technicalArticles/GUI/perfanal/">PerfAnal</a>: |
| 216 |
a performance analysis tool.</li> |
| 217 |
|
| 218 |
<li class="tight"><a |
| 219 |
href="http://www.kclee.com/clemens/java/javancss/">JavaNCSS</a>: a |
| 220 |
source measurement suite for Java.</li> |
| 221 |
|
| 222 |
</ul> |
| 223 |
|
| 224 |
</body></html> |