Skip to content

Try | Local installation

Vlad Ureche edited this page Aug 13, 2013 · 6 revisions

This guide will walk you through installing and running the miniboxing plugin on your machine.

There are several steps that need to be done:

Installing Sbt

Sbt (which stands for simple build tool) is the equivalent of Maven in the Scala world. The instructions on downloading it and installing it are available here. You can install either version 0.12.x or 0.13.x, either way, the correct version for each of the projects will be downloaded automatically.

Quick and dirty sbt 0.13.0 install:

$ wget http://repo.scala-sbt.org/scalasbt/sbt-native-packages/org/scala-sbt/sbt
$ unzip sbt.zip 
$ echo 'export PATH='`pwd`'/sbt/bin:$PATH' >> ~/.bashrc 
$ source ~/.bashrc

Now invoke sbt in /tmp to check it works:

$ cd /tmp
$ sbt
Starting sbt: invoke with -help for other options
Getting net.java.dev.jna jna 3.2.3 ...
downloading http://repo1.maven.org/maven2/net/java/dev/jna/jna/3.2.3/jna-3.2.3.jar ...
	[SUCCESSFUL ] net.java.dev.jna#jna;3.2.3!jna.jar (1325ms)
:: retrieving :: org.scala-sbt#boot-app
	confs: [default]
	1 artifacts copied, 0 already retrieved (838kB/13ms)
Getting Scala 2.9.1 (for sbt)...
downloading http://repo1.maven.org/maven2/org/scala-lang/scala-compiler/2.9.1/scala-compiler-2.9.1.jar ...

... <grab a coffee while sbt is downloading the entire Internet>

[info] Set current project to default-8c3933 (in build file:/tmp/)
> 

Use Ctrl-D or the exit command to close down sbt.

Cloning the Miniboxing Repository

The miniboxing repository is available on github and you can either fork it or just clone the main repository. The main branches are:

  • master keeps a stable version of the plugin, and is usually a bit behind
  • wip is the main development branch
  • wip-<topic> are development branches for specific purposes (example: wip-jvm is meant for development on different Java Virtual Machines)

To clone the repository on your machine you will need git.

The command to clone the main repository in read-only mode is:

$ git clone [email protected]:miniboxing/miniboxing-plugin.git -b wip

Now, let's compile the project and make sure tests pass:

$ cd miniboxing-plugin
$ sbt compile package test
... (grab a coffee, it's going to download another part of the Internet)
... (also ignore all warnings, they're harmless)
[info] No tests to run for miniboxing/test:test
[info] Compiling 2 Scala sources to /home/mbtest/miniboxing-plugin/tests/correctness/target/scala-2.10/test-classes...
[info] No tests to run for miniboxing-runtime/test:test
[info] No tests to run for miniboxing-plugin/test:test
[info] No tests to run for miniboxing-benchmarks/test:test
[warn] there were 2 deprecation warning(s); re-run with -deprecation for details
[warn] one warning found
[info] Test run started
[info] Test miniboxing.classloader.test.ClassloaderTest.testTargetFactoryClassLoaderSuper started
... tests for the classloader, they should all pass ...
[info] Test miniboxing.classloader.test.ClassloaderTest.testTargetDispatcherFactoryClassLoaderInt started
[info] Test run finished: 0 failed, 0 ignored, 11 total, 0.152s
[info] Passed: : Total 11, Failed 0, Errors 0, Passed 11, Skipped 0
[info] Test run started
[info] Test miniboxing.infrastructure.TestSuite.testCompileOutput started
Picking tests from: /home/mbtest/miniboxing-plugin/components/plugin/target/scala-2.10
Picking tests from: /home/mbtest/miniboxing-plugin/tests/correctness/src/miniboxing/tests/compile
Compiling gh-bug-1.scala                                               ... [ OK ]
... tons of tests for the plugin, they should all pass ...
Compiling mb_tparams_rewire_new.scala                                  ... [ OK ]
[info] Test run finished: 0 failed, 0 ignored, 1 total, 32.447s
[info] Passed: : Total 1, Failed 0, Errors 0, Passed 1, Skipped 0
[success] Total time: 39 s, completed 13 août 2013 14:43:11

Okay, if you see [success] there, it passed all tests. :)

To run the benchmarks, refer to the Reproducing the benchmarks chapter.

Install Scala and Set Paths (optional)

Setting up Scala allows you to compile your own programs with the miniboxing plugin. First, download the latest Scala 2.10 release (choose the first 2.10 release that ends in .tgz from here):

$ wget http://www.scala-lang.org/files/archive/nightly/distributions/scala-2.10.3-20130812-120849-1a0318454a.tgz -O scala.tgz
$ tar xf scala.tgz 
$ mv scala-2.10* scala

To test scala, run the repl:

$ scala/bin/scala
Welcome to Scala version 2.10.3-20130812-120849-1a0318454a (Java HotSpot(TM) 64-Bit Server VM, Java 1.7.0_25).
Type in expressions to have them evaluated.
Type :help for more information.

scala> <Ctrl-D to exit>

Now, let's set the paths to scala and to the miniboxing plugin:

$ cd scala
$ echo "export SCALA_PATH=`pwd`/bin" >> ~/.bashrc
$ cd ..
$ cd miniboxing-plugin
$ echo "export MINIBOXING_PATH=`pwd`" >> ~/.bashrc
$ echo export PATH=`pwd`':$PATH' >> ~/.bashrc
$ source ~/.bashrc

Now, running mb-scalac -Xshow-phases in any directory should say:

$ mb-scalac -Xshow-phases
             phase name  id  description
             ----------  --  -----------
                    ...  ..  ...
                minibox  13  
                    ...  ..  ...

For trying out the miniboxing plugin, see this page.

Load the Miniboxing Project in Eclipse (optional)

Loading the miniboxing project in Eclipse allows you to browse the source code of the project using an IDE.

  • You will need an Eclipse installation with the ScalaIDE plugin. The easiest way to get it is to download the ScalaIDE bundle for Scala 2.10.
  • Then run sbt eclipse in the console:
$ cd miniboxing-plugin
$ sbt eclipse
... (grab ice cream)
  • Finally, load up Eclipse and go to File > Import... > Existing Projects into Workspace and point Eclipse to the miniboxing-plugin directory. Then load all projects.

For more details on exploring the projects, see this page.