Permalink
Branch: master
Find file Copy path
d847986 Aug 10, 2018
2 contributors

Users who have contributed to this file

@dougxc @gilles-duboscq
73 lines (47 sloc) 4.79 KB

Loading the Project into IDEs

IntelliJ

Download and install the latest IntelliJ IDEA Community Edition: https://www.jetbrains.com/idea/download/

Change the IntelliJ maximum memory to 2 GB or more. As per the instructions, from the main menu choose Help | Edit Custom VM Options and modify the -Xmx and -Xms options.

Enable parallel builds in Preferences > Build, Execution, Deployment > Compiler > Compile independent modules in parallel.

Open IntelliJ and go to Preferences > Plugins > Browse Repositories. Install the following plugins:

Make sure you have mx installed and updated (mx update). Then, to initialize IntelliJ project files, go to the root of your project and invoke: mx intellijinit

Open the folder of your freshly initialized project from IntelliJ (IntelliJ IDEA > File > Open…). All depending projects will be included automatically.

Configure the Eclipse Code Formatter (IntelliJ IDEA > Preferences > Other Settings > Eclipse Code Formatter):

  1. Set "Use the Eclipse code formatter"
  2. Choose the right version of the formatter for your project (e.g., 4.5 vs 4.6)
Making IntelliJ Feel Similar to Eclipse (Optional)

Set IntelliJ to use the Eclipse compiler by going to IntelliJ IDEA > Preferences > Build, Execution, Deployment > Java Compiler To make IntelliJ work the same way as Eclipse with respect to Problems View and recompilation you need to:

  1. In preferences set the "Make project automatically" flag.
  2. Open the problems view: View > Tool Windows > Problems
  3. Navigate the problems with Cmd ⌥ ↑ and Cmd ⌥ ↓

Eclipse

This section describes how to set up Eclipse for Graal development. For convenience, $GRAAL denotes your local Graal repository.

Eclipse can be downloaded here. The currently recommended version for Graal development is 4.7.3a ("Oxygen").

Once you have installed Eclipse, if you have multiple Java versions on your computer, you should edit eclipse.ini to specify the JVM that Eclipse will be run with. It must be run with a JDK 9 or later VM. For example:

-vm
/usr/lib/jvm/jdk-9.0.4/bin/java

When first launching Eclipse, you should create a new workspace for Graal development. Select the parent of $GRAAL as the workspace as you will also be importing projects from the suites that Graal depends on.

The configurations created by the mx eclipseinit command binds projects to Execution Environments or JREs corresponding to the Java compliance level of the projects. You need to configure these Execution Environments and JREs as follows:

  1. From the main menu bar, select Window > Preferences.
  2. On the left, select Java > Installed JREs
  3. Ensure there is an installed JRE with the name jdk-11.
  4. Select Execution Environments and configure the JavaSE-1.8 environment.
  5. Click OK

Run mx eclipseinit to create the Eclipse project configurations for all the Java projects then use the Import Wizard to import the created/updated projects:

  1. From the main menu bar, select File > Import... to open the Import Wizard.
  2. Select General > Existing Projects into Workspace and click Next.
  3. Enter the parent of the $GRAAL directory in the Select root directory field.
  4. Under Projects select all the projects.
  5. Click Finish to complete the import.

Any time Eclipse updates a class file needed by the Graal runtime, the updated classes are automatically deployed to the right place so that the next execution of the VM will see the changes.

After updating your Graal sources and re-running mx eclipseint, a new Eclipse projects made be created and old ones removed. This usually results in an Eclipse error message indicating that a project is missing another required Java project. To handle this, you simply need repeat the steps above for importing projects.

In order to debug Graal with Eclipse, you should launch Graal using the -d global option as described Debugging.