Tuesday, May 25, 2010

Mini how-to for building Scala from SVN

Steps to setup development environment for Scala compiler with Eclipse Scala plug-in:
  1. Install JDK 1.6.0 or above (e.g. Sun JDK 6.0 version 1.6.0_19):
    • JDK is available on http://java.sun.com/.
    • Remember to set the JAVA_HOME environment variable after installation.
    • (Optional) Add JAVA_HOME/bin to PATH for executing Java commands.
  2. If you want to use Eclipse then install Eclipse 3.5 or above (e.g. Eclipse 3.5.2): 
  3. Install Scala plug-in for Eclipse
  4. Extract Scala source, either:
    • If using Eclipse:
      • Decide where your workspace is (will be reference later), switch to the SVN perspective. If you are not familiar with Eclipse, in menu Help -> Welcome may help you a lot.
      • Browse SVN to know SVN information.
      • Create a new repository, extract scala source
    • If not using Eclipse then from command line: svn co http://lampsvn.epfl.ch/svn-repos/scala/scala/trunk scala
  5. Build Scala compiler source
    • If you want to build from the command line with ANT check link: http://www.scala-lang.org/node/217
    • For Eclipse:
      • Open in any text editor file .classpath from root folder and add after tag <classpath>
      <classpathentry kind="con" path="ch.epfl.lamp.sdt.launching.SCALA_CONTAINER"/>
      • Close File
      • Import src catalog to eclipse workspace
      • Right click on build.xml and select Run As -> Ant Build optionally you can just use shortcut Alt+Shift+X,Q
  6. Debug Compiler
    • Add new deconfiguration by click on and selecting from menu Debug Configuration…
    • Add new item under Scala Application
    • create HelloWorld.scala file under root folder and paste sample Scala code
    • under Main tab set Main class to: scala.tools.nsc.Main
    • under Arguments tab (Remember to replace {PathToSrc} with path to Scala src) set
      • Program arguments: HelloWorld.scala -target:jvm-1.5 -d bin
      • VM arguments: -Xbootclasspath/a:{PathToSrc}\build\pack\lib\scala-compiler.jar;{PathToSrc}\build\pack\lib\scala-library.jar;{PathToSrc}\build\pack\lib\fjbg.jar;{PathToSrc}\build\pack\lib\msil.jar;{PathToSrc}\lib\original_msil.jar
  7. Done!
In case of any problems please let me know.

No comments:

Post a Comment