CPAchecker Developing Instructions
==================================

More details can be found in the other files in this directory.

Please read and follow StyleGuide.txt,
as well as Logging.txt, Test.txt, and VersionControl.txt.


Getting the code
----------------

There are four possibilities to retrieve the source code:

- The main SVN repository:
  https://svn.sosy-lab.org/software/cpachecker

- Our Git mirror:
  https://svn.sosy-lab.org/software/cpachecker.git

- A SVN mirror at Google Code:
  http://cpachecker.googlecode.com/svn

- A Git mirror at GitHub:
  https://github.com/dbeyer/cpachecker

Only our SVN repository allows committing,
all mirrors are read-only.
We recommend to use our own repository hosting,
because it avoids the risk that the synchronization to a third party
fails or causes problems.

For browsing through the code online,
there are these possibilities:
- https://svn.sosy-lab.org/trac/cpachecker/browser/CPAchecker
  (with an SVN account)
- https://code.google.com/p/cpachecker/source/browse/
- https://github.com/dbeyer/cpachecker/tree/trunk/

For bug tracking, we use our Trac:
https://svn.sosy-lab.org/trac/cpachecker/

For building the code on the command line, c.f. ../INSTALL.txt.


If you like to use Git, use the following commands
to create a working copy that allows you to transparently
commit to the SVN repository (with "git svn dcommit")
while still using Git to fetch the commits:

git clone -n -o mirror https://svn.sosy-lab.org/git/software/cpachecker.git/
cd cpachecker
git svn init --prefix=mirror/ -s https://svn.sosy-lab.org/software/cpachecker
git checkout -t mirror/trunk

This also works with GitHub.


Develop CPAchecker from within Eclipse
--------------------------------------

0. Install a Java 7 compatible JDK (c.f. INSTALL.txt).

1. Install Eclipse with at least version 3.7, with JDT.
   http://www.eclipse.org/

2. Install an SVN plugin for Eclipse, e.g. SubClipse (http://subclipse.tigris.org,
   Eclipse update site: http://subclipse.tigris.org/update_1.6.x)
   Create new project from SVN repository
   URL: https://svn.sosy-lab.org/software/cpachecker/trunk
   URL (read-only mirror): http://cpachecker.googlecode.com/svn/trunk

3. Copy the file .factorypath.template to .factorypath,
   and (if necessary) adjust the path to the CPAchecker directory within it.

4. If Eclipse complains about a missing JDK
   ("Unbound classpath container: 'JRE System Library [JavaSE-1.7]'"),
   go to Window -> Preferences -> Java -> Installed JREs,
   click the "Search" button and select the path where your Java 7 installation
   can be found (on Ubuntu "/usr/lib/jvm" will do).

5. Ignore warnings "Unsatisfied version constraint: 'org.eclipse.cdt.core ...'"
   and "Bundle 'org.eclipse.cdt.core' cannot be resolved'".

6. In order to run CPAchecker, use one of the supplied launch configurations
   or create your own.
   To select the configuration, specification, and program files use the
   text box "program arguments" in the launch configuration editor.
   Step 8 of the section "Running CPAchecker" above describes what can be entered here.
   The text box "VM arguments" needs to contain "-Djava.library.path=lib/native/<ENVIRONMENT>",
   where <ENVIRONMENT> is replaced with one of the following depending on your system:
     x86_64-linux, x86-linux, x86_64-macosx, x86-macosx,  x86-windows

7. Recommended:
   If you want the sources of the libraries (like Guava or CDT),
   run "ant install-contrib" once in the CPAchecker directory.


Develop CPAchecker as Eclipse Plugin for C projects
---------------------------------------------------
This is currently broken as the plugin needs to be updated
to work with a Java 7 compatible Eclipse version.

1. Requires Eclipse 3.5 with CDT 6 or Eclipse 3.6 with CDT 7
   and the Eclipse Plugin Development Environment.
   If you have CDT 6, you need the package "Eclipse C/C++ Development Tools SDK"
   (Eclipse update site: http://download.eclipse.org/tools/cdt/releases/galileo).
   If you have CDT 7, you need the package "Eclipse C/C++ Development Tools".
   Also install an SVN plugin, e.g. SubClipse (see above).

2. Create an Eclipse project for CPAchecker as described above.

3. Create an Eclipse project for CPAclipse from the SVN repository
   URL: https://svn.sosy-lab.org/software/cpachecker/trunk/plugin/CPAclipse

4. If there are warnings about missing bundles, you don't have CDT in the correct version.

5. Run the CPAclipse project as an "Eclipse Application".
