Getting Started
Prerequisites
Kompics requires that you have a JDK on your machine. Since Kompics 1.1.0
at least Java 8 is required, and any newer release should work fine.
Including Kompics
The best way to include Kompics is to use a build tool, such as SBT or Maven, and add the required Kompics modules as a dependency.
Modules
Kompics is very modular and consists of several sub-projects, containing different features, ports, and components.
Kompics Core
The kompics-core
module contains Kompics’ Java runtime and the basic definitions. It is the minimum required dependency in Kompics Java.
- sbt
libraryDependencies += "se.sics.kompics" % "kompics-core" % "1.2.1"
- Maven
<dependency> <groupId>se.sics.kompics</groupId> <artifactId>kompics-core</artifactId> <version>1.2.1</version> </dependency>
- Gradle
dependencies { compile group: 'se.sics.kompics', name: 'kompics-core', version: '1.2.1' }
Kompics Scala
The kompics-scala
module provides the core Scala DSL for Kompics. Projects including it as a dependency should elide the kompics-core
dependency above, as it is automatically pulled in as a transitive dependency in the correct version.
- sbt
libraryDependencies += "se.sics.kompics" %% "kompics-scala" % "2.0.0"
- Maven
<dependency> <groupId>se.sics.kompics</groupId> <artifactId>kompics-scala_2.13</artifactId> <version>2.0.0</version> </dependency>
- Gradle
dependencies { compile group: 'se.sics.kompics', name: 'kompics-scala_2.13', version: '2.0.0' }
Timer
The kompics-port-timer
module provides the definition of a port that provides scheduled timeouts. An implementation of that port can be found in the kompics-component-java-timer
module.
- sbt
libraryDependencies ++= Seq( "se.sics.kompics.basic" % "kompics-port-timer" % "1.2.1", "se.sics.kompics.basic" % "kompics-component-java-timer" % "1.2.1" )
- Maven
<dependency> <groupId>se.sics.kompics.basic</groupId> <artifactId>kompics-port-timer</artifactId> <version>1.2.1</version> </dependency> <dependency> <groupId>se.sics.kompics.basic</groupId> <artifactId>kompics-component-java-timer</artifactId> <version>1.2.1</version> </dependency>
- Gradle
dependencies { compile group: 'se.sics.kompics.basic', name: 'kompics-port-timer', version: '1.2.1', compile group: 'se.sics.kompics.basic', name: 'kompics-component-java-timer', version: '1.2.1' }
Network
The kompics-port-network
module provides the definition of a port that provides networking capabilities, that is sending of addressed messages over network protocols. An implementation of that port using the Netty library can be found in the kompics-component-netty-network
module. It provides networking via TCP, UDP, and UDT.
- sbt
libraryDependencies ++= Seq( "se.sics.kompics.basic" % "kompics-port-network" % "1.2.1", "se.sics.kompics.basic" % "kompics-component-netty-network" % "1.2.1" )
- Maven
<dependency> <groupId>se.sics.kompics.basic</groupId> <artifactId>kompics-port-network</artifactId> <version>1.2.1</version> </dependency> <dependency> <groupId>se.sics.kompics.basic</groupId> <artifactId>kompics-component-netty-network</artifactId> <version>1.2.1</version> </dependency>
- Gradle
dependencies { compile group: 'se.sics.kompics.basic', name: 'kompics-port-network', version: '1.2.1', compile group: 'se.sics.kompics.basic', name: 'kompics-component-netty-network', version: '1.2.1' }
Additionally, the kompics-port-virtual-network adds a few definitions to the network port to allow for the usage of virtual nodes within the same Kompics instance.
- sbt
libraryDependencies += "se.sics.kompics.basic" % "kompics-port-virtual-network" % "1.2.1"
- Maven
<dependency> <groupId>se.sics.kompics.basic</groupId> <artifactId>kompics-port-virtual-network</artifactId> <version>1.2.1</version> </dependency>
- Gradle
dependencies { compile group: 'se.sics.kompics.basic', name: 'kompics-port-virtual-network', version: '1.2.1' }
Simulator
Kompics comes with a DSL to describe experiment/test scenarios and a scheduler and base components to run them. These can be found in the Kompics Simulator module.
- sbt
libraryDependencies += "se.sics.kompics.simulator" % "core" % "1.2.1"
- Maven
<dependency> <groupId>se.sics.kompics.simulator</groupId> <artifactId>core</artifactId> <version>1.2.1</version> </dependency>
- Gradle
dependencies { compile group: 'se.sics.kompics.simulator', name: 'core', version: '1.2.1' }
As setting up simulation scenarios can be quite verbose using the Java API, there is also a Scala DSL for the simulator, that makes creation of simulations a bit more streamlined.
- sbt
libraryDependencies += "se.sics.kompics" % "kompics-scala-simulator" % "2.0.0"
- Maven
<dependency> <groupId>se.sics.kompics</groupId> <artifactId>kompics-scala-simulator</artifactId> <version>2.0.0</version> </dependency>
- Gradle
dependencies { compile group: 'se.sics.kompics', name: 'kompics-scala-simulator', version: '2.0.0' }
Implementations always depend on the modules defining the port types they implement. Thus it is sufficient to add the implementation as a dependency. The separation is meant to allow different implementations for the same port type.
IDE Support
Kompics (Java) can be used with any IDE that supports Java and maven, such as IntelliJ, Eclipse, or Netbeans, for example.
Kompics Scala can be used with any IDE that supports Scala, such as IntelliJ, Scala IDE, or VSCode via Metals.
Build from Sources
The sources for Kompics Scala are hosted on Github.
To clone the sources you need Git installed on your machine.
Kompics Java from Source
To clone Kompics Java, for example, execute the following in a shell:
git clone git@github.com:kompics/kompics.git
If you have already cloned the repository previously then you can update the code with git pull:
git pull origin master
Change into the kompics
root directory and execute the following command to build and install a local Kompics version:
mvn clean install
Some of the tests take a very long time to execute and open a lot of file-descriptors. Depending on the rights on your machine, they might in fact fail for you. Either increase the number of concurrent open file-handles allowed for your user, or simply skip the tests with -DskipTests
.
Kompics Scala from Source
To clone Kompics Scala, for example, execute the following in a shell:
git clone git@github.com:kompics/kompics-scala.git
If you have already cloned the repository previously then you can update the code with git pull:
git pull origin master
Change into the kompics-scala
root directory and execute the following command to build and install a local Kompics Scala version:
sbt publishLocal