How to become a CIVL developer
- If you are interested in contributing to the development of CIVL, send an email to civl-users@… expressing your interest, and we'll get back to you. We can use help in many areas, including testing and creating new examples, and we are very open to new ideas on all aspects of the project.
- The lead developer will perform the following tasks:
- Add you to the civl-dev@… email list. You will be able to read and post messages to this group. Use it to discuss any development issues.
- Create a Subversion account for you in the appropriate projects (CIVL, ABC, SARL, GMC). You will then be able to commit to the
branchesdirectories in those repositories. (All of the repositories are already world-readable.) - Create a Trac account for you. You will then be able to create and modify bug/issue tickets, and write to the Wiki. (The tickets and Wiki are already world-readable.)
How to make changes or additions to CIVL
- To make any changes or additions to CIVL, you must first become a CIVL developer. See above.
- Before embarking on any major changes or additions, talk to the other developers. This is best done using the email list civl-dev@…. Explain what you want to do, and listen to the feedback.
- Create a new branch for the new features you want to add into CIVL. Name your branch anything you like and create it in the branches directory of the repository. See "Using Subversion from the command line" for instructions on creating the branch.
- There are two different ways to work on your branch in Eclipse. The first way is appropriate for relatively small changes that do not involve a lot of components. In this approach you check out your branch into the current workspace, giving the project a different name from existing projects, e.g.,
CIVL_mybranch. In the second approach, you create a whole new workspace with all four projects. In this approach you can stick with the standard names for all projects (CIVL,GMC,SARL,ABC). This approach is appropriate when you have bigger changes affecting multiple components. - Proceed with development of your branch, committing as often as you like. Periodically, merge changes from the trunk into your branch, and resolve any conflicts that result. This will make it much easier to integrate your branch into the trunk later on. Be sure to follow the CIVL Coding Standards and the Coding Standards for CIVL models.
- Create unit tests and system tests for your new code, making sure they provide 100% statement coverage of your code, at a minimum. You may also need to make changes to existing tests.
- Have at least one other CIVL developer review your code. Your reviewer will make suggestions for improvements. Iterate until both of you are satisfied.
- When you feel your branch is complete, send an email to civl-dev@…. In the email, give the name of your branch and summarize the changes/additions you have made. We will then schedule a CIVL meeting where your contribution will be discussed. All developers will be given some time to review your branch before the meeting.
- At the meeting, your branch will either be accepted or it will be rejected with suggestions for further changes. If accepted, it will be merged into the trunk. Only the lead developers have permission to do this merge. If further changes are suggested, a future meeting will be scheduled to discuss again.
We recommend using the Eclipse IDE to write CIVL code. Remember to set your Java code formatter as "built-in 2.1" in your Eclipse.
Notes for Windows Users
CIVL is not currently supported on Windows. However, it is easy to use CIVL and set up an Eclipse development environment on Windows using WSL. With Windows 11 or with Windows 10 21H2 (or newer), you can easily install WSL2 and run Linux GUI applications from it.
If you want to develop CIVL using a Windows machine, you should install WSL2 using the following instructions and then follow the remaining instructions of this page in the Linux partition managed by WSL.
- Open up powershell and execute the command
wsl --install - Restart your computer.
- Open up WSL (you can search for it now on the windows start menu). Pick a username and password to use when it asks.
- Execute
sudo apt update - Execute
sudo apt upgrade - Execute
sudo apt install openjdk-17-jre-headless - To get all packages required for displaying GUIs, it is easiest to install a simple GUI application like gedit which will obtain all of the necessary packages for you. Execute
sudo apt install gedit -y. - Test gedit out by running
gedit. A separate GUI window for gedit should appear. This means you are now set up to run GUI Linux applications from WSL.
You can now follow the rest of the instructions on this page. Note that when downloading files, you may need to move them to somewhere on your Linux partition before running them (like the Eclipse installer for example). This can easily be done with the regular Windows file explorer.
As a reminder, all the instructions on this page are to be done with respect to your Linux partition created by WSL. So for example, if an instruction says that something needs to go on your PATH, this means that it should be on your Linux PATH not the Windows PATH.
How to set up CIVL in Eclipse
- If your version of Java is older than 17 (the version number in the first line printed by the command
java --versionis what version you have) then install the latest version of Java here: https://www.oracle.com/java/technologies/downloads/
- Install theorem provers cvc4 and z3 following the instructions provided with those tools. CIVL uses only the command line interface for these tools, so you don't have to worry about installing libraries or anything other than the executable binary. Make sure the executable is somewhere in your
PATH.
- Set up the VSL dependencies folder:
- Download the file found at http://vsl.cis.udel.edu/lib/tools/vsl_depend.
- Unzip the
.tgzso that you end up with a folder with a name of the formvsl-X.XX. - Pick somewhere in your filesystem to move this folder. A good choice is
/opt. Note that you may need to usesudo.
- Install Eclipse IDE for Java Developers using the install found here: https://www.eclipse.org/downloads/packages/installer
- Install Subversive for Eclipse using these instructions (paying attention to our notes below): https://www.eclipse.org/subversive/installation-instructions.php
- Phase 1 notes:
- When selecting which components to install only "Subversive > Subversive SVN Team Provider" is required.
- Phase 2 notes:
- There is a comment that a dialog automatically displays after rebooting but it is not our experience that this actually happens. So if it doesn't for you then just follow the instructions they have just below that comment for manually installing the SVN connectors. It will be a near identical process to the installation done in Phase 1.
- Unless you know how to set up your own SVN Connector with Subversive, you should check all the boxes in this phase (i.e. check the parent level box "Subversive SVN Connectors"). This will include the supposedly "optional" component "SVNKit 1.10.x Implementation" which is an implementation of a SVN Connector using SVNKit.
- Phase 1 notes:
- Now we checkout the CIVL projects in Eclipse with Subversive.
- "File > New > Project...". A Wizard Selector window should appear.
- Pick "SVN > Project from SVN" and press "Next". A SVN Checkout window should appear.
- Under the "General" tab, set the URL to be
svn://vsl.cis.udel.edu/civl - Set "User" and "Password" to be the username and password you have for the CIVL repo.
- Check "Save authentication" if you don't want to have to enter that information when performing future SVN commands on this repo in Eclipse.
- Press "Next".
- Press the "Browse..." button next to the URL. In the window that pops up, expand the "civl" folder and select "trunk". Press OK. The pop-up window should disappear and the URL should now say
svn://vsl.cis.udel.edu/civl/trunk. - Press "Finish". A "Check Out As" window should appear.
- Select the option "Check out as a project with the name specified:" and set the name to be
CIVL. - Press "Finish". The window should disappear and you should see a small progress bar in the bottom left corner of Eclipse. This shows its progress in checking out the repo into your workspace.
- Once completed, you should see a new project in your workspace titled
CIVL. Right-click it and select "Import...". An Import window should appear. - Select "General > Existing Projects into Workspace" and then press "Next".
- In the next window, select "Select root directory:" and set it to be the path to the
CIVLdirectory in your workspace. - Next, uncheck the option "Copy projects into workspace" and check the option "Search for nested projects". In the "Projects:" list of the window there should be 5 new projects that appear titled:
dev.civl.abcdev.civl.comdev.civl.gmcdev.civl.mcdev.civl.sarl
- Select these 5 projects and then press "Finish".
- The window should disappear and the 5 projects you selected should appear in the Package Explorer window.
- To properly work with these new projects, you must change to using the Project Explorer window rather than the Package Explorer window.
- Close out of the Package Explorer window and then select "Window > Show View > Project Explorer".
- Click the three vertical dots at the top right of the Project Explorer window and select "Projects Presentation > Hierarchical".
- Again, click the three vertical dots again and this time select "Package Presentation > Hierarchical".
- Open up the file
build_default.properties. If the value ofrootdoes not match the absolute path to the VSL dependencies folder,vsl-X.XX, that you downloaded earlier then perform the following nested instructions:- Close
build_default.propertiesand then make a copy of it calledbuild.properties. Do not deletebuild_default.propertiessince this is tracked by SVN. - Open up
build.propertiesand replace the value ofrootwith the absolute path tovsl-X.XX, replacingX.XXwith${civlversion}. - Save and close the file.
- Close
- Next we will point Eclipse to where the dependencies for CIVL are.
- Open up the Eclipse Preferences and then navigate to "Java > Build Path > Classpath Variables".
- Press "New...". A new popup window will appear.
- Enter
VSLfor the "Name:" field and then for the "Path:" field, enter the path tovsl-X.XX. - Press "Ok". Then press "Apply and Close". Eclipse will ask you if you want to do a full rebuild. Press "Yes".
- Now we will run our ant scripts to perform our one-time task of running ANTLR.
- Right-click on
dev.civl.abc/build.xml. Press "Run As > 1 Ant Build". After about 20 seconds, the console should have displayed BUILD SUCCESSFUL. - Right-click on
dev.civl.abcand press "Refresh". - Perform the previous two steps for the project
dev.civl.mc.
- Right-click on
Running CIVL from command line
- We will create a script that will sit on your
PATHthat will allow you to conveniently runCIVLfrom the.classfiles built in Eclipse.- Create two new environment variables:
ECLIPSE_WORKSPACEshould be the absolute path to your Eclipse workspace.VSL_DEPSshould be the path to yourvsl-X.XXdependencies folder.
- Somewhere on your system, create a plain text file named
civland copy-paste the following:#!/bin/sh java -cp $ECLIPSE_WORKSPACE/CIVL -p $ECLIPSE_WORKSPACE/CIVL/mods/dev.civl.abc:$ECLIPSE_WORKSPACE/CIVL/mods/dev.civl.gmc:$ECLIPSE_WORKSPACE/CIVL/mods/dev.civl.mc:$ECLIPSE_WORKSPACE/CIVL/mods/dev.civl.sarl:$VSL_DEPS/mods/antlr3:$VSL_DEPS/mods/antlr4 -m dev.civl.mc/dev.civl.mc.CIVL $@
- You must make it executable. You can use the command
chmod ugo+x civl. - Move this file to somewhere on your
PATH. - Run
civl helpfrom the command line to ensure that it worked. You should get a long list of command line options that CIVL accepts.
- Create two new environment variables:
- Execute the command
civl config. This should find the theorem provers in yourPATHand create a file.sarlin your home directory. You can now runcivlfrom the command line. Go to the example files found in theexamplesdirectory and try runningcivl verifyon some of them!
Running CIVL from within Eclipse
To run CIVL from Eclipse, you need to create a run configuration that specifies where the "main class" is and then what arguments you want to pass CIVL and where you want to run CIVL from. After setting this up you can reuse this run configuration by simply altering the arguments you pass it and where it is executed from.
- In Eclipse, navigate to "Run > Run Configurations..." and select the "Java Application" item in the left column of the window.
- Press the "New Configuration" button and give it a name like "CIVL".
- Under the "Main" tab, enter
dev.civl.mcas the "Project" anddev.civl.mc.CIVLas the "Main class". You can use the "Browse..." and "Search..." buttons for this. - Under the "Arguments" tab, enter the program arguments you want to pass to CIVL in the "Program arguments" section. In the "Working directory" section at the bottom of the same tab select "Other:" and specify where you want CIVL to be executed from.
- Example: "Program arguments:" `verify algebra.cvl`, "Working directory:"
${workspace_loc:CIVL/examples/arithmetic}. This will runcivl verifyon thealgebra.cvlexample in the folderCIVL/examples/arithmeticin your workspace.
- Example: "Program arguments:" `verify algebra.cvl`, "Working directory:"
- Press "Apply". If you wish to run this configuration, select "Run" with the configuration selected.
Now whenever you want to run CIVL, you can simply go to "Run > Run Configurations...", select the "CIVL" configuration you have made, and change the settings under the "Arguments" tab as needed and press "Run". If you want to run CIVL in debug mode then you will instead go to "Run > Debug Configurations...", select the "CIVL" configuration you made and press "Debug".
To run JUnit tests, you can set up a JUnit launch configuration in a similar way to above, but Eclipse is able to automatically set up appropriate launch configurations for you (except for tests found in dev.civl.mc). All you need to do is right-click on whatever test suite you want to run JUnit on (this can be folders containing tests, or even an individual test within a .java file) and then select "Run As > JUnit Test". If you want to run the JUnit test in debug mode then simply select "Debug As > JUnit Test" instead.
Most tests in dev.civl.mc rely on the files found in the root level examples folder. By default though, Eclipse will set up new JUnit configurations to run from the project folder containing the tests (so in this case dev.civl.mc). However we need these tests to be run from the root folder CIVL. So when setting up JUnit tests under dev.civl.mc, you must set the "Working directory" to be the root folder CIVL.
Using Subversion from the command-line
- CIVL uses Subversion to manage source code. The CIVL Subversion repository is structured in the typical way. In particular, the repository contains directories named
trunk,branchesandtags. - To create a new branch named
branch_namefrom the current trunk, typesvn copy svn://vsl.cis.udel.edu/civl/trunk svn://vsl.cis.udel.edu/civl/branches/branch_name
- Once a new branch has been created, you can check out your new branch with the command
svn co svn://vsl.cis.udel.edu/civl/branches/branch_name
You can also create a new Eclipse project from that branch, in the usual way.
- Within your own branch, you can change anything you want to implement your changes or additions, and you can commit your changes to the svn server so that you won't lose your work.
- To merge changes made to the trunk into your branch, change into your local branch directory and type
svn merge ^/trunk .
Resolve any conflicts and when you are satisfied with the state of your local copy, commit it as usual. Do this regularly (or whenever changes are committed to the trunk) in order to reduce the work of resolving conflicts when you decide to merge your branch back to the trunk.
- To see a summary of the merge history from the trunk to your branch, go into your branch directory and type
svn mergeinfo ^/trunk
- Lead developers only: to merge a branch back to the trunk, change into your local copy of the trunk directory and type
svn merge ^/branches/branch_name .
Resolve conflicts as needed and make sure all tests pass. Then commit the trunk. At this point the branch may be deleted (svn remove ^/branches/branch_name) or it can be kept around if the developer wants to continue to use it.
