Scala Plugin for NetBeans - Rewrite in Scala #4: How to Use It to Develop Scala Itself

I begin to patch Scala's new designed compiler interface for IDE to get it work better (with NetBeans, and, other IDEs). I know lamp term may use Eclipse as their IDE to develop Scala itself, but I'm using new written NetBeans plugin. Here's a short tutorial of how to use NetBeans Scala plugin to work with Scala itself

Build Scala-2.8.0 snapshot

First and least, svn check out Scala's trunk source code:

cd ~/myprjs/scala/scala
svn co http://lampsvn.epfl.ch/svn-repos/scala/scala/trunk

Then, make sure your $JAVA_HOME is pointed to a JDK 1.5 instead of 1.6, and <b>clear $SCALA_HOME</b>. "ant dist" to build a fresh Scala distribution, which is located at ~myprjs/scala/scala/dist/latest

# As for Mac OS X
JAVA_HOME_BAK=$JAVA_HOME
export JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Home
export SCALA_HOME=
ant dist
export JAVA_HOME=$JAVA_HOME_BAK
export SCALA_HOME=~myprjs/scala/scala/dist/latest

Install latest NetBeans and Scala plugin

Download latest NetBeans nightly built from  http://bits.netbeans.org/download/trunk/nightly/latest, the minimal pack "Java SE" is enough.

Run NetBeans, get latest Scala plugin via: [Preference/Option] -> [Plugins] -> [Available Plugins], find "Scala Kit" in the list and choose it,following the instructions to get it installed, restart NetBeans.

Create NetBeans project by importing existing sources

Create project for Scala's trunk sources. <b>Note: each folder under "src" should be considered as standalone folder, for example, "compiler"</b>, it's better to create standalone project for each these folder, I created two, one for "compiler",another for "library".

[File] -> [New Project] -> [Scala] -> [Scala Project with Existing Sources]

ScalaTrunkProject1.png

Click [Next], input project name that you like Note: you can input an existed ant build script file name in "Build Script Name". Or, modify the auto-created one later, it's a plain ant build xml file.

ScalaTrunkProject2.png

Click [Next], add source folder:

ScalaTrunkProject2.png

Click [Next] again, you can see the sources that will be included in this project, then click [Finish]

ScalaTrunkProject4.png

Now, Scala's compiler has been imported as a NetBeans freeform project, it is an old plain ant project. You can create another one for Scala's library.

ScalaTrunkProject5.png

How to debug into Scala's compiler, library source?

If you have a project that want to debug into Scala's compiler, library sources, you could do when in debugging:

In debugging, open debugging source windows via: [Windows] -> [Debugging] -> [Sources]. Go through the listed source jars, find ".../scala-compiler.jar" and ".../scala-library.jar", check them.

  • Posted: 2009-08-29 09:00 (Updated: 2009-12-30 03:36)
  • Author: dcaoyuan
  • Categories: NetBeans

Comments

No comments.