Developer Tools: Eclipse Project Setup - UA-ScriptEase/scriptease GitHub Wiki
Now I'm gonna ask you one question, and all I want is a yes or no answer: Do you wanna live through this?
-- Seth Gecko
Here's an easy way to make life less confusing for you when setting up eclipse projects for ScriptEase II. I'm writing this assuming that you have Aspect J installed and are using Eclipse. The Big Idea here is that we'll have one project for ScriptEase II itself, and one project per Translator. It may be tempting to have one project at the trunk/branch directory, but Don't Do It. I've seen people try this set up and they always get confused as to what is the development version of a translator and what is the testing version.
##ScriptEase II
- Start your workspace somewhere in your home directory.
- Select File->New->AspectJ Project
- Name it ScriptEase
- Change the location to the
scriptease2
source directory in the master (or branch) folder. - Hit "Next"
- On the "Source" tab, change "Default output folder" to include a "/bin" at the end. If you don't, you'll end up with a huge glob of
.class
files cluttering directories, which is gross when trying to find things. - On the "Libraries" tab, choose "Add JARs..." and add all of the jars in
scriptease/resources/lib
and all subdirectories of it, including the ones in thexstream
subdirectory. At the time of writing, this includes 5 jar files, though that may change over time. - Hit "Finish"
(The following steps will no longer be necessary once we move to Java 1.7. )
- You also need to set the JRE to Java 6. Click on "Project -> Properties -> Java Compiler". Then click on "Configure Workspace Settings".
- Change the compliance level to 1.6.
- If there is a small error message above the Apply button, click it to go to your JRE paths.
- Download and install JRE 1.6 from http://www.oracle.com/technetwork/java/javase/downloads/jre6downloads-1902815.html
- Add a new JRE back in Eclipse pointing to the path of the installed JRE 1.6.
The first build of ScriptEase2 with Aspects is a little bit slower, but it shouldn't take too long. Subsequent builds will be much faster.
##Translators This will use the NWN translator as an example. Each translator will have its own quirks of required libraries, etc, but this should get you in the right direction. The first way to set up Translators is to create one project for each Translator.
- Go to File->New->Java Project
- Name the project. I'll call mine NWN Translator (Trunk)
- Navigate to the translator source root directory. This will be inside
translators_src/
(a sibling directory toscriptease2
) - Press "Next"
- Again, make sure the "Default output folder" ends with a
/bin
- On the "Projects" tab, "Add..." the relevant ScriptEase2 project.
- On the "Projects" tab, add whatever libraries the translator needs to compile, live, thrive, and generally smell nice.
- "Finish"
###Alternate Translator Setup Alternatively, you can set up the Translator as another source folder on the Build Path of your main project. Assuming that you have completed the steps above to create the project for ScriptEase II.
- Right-click on the root folder of your ScriptEase II project in Eclipse, and click Properties.
- In the Window that opens (see screenshot below), select Java Build Path.
- Add Folder... and choose the Translator (in this example,
translators_src/nwn
) - Make sure you check the checkbox "Allow output folders for source folders", and enter the correct Output folder for the Translator.
##ANT Compilation
If you want to get extra fancy, you can use the ANT script to compile these things. I like to do this for translators, so that I can make an install
target that will build the translator, package it, and copy it from the translators source into my development copy of ScriptEase II. You can do that by hand, of course, but automation is cool.
Note that this only works on Linux at the moment.
- View the Project Properties (Project->Properties)
- "Builders" section
- "New..."
- Select "Ant builder"
- Give it a name. I usually go creative and call it ANT builder
- For "Buildfile", browse to the build file (build.xml, likely). For translators, this is in the root of the translator source directory. For ScriptEase, it's in the trunk/branch's directory (so one up from the scriptease2 folder). In NWN this gives me ${workspace_loc:/NWN Translator (Trunk)/build.xml}
- For "Base Directory", browse the workspace to select the project folder. For NWN this gives me ${workspace_loc:/NWN Translator (Trunk)}
- Go to the "Targets" tab, and set the appropriate targets. Its defaults are almost always wrong. For NWN, it would look like:
- After clean: install
- Manual Build: compile
- Auto build: install
- During a clean: clean