Skip to content
README.md 3.18 KiB
Newer Older
Carlos Galindo's avatar
Carlos Galindo committed
# e-Knife: Erlang slicing with the Expression Dependence Graph

Carlos Galindo's avatar
Carlos Galindo committed
You can find more details and contact information at the project's [homepage](https://kaz.dsic.upv.es/e-knife/).
Carlos Galindo's avatar
Carlos Galindo committed

This project consists of three modules:
Carlos Galindo's avatar
Carlos Galindo committed
* e-Knife: the frontend for the EDG, which implements the necessary tools to slice Erlang programs.
* EDG: the generic library that implements the graph and slicing techniques.
* Miscellaneous: various shared utilities.

## Build

Requirements: Java > 11, Erlang/OTP 24, Maven and Make.
Carlos Galindo's avatar
Carlos Galindo committed

Just run `make release` to generate the zipped release `e-knife-VERSION.zip`.
You'll also find it unzipped in the `dist` folder, ready to be run.
Carlos Galindo's avatar
Carlos Galindo committed

### Build with another version of Erlang

Part of the process requires some communication with an Erlang process. To
that end, the `jinterface` library must match the version of Erlang installed
in your machine. If your installation of Erlang is not OTP 24, you should replace
the bundled `jinterface` library with the one from your Erlang installation.

Carlos Galindo's avatar
Carlos Galindo committed
Before running `make`, replace the package `com.ericsson.otp.erlang` from
Carlos Galindo's avatar
Carlos Galindo committed
`e-Knife/src` with the one from your Erlang distribution,
at `lib/jinterface-VERSION/java_src`.

Your Erlang distribution will most likely be installed at `/usr/lib/erlang`,
`/usr/local/lib/erlang`, `~/.local/lib/erlang` or `/usr/local/Cellar/erlang/VERSION/lib/erlang`.
Carlos Galindo's avatar
Carlos Galindo committed

As an example:

```bash
pkg="com/ericsson/otp/erlang"
rm -rf e-Knife/src/$pkg
mv /usr/lib/erlang/lib/jinterface-1.12/java_src/$pkg e-Knife/src/$pkg
```

## Run

Requirements: Java > 11 and Erlang/OTP 24

Carlos Galindo's avatar
Carlos Galindo committed
The release version contains a jar file and a folder (`ebin`) with additional resources.
It is important to keep them in the same directory.

Carlos Galindo's avatar
Carlos Galindo committed
You'll probably want to generate slices, so you should run e-Knife. Run it without args
to obtain a list and explanation of arguments.

```
java -jar path/to/eknife.jar [args]
```

Carlos Galindo's avatar
Carlos Galindo committed
### View the sliced graph

To produce a graph, you must specify the optional argument `-G`.

In non-trivial programs, the graph can be too complicated to be useful.
You can either:

1. Customize the arcs that are printed. To do so, modify the variables at the
beginning of the `DotFactory` class in the `EDG` module, and then
[rebuild the project](#build).
2. Output the graph to a dot file, and then manually delete unwanted arcs and/or
use an interactive graphviz viewer, such as [XDot][xdot].

[xdot]: https://github.com/jrfonseca/xdot.py

## Import into an IDE

Most IDEs will autodetect the structure from the Maven configuration files.
Carlos Galindo's avatar
Carlos Galindo committed

You'll need to run `make beams` to compile the necessary Erlang files before running the program.

Carlos Galindo's avatar
Carlos Galindo committed
Otherwise, you can treat each folder (EDG, e-Knife and Miscellanea) as a
separate module, with the following dependencies:
Carlos Galindo's avatar
Carlos Galindo committed

* e-Knife requires EDG and Miscellanea.
* EDG requires Miscellanea.
* Miscellanea has no dependencies.

## License

This project is licensed under GNU Affero Public License (Version 3.0), with the exception of the
`jinterface` files, placed under `e-Knife/src/com/ericsson`, which are the property of Ericsson AB
and are licensed under the Apache License (Version 2.0).

You should have received a copy of the GNU Affero Public License along with this program.
If not, see https://www.gnu.org/licenses.