RubyBuildInstructions

Contents


Installation

If you just want to run the NetBeans Ruby support rather than build it, check the RubyInstallation document first.

Other Documentation

Please see WorkingWithNetBeansSources first for some generic instructions about how to build the IDE etc.

Prerequisites

You need Java SE 5 or later.

You need ant 1.7 or later.

Building From Within the IDE

Checkout

IMPORTANT: If you want to build Net Beans 6.1 it no longer uses CVS see the WorkingWithNetBeansSources page for updated instructions.

Go to Versioning | CVS | Checkout... and use the following CVSROOT: :pserver:anoncvs@cvs.netbeans.org:/cvs

(If you have a netbeans.org login (which you need to file issues etc. - see RubyParticipation) you can replace anoncvs in the above with your own username.)

Check out the nbbuild module. When it has been checked out, the IDE will offer to open the associated NetBeans project - say yes.

To build a Ruby-configuration of the IDE rather than The Whole Shebang, right click on the project and choose New | Properties File.... Use the name user.build such that the created file is named user.build.properties and is located in the {{nbbuild} directory.

Edit the file such that it contains the following single line:

 
cluster.config=ruby 

If you want to build the IDE on JDK 6, you need to also add the following line:

permit.jdk6.builds=true

This is forbidden by default because NetBeans needs to be compilable on JDK 5, and by compiling on JDK 6 you run the risk of relying on Java 6 APIs and features (such as specifying @Override on a method that implements an interface method rather than an inherited method from a class) and you should never check these changes into the codebase.

Now we can check out the code necessary to build the Ruby configuration of the IDE. Right click on the build.xml file and choose Run Target and in the pull-right menu (which lists all the available targets), choose checkout.

That will check out all the code necessary to build the IDE - and will take a while.

Build

When it's done, you can build the whole IDE by just running the default target (which is at the top of the Run Target menu - build-nozip).

Once you have a complete IDE build you can rebuild individual modules by just right clicking on them and choosing build, or setting them as the "Main Project" and using the keyboard shortcuts to do it.

Doing Development with the IDE

Start NetBeans and open one or more of the Ruby projects. The "Open Project" filechooser lets you multiselect so you can open many at one time. You probably do NOT want to open all the dependent projects (unselect that checkbox in the filechooser if necessary). If you're going to be working on for example Ruby hints, you'll want to open "ruby/rubyide", "ruby/hints", and "ruby/editing".

Set the "ruby/hints" module as your Main project. You can now use toolbar buttons or keyboard shortcuts to just rebuild the hints module. You can also right click on the "Ruby NetBeans IDE" (ruby/rubyide) project to run the Ruby IDE under a debugger. Breakpoints etc. should all be working as you expect.

CVS diffing, updates and checkins also work in a straightforward way. For example to view your local changes, right click on the project and choose "CVS | Show Changes", and click on the Diff button in the CVS window to inspect the changes before checking them in.


Building From the Command Line

Setup

Check out the nbbuild module, and edit {{user.build.properties} to specify a Ruby configuration to be built.

IMPORTANT: If you want to build Net Beans 6.1 it no longer uses CVS see the WorkingWithNetBeansSources page for updated instructions.

 
$ CVSROOT=:pserver:anoncvs@cvs.netbeans.org:/cvs 
$ export CVSROOT 
$ cvs login 
$ cvs co nbbuild 
$ cd nbbuild 
$ echo cluster.config=ruby>> user.build.properties 

(You may also need permit.jdk6.builds=true if you want to build on JDK 6 - see comment above in the IDE builds section.)

(When running the cvs login command above, just hit Return to use an empty password for anoncvs. If you have a netbeans.org login use your username in place of anoncvs above).

As noted in WorkingWithNetBeansSources, your ~/.cvsrc file should specify -P -d for update and -P for checkout:

 
$ cat ~/.cvsrc 
update -d -P 
checkout -P 

You may also want to set $ANT_OPTS to control some build flags... here's mine:

 
% echo $ANT_OPTS 
-Dbuild.compiler.debug=true -Xmx512m 

Build

Run the "checkout" target to check out the code necessary for the current build configuration, and the default target to build the bits.

 
$ ant checkout 
$ ant 

This will build the IDE, which you can now run - it's nbbuild/netbeans/bin/netbeans. You can also invoke it with

 
$ ant tryme 

Update

To update your build, go to the nbbuild directory and run the following targets:

 
$ cd nbbuild 
$ cvs update
$ ant clean && ant checkout && ant 

(The checkout target will perform an update).

That's all there is to it!

 
cvs -d :pserver:anoncvs@cvs.netbeans.org:/cvs checkout -P standard 

It is very important that you include the -P flag in the above command since there are some old empty directories in CVS that will cause the build to fail if they are not pruned on checkout.

Updating Ruby

When doing development on Ruby, you don't need to rebuild and update the whole IDE every time. The ruby/build.xml ant file lets you rebuild only the Ruby support. To update just the Ruby stuff, do the following:

 
$ cd ruby 
$ cvs -q update -P -d 
$ ant clean && ant 

To run the unit tests:

 
$ cd ruby 
$ ant runtests 


Build a Ruby-Only IDE

The Ruby-IDE that is built on http://deadlock.netbeans.org/hudson/job/ruby/ is using the following build script:

 
nbbuild/hudson/ruby 


To build a Ruby-only version of the IDE, run the following commands:

 
cd nbbuild 
ant build-nozip 

You can inspect that build script to see how to build a slimmed down IDE.

Building The Development Module

There is a diagnostics module, ruby/gsf/tools which adds some tools really useful for doing development of the Ruby feature. It contains:

  • An AST viewer
  • A code index browser
  • A lexical token spy

To build it, open the ruby/gsf/tools module and build it. When you restart the IDE you'll see a "Development" pullright menu in the Windows menu which contains some of these tools.

Troubleshooting

If the code fails to build, it is possible that the codeline is in a bad state - perhaps somebody is in the middle of committing changes. If you are building the whole IDE, check that NetBeans itself is currently building by checking the continuous NetBeans builds at http://deadlock.netbeans.org/hudson/job/trunk/. Second, check that the Ruby support itself is buildable at http://deadlock.netbeans.org/hudson/job/ruby/. Also keep an eye on the daily unit tests run at http://deadlock.netbeans.org/hudson/job/rubytests/.

Filing Bugs

File bugs in the ruby category: http://ruby.netbeans.org/issues/enter_bug.cgi?component=ruby&issue_type=DEFECT

Mailing Lists

Subscribe to dev@ruby.netbeans.org: http://ruby.netbeans.org/servlets/ProjectMailingListList

Updating JRuby

We're bundling a snapshot of JRuby. It used to be modified to remove some encryption code (for U.S. export law reasons), but that is no longer necessary. The current bundled JRuby is identical to a download from the JRuby web site, except it has been recompressed using .zip rather than .gz for greater ant script portability.

To rebuild jruby-src.zip, download jruby, extract it, and then run:

 
ant dist-src 

Then gunzip and untar the build tree, and I compress it using zip instead. The final zip file is then copied into ruby/jruby/external/jruby-src.zip.

Note that the source tree needs to be 1.0.0; when the version number changes, there are some places in the IDE that need to be updated. For now, your easiest bet is to simply rename the directory between untarring and rezipping it.

If you are building the IDE modules from scratch you may also have to update the patched versions in ruby/jruby/patched_files/.

Not logged in. Log in, Register

By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo