Skip to main content
Last updated June 16, 2012 02:28, by dr2chase

Fortress development with Eclipse currently requires:

• Eclipse version 3.6. If you are accessing the network from behind a proxy, Eclipse needs to know that before it can access plugins. Proxies can be configured at Eclipse -> Preferences -> General -> Network Connections. If you are using MacOS, "Native" appears to be the best choice.
• Scala plugin version "2" (currently in beta) (copy the link, don't click it). If the Eclipse plugin link fails, go here instead to download the zip file and install locally.
 http://download.scala-ide.org/releases-29/stable/site

• (optional) Mercurial for Eclipse
 http://andrei.gmxhome.de/eclipse/ (3.5-3.7 plugins)

• (optional) ASM Framework (do NOT get Bytecode Outliner from here)
 http://download.forge.objectweb.org/eclipse-update/

• (optional) Bytecode Outliner
 http://andrei.gmxhome.de/eclipse/ (3.6-3.7 plugins)


Ant requires too many platform-specific options (stack and heap size, for example) to be easily configurable from within Eclipse, so common practice is to at least build the generated files outside Eclipse ("ant generated"), and then refresh and rebuild. In practice, relevant changes to the generated files or the code generating them are rare, so it is easy enough to work almost entirely within Eclipse. If Eclipse reports a large number of errors with a freshly checked-out and ant-generated repository, try instead "ant compile" and refresh. If that fails, try cleaning the project and rebuilding.

## Expanding heap and stack

Find and edit eclipse.ini, which might be located someplace like this:

 eclipse/Eclipse.app/Contents/MacOS/eclipse.ini


The vmargs parameter as shipped uses these heap settings:

 -Xms40m
-Xmx256m


It needs to specify a larger heap and more stack.

 -Xss8m
-Xms800m
-Xmx2048m
-XX:NewSize=400m


Adjust the max heap size ("mx") to be sure that it fits in real memory. "ms" should be at least twice the "NewSize".

## Cloning (checking out) with MercurialEclipse

1. New -> Project...

2. Mercurial -> Clone Existing Mercurial Repository

3. Specify the repository url, username, and directory for the checkout (that should not conflict with existing directories)

4. Choose the default revision

5. This next step is a little confusing. If the name of the project (specified in the embedded .project file) conflicts with an existing project, the project and directory will be grayed out and unselectable. To fix this, double-click on the grayed-out name itself.

6. You should then see a pane giving you the option to rename the project itself.

7. And then it is possible to go forward.

## Initial build

We haven't been able to get Eclipse's ant integration to work properly across all platforms. Instead, in the top-level directory, from the command line, type "./ant compile". This will create all the generated files need to compile the system, and then compile the system. The reason for "./ant" is that ant requires different JVM parameters to build Fortress on different platforms (this is also why we have not succeeded in running ant from within Eclipse).

Whenever the project appears to get in a peculiar state within Eclipse, if all else fails, exit Eclipse, rebuild from the command line, start Eclipse, and Refresh the project.

## Fortress Compiler and Runtime Run Configurations

The portions of the Fortress Compiler and Runtime written and Java can be stepped through using the Eclipse debugger (also works for those portions written in Scala, though less nicely).

### Compiler Run Configuration

1. Run -> Run Configurations ...

2. New Java Application launch configuration [image]

3. Main Tab:

• choose a name and set the project to your Fortress directory
• Main Class = "com.sun.fortress.Shell"

4. Arguments Tab:

• Program Arguments = compiler input as from command line (you will update this to compile different programs)

for example: "link -debug stacktrace ProjectFortress/compiler_tests/Compiled17dddd.fss"

### Runtime Run Configuration

1. Run -> Run Configurations ...

2. New Java Application launch configuration

3. Main Tab:

• choose a name and set the project to your Fortress directory
• Main Class = "com.sun.fortress.runtimeSystem.MainWrapper"

4. Arguments Tab:

• Program Arguments = Fortress Executable to Run (you will update this to run different programs)

for example: Compiled17dddd

• VM arguments = any additional runtime arguments

for example: -Dfortress.bytecodes.expanded.directory=. -Dfortress.bytecode.list=1 (saves on the fly classes)

5. Classpath Tab: Add two entries under User Entries by selecting the "Advanced..." button on the left and adding a Variable String for:

• ${workspace_loc}/PFC/default_repository/caches/bytecode_cache/* •${workspace_loc}/PFC/default_repository/caches/nativewrapper_cache/

Be sure that these appear BEFORE the default classpath; order is important.

Please Confirm