0N/AOpenGrok - a wicked fast source browser
0N/A---------------------------------------
0N/AOpenGrok is a fast and usable source code search and cross reference
0N/Aengine, written in Java. It helps you search, cross-reference and navigate
0N/Ayour source tree. It can understand various program file formats and
115N/Aversion control histories like SCCS, RCS, CVS, Subversion and Mercurial.
0N/AOpenGrok is the tool used for the OpenSolaris Source Browser.
116N/A * A servlet container like Tomcat (
5.x or later)
116N/A supporting Servlet 2.4 and JSP 2.0
0N/A * Subversion 1.3.0 or later if SVN support is needed
115N/A * Mercurial 0.9.3 or later if Mercurial support is needed
115N/A * JFlex Ant task (If you want to build OpenGrok)
0N/ASRC_ROOT refers to the directory containing your source tree.
0N/AOpenGrok analyzes the source tree and builds a search index along with
0N/Across-referenced hypertext versions of the source files. These generated
0N/Adata files will be stored in DATA_ROOT directory.
0N/AOpenGrok setup Step.0 - Setting up the Sources.
0N/A----------------------------------------------
0N/ASource base must be available locally for OpenGrok to work efficiently. No
115N/Achanges are required to your source tree. If the code is under source control
115N/Amanagement (SCM) OpenGrok requires the checked out source tree under SRC_ROOT.
115N/AIt is possible for some SCM systems to use a remote repository (Subversion),
115N/Abut this is not recommended due to the performance penalty. CVS must have a
0N/ANote that OpenGrok ignores symbolic links.
0N/A---------------------------------------------------
0N/AUsing command line interface.
0N/A---------------------------------------------------
0N/AStep.1 - Populate DATA_ROOT Directory
0N/A=====================================
299N/AOption 1. OpenGrok: There is a sample shell script OpenGrok that is suitable
0N/Afor using in a cronjob to run regularly. Modify the variables in the script
299N/Ato point appropriate directories, or as the code suggests factor your local
299N/Aconfiguration into a seperate file and simplify future upgrades.
0N/Athe sources are all located in a directory SRC_ROOT and the data and
0N/Ahypertext files generated by OpenGrok are to be stored in DATA_ROOT, run
0N/A===============================================
0N/ATo configure the webapp
source.war, look into the parameters defined in
0N/A * HEADER: is the fragment of HTML that will be used to display title or
0N/A logo of your project
0N/A * SRC_ROOT: the absolute path name of the root directory of your source tree
0N/A * DATA_ROOT: absolute path of the directory where OpenGrok data
0N/AOptional Step.3 - Path Descriptions
0N/A-----------------------------------
0N/AOpenGrok uses path descriptions in various places (For eg. while showing
0N/Adirectory listings or search results) Example descriptions are in
paths.tsv 0N/Afile. You can list descriptions for directories one per line tab separated
0N/Aformat path tab description. Refer to example 4 below.
115N/ANote 1 - Changing webapp parameters:
web.xml is the deployment descriptor
0N/Afor the web application. It is in a Jar file named
source.war, you can
0N/A Then copy the war files to <i>TOMCAT</i>/webapps directory.
116N/A * Option 3: Edit the Context container element for the webapp
116N/A When invoking OpenGrok to build the index, use -w <webapp> to set the
116N/A After the index is built, there's a couple different ways to set the
116N/A Context for the servlet container:
116N/A <Parameter name="HEADER" value='...' override="false" />
164N/A <Parameter name="SCAN_REPOS" value="false" override="false" />
116N/A - Create a Context file for the webapp
116N/A This file will be named `<webapp>.xml'.
116N/A For Tomcat, the file will be located at:
116N/A is the Engine that is processing requests and <hostname> is a Host
116N/A associated with that Engine. By default, this path is
116N/A This file will contain something like the Context described above.
120N/AOptional Step 4 -- Subversion setup
120N/A-----------------------------------
177N/ASome additional setup is needed if you are using Subversion. OpenGrok uses
177N/Athe Subversion javahl bindings, which must be installed separately.
177N/Athis by copying the file into the lib-subdirectory in your OpenGrok
177N/Acommon directory for all web applications (For Tomcat
5.x, this is
177N/AThe path to the native library svnjavahl needs to be added to
177N/Aor, by using LD_LIBRARY_PATH
0N/A---------------------------------------------------
0N/AUsing Standalone Swing GUI
0N/A---------------------------------------------------
0N/Aopengrok.jar when invoked without any arguments, opens up the GUI search window.
0N/AThe interface is similar to cscope.
0N/ATo create an index, first select the browse button for "Search" drop down list.
0N/AChoose a directory to store the index (DATA_ROOT), and select the source tree
0N/A(SRC_ROOT). You may have to also select path to ctags in the Advanced Options,
0N/Aif exuberant ctags can not be found in the PATH.
0N/AClicking "Update" will create or update the search index.
0N/AThe index can be searched using the cscope like GUI, which lets you customize
0N/Ayour favorite editor to open the matching files.
295N/A---------------------------------------------------
295N/A---------------------------------------------------
295N/Ayou have to download Findbugs to your machine, and install it where you have
295N/AYou can now run ant with the findbugs target:
295N/A [findbugs] Executing findbugs from ant task
295N/A [findbugs] Running FindBugs...
295N/A [findbugs] Warnings generated: nnn
341N/AIf you want to install findbugs some other place than ~/.ant/lib, you can untar the
341N/Afindbugs, like this (if you have installed fundbugs under the lib directory):
341N/AThere is also a findbugs-xml ant target that can be used to generate XML files that can
301N/A---------------------------------------------------
301N/A---------------------------------------------------
301N/AIf you want to check test coverage on OpenGrok, download Emma from
301N/ANow you can instrument your classes, and create a jar file:
301N/AIf you are using NetBeans, select File - "opengrok" Properties
301N/AIf you are not using netbeans, you have to edit the file
301N/ANow you can put the classes into jars and generate distributables:
301N/Athe run time analysis, use these properties:
301N/Adirectory for easy analyzation.
301N/AIf you want to test the coverage of the unit tests, you can
301N/A ant test (Or Alt+F6 in NetBeans)
301N/ANow you should get some output saying that Emma is placing runtime
301N/ATo generate reports, run ant again:
13N/AMartin Englund, Sun Microsystems
136N/AKnut Anders Hatlen, Sun Microsystems