The primary way to build MMT is via the Scala Build Tool (SBT). Building using SBT is only needed if you want to develop MMT or want to build from sources. If you develop in an IDE, it will automatically for you. Then you only need to use SBT to test your changes before committing.
SBT has to be installed separately but that is straightforward. We test with SBT 1.1.1 or higher.
SBT must be called from within the
src folder of the MMT repository, which contains the
Within sbt, run
mmt/deploy. That compiles the sources, packages them into a jar file, and produces the self-contained file
deploy/mmt.jar, from which MMT can be run with plain Java.
sbt commands are of the form
PROJECTis the MMT subproject corresponding to the subfolders, MMT consists of multiple independently maintained subprojects that are defined in the
build.sbtfile and correspond to subfolders of the
srcfolder. Example subprojects are
TARGETis the operation to perform, most importantly
For convenience, there is a special wrapper project
mmt that depends on the most important subprojects so that
sbt mmt/deploy builds all projects and bundles them into a self-contained jar.
All jar files are stored in the
That folder also contains all dependencies, but these are bundled automatically in the big jar file.
If sbt runs out of memory, give it about 2G of JVM heap space. There are various ways to configure that, e.g., with an environment variable SBT_OPTS=”-Xmx2G”.
TARGETs are declared as values of type TaskKey, and defined via
t := SCALA-CODE
t <<= SBT-TARGET
If PROJECT is omitted, TARGET is run on all projects in dependency order. If projects have dependencies, sbt never uses the deployed jars.
compile: compiles in
package: compile; then produce relative (non-assembled) jar in
assembly: package including all dependent jars to
test: compiles and runs tests
our custom TARGETs:
deploy: package; then move to deploy folder
deploy <<= CODEin
custom global TARGETs
cleandoc: remove files
unidoc(part of sbt); then
<folder> (project in ...)
scalaSource in TARGET)