The following describes the procedure for setting up an Eclipse development environment to build and debug the X10DT.
Note that this is starting with an entirely new Eclipse installation and workspace.
- Make sure you have at least Java 1.6.
- Install Eclipse 4.4.2 Luna IDE for Java Developers
- Install the Eclipse PDE (Plugin Development Environment) via Eclipse Update
- Install SWTBot (an Eclipse UI testing framework) via Eclipse Update.
- Finish the install as above, and restart Eclipse when asked.
Really, the easiest way to get all the prereqs is to install the X10DT itself into your development workbench. However, this might possibly interfere with normal workbench operation, so instead, we opt to install just the prerequisites.
- Download the latest X10DT update site zip from our file downloads. Select the most recent release, and download x10dt-update-site-VERSION.zip.
- As above, go to "Help" -> "Install New Software".
- Click on the "Add..." button next to the "Work with:" field.
- Click on "Archive..." and find the update site zip you just downloaded. Give the location any name you wish, and click "Ok".
- Install the following features from this update site zip. To see these individual features, uncheck the "Group items by category" box in the "Install New Software" dialog.
- IMP Runtime
- IMP Support for Java-Hosted Languages
- IMP Program Analysis
- LPG Runtime
- ANTLR Runtime
- X10 WALA
- Finish the install and restart Eclipse when asked.
- Install PTP (Eclipse Parallel Tools Platforms) via Eclipse Software Update
Our goal is to checkout pretty much all the projects from the X10 and X10DT git repositories and get them into our Eclipse workspace.
If you are most comfortable using command line tools, clone the X10 GitHub git repository at https://github.com/x10-lang/x10.git and the X10DT GitHub git repository at https://github.com/x10-lang/x10dt.git. Then import all of the Eclipse projects found in the two repositories into your workspace using the "Import existing projects into the workspace" wizard.
If you are most comfortable doing things in Eclipse, do the following steps
- Go back to the Plug-in Development or JDT perspective.
- Checkout the x10dt_project_sets project from X10DT git at https://github.com/x10-lang/x10dt.git
- Right click on x10core-25.psf and select "Import Project Set..."
- Right click on x10dt-25.psf and select "Import Project Set..."
- Go to a console window, cd to the x10.dist project directory in your workspace. (Note: this step requires Internet access, as it pulls down jars for its dependencies from the web.)
- ant dist update-host-fragment
- Note: This will take a few minutes. This includes building the X10 runtime for both the Java and C++ back-ends. It also copies certain key bits from the x10.dist project that you just built (like the "include" and "lib" folders that contain the X10 runtime's platform-specific headers and libraries) to the right spot in the platform fragment project. This is necessary to run the X10DT and perform local C++ back-end builds and launches.
- Once this is done, select the "x10.runtime", "x10.compiler", and "x10.dist" projects in the Package Explorer and invoke "Refresh" from the context menu. This gets Eclipse to "notice" a few .java files in the X10 runtime that got generated from .x10 source files.
- Go to Preferences -> Plugin Development -> API Baselines. Change the options for Missing API Baselines to Ignore.
- Your workspace projects should now all be compiling cleanly.
- In a console do: ant squeakyclean dist update-host-fragment
- Refresh your workspace in Eclipse (so it sees the new generated artifacts) and let it build.
- If all is well, everything should now be building and not bleeding red
- if there are still any (red) compile errors, go back and fix them ...
- Open run launch config dialog (Run > Run Configurations...)
- Make a new "Eclipse Application" configuration; call it e.g. "x10dt"
- Give it a clean (new) workspace location
- More heap space recommended: On the Arguments tab, add this to VM Arguments: -Xmx512m
- Click Run
- In the new Eclipse workbench that launches
- Open the X10 Perspective
- "New" > "X10 project (Java back-end)"; give it a name e.g. "Hello"
- Source file Hello.x10 opens in an editor
- Saving it starts a build.
- To see any errors that we log (for the brave), Open Error Log view: Window > Show View > Other... and under General (or, in older Eclipses, "PDE runtime"), select "Error Log"
- Most are not fatal
- To Run, Open Run Dialog... and create a new config for "X10 Application"
- On Main tab, fill in"Project:" (use Browse...) ; fill in "Main Class:" (use Search... should find e.g. Hello$Main ... just Hello will work too)
- Click 'Run' and the program should execute and print output in the Console view