Plugin:Building

From ENIGMA

Revision as of 18:35, 21 May 2013 by IsmAvatar (Talk | contribs)
Jump to: navigation, search

Building the Plugin that interfaces between LateralGM and ENIGMA is usually done by a developer with a full arsenal of developer tools. Fortunately, the process has been simplified and documented for interested parties. These instructions walk you through the process of installing the necessary tools (or even the full arsenol) and then performing a build in ways officially recognized by the devs. Other methods are welcome, of course, and do feel free to document them here.

This process is for the newer Git repository. For those interested, our older SVN-based process has been archived to Plugin:Building svn.

Contents

Prerequisites

Bare Essentials

Developer's Arsenal

Dependencies

Getting Dependencies and Source Code

The dependencies (LGM and JNA) are usually included in an install from the ENIGMA repository, as is The Plugin's source code, so chances are you already have a copy. If not, please follow the appropriate instructions on the Install page.

The required files will usually be located in the following locations:


You can optionally import the LateralGM and JoshEdit projects into Eclipse, if you are interested in developing either of those (LateralGM requires JoshEdit). In this case, you will not need the lgm16b4.jar dependency. Instructions for installing them may be found at LateralGM:Building.

Or, you may download them from their respective websites.

Linking it all up

Start up Eclipse, if you haven't already. In the briefest of terms, we need to load up The Plugin source as a project, and then modify the build path to add the dependencies as external jars. At first hand, these may seem like fairly simple tasks, but Eclipse is a very powerful program with many menu and wizard options that you won't be using, so it's very easy to get lost in the menus and wizards. As such, this section explains how to do this, step by step.

Load up the source

We begin by creating a New Java Project which will contain our plugin's source.

  1. Click File > New > Java Project.

If you don't see Java Project as an option, you probably don't have the Eclipse JDT installed, so close Eclipse, install the JDT, restart Eclipse, and try again.

Once you have done this, you will be taken to the New Java Project wizard.

At this point, you need to know whether your Plugin Source code is contained in a directory (such as enigma-dev/pluginsource, or from extracting enigma.jar) or inside enigma.jar.

Source in directory

  1. Contents should be Create project from existing source.
    • Some versions do not show this section, and instead have a Use default location checkbox. Uncheck it.
  2. For the location/directory, browse to the directory (such as enigma-dev/pluginsource).
  3. Working Sets should be left as-is.
  4. Proceed to #Modify the build path.

Source in enigma.jar

  1. Enter a Project Name that you like, such as Enigma.
  2. Contents should be Create a new project in the workspace.
    • Some versions do not show this section, and instead have a Use default location checkbox. Ensure it is checked.
  3. JRE may be left as-is.
  4. Project Layout should be Use project root..., the first option.
  5. Working Sets should be left as-is.
  6. Click Finish.

And now we import.

  1. In the project tree under Project Explorer, locate the new Enigma project.
  2. Right Click > Import... (about halfway down the dropdown menu).
  3. In the wizard, expand General, and select Archive File. Click Next.
  4. For From archive file, browse to enigma.jar.
  5. Ensure that the folder named / is checked in the left tree pane.
    • If it's only partially checked (e.g. a solid filled checkbox without a checkmark), uncheck and re-check it.
  6. Leave Into folder as-is.
  7. Check Overwrite existing resources without warning.
  8. Click Finish.
  9. Proceed to #Modify the build path.

Modify the build path

The Plugin needs some external jars linked in. In order to make this process more modular among other projects, The Plugin defines a library for each of the external jars. You still need to link in the jars, but rather than linking them straight into the project, you can link them to their respective library. This is useful for a developer because then other projects which use the same jars can simply link in the library without needing to locate the jar again. Since the libraries are already defined, this section will only cover how to link the jars up with the libraries.

The libraries are named as follows (this can be seen by configuring the build path directly), along with their usual jar locations:

To configure these libraries, take the following steps:

  1. Click the Window menu > Preferences.
  2. Navigate to Java > Build Path > User Libraries
  3. For each of the libraries, repeat these steps:
    1. On the right side, click the New... button.
    2. Fill in the name of the library.
    3. Leave System Library unchecked.
    4. Click OK. Ensure that the new library is selected in the list.
    5. Click Add JARs.
    6. Locate the respective jar and click OK.
  4. Now you can OK out of the Preferences dialog.

Now we need to link these libraries in to our project.

  1. Right click on the project > Build Path (about halfway down) > Configure Build Path.
  2. In the wizard, switch to the Libraries tab
  3. Click "Add Library..." button on the right.
  4. Select "User Library" and click next.
  5. Select the libraries that you need, and click Finish

If you already have LateralGM and JoshEdit imported into Eclipse and want to use them, do *not* select them from the Libraries list. Instead:

  1. Switch to the Projects tab
  2. Click Add
  3. Select LateralGM and JoshEdit, then click OK.

After that, we're done with our build path dependencies. You can OK out of the dialog.

Build

Find the file named description.jardesc in the root of the project, right click it, and click "Create Jar". Your jar will be created inside the Project, named "enigma.jar", so you can simply drag it out or copy and paste it to the desired location, like enigma-dev's installation on your filesystem.

If you named your project something other than Enigma or want to alter the way that the jar is exported, you will need to edit the Jardesc.

Problems

If you run into any problems, feel free to ask around for help. Check on the IRC because some other people may have experience with the process. The most helpful person would probably be User:IsmAvatar, since she is the dev who maintains The Plugin and usually is responsible for building it.

Personal tools
Namespaces
Variants
Actions
Navigation
ENIGMA
Other
Toolbox