Setting up CVS
Setting up the project in Eclipse
CVS on Windows

Setting up CVS

Using CVS or another versioning system is highly recommended for your project. It allows each group member to work individually without having to worry about how to merge different bits of code and also allows you to easily go back to a previous version of each source file in case you take an undesired path. The following sequence of commands will show you how to set up the CVS Repository, which stores all versions of your code, on ieng9.

setenv CVSROOT ~/CVSRepository
cvs init

Next, make the repository readable and writable by the group (note that you must have already submitted your group request and have had it processed):

chmod -R g+rw ~/CVSRepository

Then, extract all the starter code and import it into CVS:

cd; mkdir project1
cp ../public/starterCode.tar project1/
cd project1
tar xvf starterCode.tar
rm starterCode.tar
cvs import -m "Importing into repository" project1 vtag rtag

At this point, you should see a message saying that the import was complete and that there were no conflicts. Since the code is checked into CVS, we can remove this directory and then check it out from CVS: 

cd; rm -r project1
cvs co project1

Each team member should be able to check out the project1 module now and import the project into their own Eclipse environment.

Setting up the project in Eclipse

First, create a new project by File | New Project | Java Project. In the window that pops up, enter "project1" for the name, and select "Create project at external location", it being the directory where you checked out your files from CVS:

Once you've selected a valid path, click Next. In the next screen we need to tell Eclipse where to find the source for CUP since our parser depends on it. Click "Add Folder..." and select the path to the CUP code. You should copy the "/home/solaris/ieng9/cs131f/public/Tools/CUP" to your home directory and use that. If you are working on your home computer, just download the CUP directory to your local machine and use that:

After you click OK, you'll get a prompt that asks you whether to remove the project as source folder. Answer "No" to it, then click OK. At this point, the setup screen should look like this:

Next, click on "Finish". Eclipse will then compile the project for the first time. There should be no errors in the Problems tab at the bottom of the main window -- just warnings, most of which are in the CUP code. If there are errors, you should go back and make sure you didn't miss a step.

What follows is the trickiest part. We need to tell Eclipse how to compile the .CUP file which contains the grammar for our compiler. Since you are going to be making additions to that file to call the appropriate Java functions for various events regularly, it would be nice to have Eclipse automatically reconstruct the parser.java file when you save. To do this, we need to set up a custom builder. Select Project | Properties from the main menu. Then click on "Builders" on the left and then "New...". Select "Program" then OK. Give it the name "CUP". For location, we need to specify the path to the make program. On the workstations in the lab, this will be "/usr/ccs/bin/make". If you are on a Windows machine at home, you will need to download a tool like Cygwin, which is a Linux-like environment for Windows with various utilities that you normally find on Unix/Linux systems. Remember to install the make package from the Development category and when set up, the path should be "C:\cygwin\bin\make.exe". You will also need to make sure that "C:\cygwin\bin" is in your path.

Select the project1 directory as the working directory by clicking on "Browse File System...". Under arguments, put "parser.java". When you are done, the screen should look like this:

Before clicking on OK, make sure you select the "During Auto Builds" option from the Build Options tab. Lastly, select CUP on the properties screen and click "Up" on the right to make it the first build that occurs. Then click OK and you should be all done.

CVS on Windows

I have not been able to figure out how to have Eclipse interact with CVS on ieng9 yet, so in the meantime, you can check out/commit your code on Windows in a command prompt using the CVS and SSH packages that Cygwin provides. When installing Cygwin, make sure that you have selected the "cvs" and "openssh" packages. Once installed, set the following environment variables, by right-clicking on "My Computer", select Properties, click on the Advanced tab and then click on "Environment Variables. For each of the variables below, click on "New" and enter in the corresponding name and value:

CVS_RSH = ssh
CVS_SERVER = /software/common/gnu/bin/cvs
CVSROOT = <username1>@ieng9.ucsd.edu:/home/solaris/ieng9/cs131f/<username2>/CVSRepository

You'll need to replace <username1> with your login and <username2> with the login of whoever holds the CVS repository. Next, in the same window, update the already existing PATH environment variable by adding";C:\cygwin\bin" to the end, assuming C:\cygwin is where you installed Cygwin.

You should now be able to check out your code from ieng9 in a DOS prompt. Open a DOS prompt (Start | Run | cmd.exe) and type "cvs co project1". That should connect to ieng9 and ask you for a password. Enter it in, and the module should be checked out.

 

If you have any questions or difficulties with any part of the instructions, please send me an email: cs131f5@ieng9.ucsd.edu