-
Notifications
You must be signed in to change notification settings - Fork 0
Using Eclipse with JRuby Truffle
Eclipse is an alternative IDE for editing JRuby+Truffle. It provides much better feedback from the Truffle DSL annotation processor and actually keeps the project built at all times.
First, make sure the project is already built from the command line:
$ mvnCreate a new workspace in Eclipse (>= Luna).
Start by ensuring there is no leftover configuration:
$ rm -rf {core,truffle}/{.classpath,.settings,.project}We can now import the two projects:
- From the main menu bar, select
File>Import... - Select
Maven>Existing Maven Projects - Select
jruby/coredirectory as root directory (NOT just jruby) - Click
Finish - Repeat with
jruby/truffleas root directory
And now enable the Truffle annotation processor.
This depends on your branch:
on master
- Select the
truffleproject - Right click and choose
Properties - Select
Java Compiler>Annotation Processing - Click on
Enable project specific settings, - Add
lib/jruby-truffle.jarusingAdd External JARs, on the submenuFactory Path - Click
OkandYesto rebuild the project
on truffle-head
- Install the m2e-apt plugin.
- Select the
truffleproject - Right click and choose
Properties - Select
Maven>Annotation Processing - Click on
Enable project specific settings, - Select the first option: "Automatically configure the JDT APT"
- Click
OkandYesto rebuild the project
We must now import the layout generated files.
- Select the
truffleproject - Expand in the file hierarchy:
trufflethen insidetargetandgenerated-sources. - Right click on the
generated-sourcesfolder and selectBuild Path>Use as Source Folder
Then, - Select the
truffleproject - Right click and choose
Properties - Select
Java Build Pathand theSourcetab. - In the list find
truffle/target/generated-sources - Select
Included: (All)just below - Click
Editon the right side. - Click the
Addbutton on the right side ofInclusion patterns - Click
Browse... - Expand the file hierarchy:
orgthenjruby, thentruffleandruntime - Select the
runtimefolder and clickOK,OKagain andFinishand a finalOK.
Change the Output folder to not interfere with the Maven build for each project:
- Select the
coreproject - Right click and choose
Properties - Select
Java Build Pathand theSourcetab. - Uncheck
Allow output folders for source folders - In
Default output folder:enter[PROJECT]/build.eclipse(with[PROJECT]replaced bycorehere) - Select
Yeswhen asked about removing generated resources in the old location - Repeat with the
truffleproject
You shall be set!
Use the tool/jruby_eclipse script to run directly from Eclipse .class files.
Any change in truffle Java or Ruby files will be available as soon as Eclipse finishes compiling.
$ tool/jruby_eclipse -X+T -e 'p RUBY_ENGINE'
"jruby+truffle"The jt workflow tool
automatically picks up that script over bin/jruby if you have
export JRUBY_ECLIPSE=true in your environment.
You can use Aptana Rails to be able to edit ruby files inside Eclipse. See http://stackoverflow.com/questions/12366924/how-to-use-eclipse-for-ruby-on-rails-ror