We follow the common Gitflow Workflow. A quick tutorial on the Gitflow Workflow is available from Atlassian.
In brief, the core of the workflow consists of the following:
-
Basing feature branches off of the
developbranch.$ git checkout -b some-feature develop -
Merging into the
developbranch via pull requests. -
Reserving the
masterbranch for releases.
Overall, we follow common git best practices. Please read over this document before making contributions, particularly about Gitflow, commit messages, pull requests (including types of pull requests), and code reviews.
We follow standard conventions for making commits and writing effective Git commit messages. First read the brief How to Write a Git Commit Message and then Contributing to a Project from the ProGit book. In short, make logically incremental commits and write substantitive messages that convey why something was changed versus simply saying what was changed.
We follow the standard Scala Style Guide and Effective Scala with respect to coding style. Please read over these guides before contributing.
We use Scaladoc and follow the standard guidelines from Scaladoc for Library Authors.
This project is primarily a Scala project using sbt for building with a few external dependencies.
If you would like to set up a build environment using your own package manager, you will need to find and install the following tools:
- JDK 8
sbtz3- Japron (the Apron Java interface)
The simplest way to set up the build environment if you are running Linux, macOS, or Windows (with a Linux subsystem) is with the portable Nix Package Manager.
$ brew cask install nixWith the Nix Package Manager installed, we need to add the cuplv-nixpkgs overlay (globally once).
# From a desired install location, add the cuplv-nixpkgs overlay.
$ git clone https://github.com/cuplv/cuplv-nixpkgs
# This symlinks cuplv-nixpkgs to ~/.config/nixpkgs/overlays/cuplv-nixpkgs
$ cuplv-nixpkgs/installThen, use nix-shell to open a shell with all dependencies available.
# Enter the cuanto build environment
$ cd cuanto
$ nix-shell
# Test the build environment
[nix-shell:~/cuanto]$ sbt testWe offer some instructions on setting up a native build environment. Most dependencies are JVM-based, so this should work for most things.
Using Homebrew, install dependencies as follows:
$ brew cask install java
$ brew install sbt
$ brew install z3See documentation on sbt for details. In brief, it is most convenient to start an sbt shell
$ sbtand then
-
Build
> compile -
Test
> test -
Generate API documentation
> doc -
Start a Scala console
> console -
Prefix any command with
~to re-execute the command when any file in the project is updated; for example,> ~test
If you want to use IntelliJ IDEA as your IDE, use the sbt import wizard. In brief,
- Make sure the Scala plugin is installed.
- Import via
File > New > Project from Existing Sources > Import project from external model > SBT. - We recommend checking
Use auto-importto automaticaly stay in sync withbuild.sbt. - Make sure the
Project SDKis 1.8.
It is particularly convenient to run ScalaTest via IntelliJ. Get started by right-clicking on a ScalaTest Spec class.
On some Linux and macOS systems, the system-installed version of bash is too old for nix-shell to use. You will see this error if you have this issue:
$ nix-shell
bash: local: -n: invalid option
local: usage: local name[=value] ...
bash: local: -n: invalid option
local: usage: local name[=value] ...
bash: failureHooks: command not foundTo fix this issue, you will need a newer version of bash. For example, on macOS, you can get a newer version of bash via Homebrew.
If it is inconvenient to update your system, you can install a suitable version using Nix itself:
$ nix-env -iA nixpkgs.bashInteractiveIf your development environment does not accommodate nix-installed jars or provide a japron/apron package you will need to build it yourself. Generally there are three phases:
- Download Apron source code
- Compile Apron
- Configure the environment on your machine (assume you are using linux)
Below are detailed steps for setting up an enviroment where Apron relies on:
-
Clone source code:
svn co svn://scm.gforge.inria.fr/svnroot/apron/apron/trunk apron -
Enter Apron's root directory:
cd apron -
Configure Apron:
./configure -prefix $out -no-cxx -absolute-dylibs -
Compile Apron:
make -
Test if Apron is functioning well:
make test -
Enter cuanto's root directory:
cd cuanto -
Create a lib folder in cuanto:
mkdir lib -
Move the followings files from
apron/tocuanto/lib/:apron.jar, gmp.jar, libapron.so, libboxD.so, libjapron.so, libjgmp.so, liboctD.so, libpolkaMPQ.so
Note that these files are not necessarily in Apron's root directory. They might be under some sub-directories.
-
Open a shell and type:
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$CUANTO/lib(replace $CUANTO with the absolute path of cuanto)
-
Done.
If you are using MacOS, things will be slightly different when setting up Apron:
-
Replace step 8 above with:
Move the followings files from
apron/tocuanto/lib/:apron.jar, gmp.jar, libapron.so, libboxD.so, libjapron.dylib (renamed from libjapron.so), libjgmp.dylib (renamed from libjgmp.so), libjgmp.so, liboctD.so, libpolkaMPQ.so
Note that these files are not necessarily in Apron's root directory. They might be under some sub-directories.
-
Replace step 9 above with:
Open a shell and type:
export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:$CUANTO/lib(replace $CUANTO with the absolute path of cuanto)
We recommend using the Bash on Windows for development. This is an almost fully functional implementation of the Linux environment from which you can run bash. After following these instructions, open a bash terminal and follow the instructions for Linux. We currently do not have a good way to make IntelliJ work in this environment, but the command line is fully functional.
If nix-shell emits a disk I/O error then it may be necessary to apply the following [fix][Windows sqlite. Within the /etc/nix/nix.conf add the line
use-sqlite-wal = false