Difference between revisions of "Building PCGen"
(Indicate gradle 2 does not work) |
(Update info to reflect move to gradle wrapper) |
||
Line 7: | Line 7: | ||
* Java Development Kit (aka Java SDK or JDK). You should use the latest version (update) of the JDK 6.0 available for download from [http://www.oracle.com/technetwork/java/javase/downloads/index.html here]. At the time of writing this was Java SE 6 Update 45. Java 7 will also work, but no 1.7 specific features should be used in the code just yet. Other JDKs might work, but no one has tried. | * Java Development Kit (aka Java SDK or JDK). You should use the latest version (update) of the JDK 6.0 available for download from [http://www.oracle.com/technetwork/java/javase/downloads/index.html here]. At the time of writing this was Java SE 6 Update 45. Java 7 will also work, but no 1.7 specific features should be used in the code just yet. Other JDKs might work, but no one has tried. | ||
− | |||
* You will also need the latest version of the PCGen source code available from SVN. See [[Subversion Setup]] for details. | * You will also need the latest version of the PCGen source code available from SVN. See [[Subversion Setup]] for details. | ||
Open a command window and change to the root directory/folder where you installed the PCGen source code. There should be a file called build.gradle there. | Open a command window and change to the root directory/folder where you installed the PCGen source code. There should be a file called build.gradle there. | ||
− | Type | + | Type gradlew at the command prompt. This will make sure you have a clean start and then build the pcgen.jar file. You can start pcgen.jar, pcgen.exe or pcgendev.sh to run it or manually run the jar file using a command line like |
<pre>java -Xmx1024M -jar pcgen.jar</pre> | <pre>java -Xmx1024M -jar pcgen.jar</pre> | ||
− | To generate the JavaDocs use | + | To generate the JavaDocs use gradlew javadoc. To run all the tests use gradlew slowtest (which can take a while). |
− | Typing the command <pre> | + | Typing the command <pre>gradlew</pre> will clean the project, build the code and run a small selection of tests. |
− | Typing the command <pre> | + | Typing the command <pre>gradlew slowtest</pre> will build the code and run the full test suite and produce a report. |
=Using Eclipse to build PCGen= | =Using Eclipse to build PCGen= | ||
Line 25: | Line 24: | ||
You can build PCGen from within Eclipse. It is configured by default to use the gradle dependencies however you will need the "Gradle Integration for Eclipse" plugin which can be installed free from the Eclipse Marketplace. | You can build PCGen from within Eclipse. It is configured by default to use the gradle dependencies however you will need the "Gradle Integration for Eclipse" plugin which can be installed free from the Eclipse Marketplace. | ||
− | Once installed, Eclipse will share the jars as specified in build.gradle. You can also | + | Once installed, Eclipse will share the jars as specified in build.gradle. You can also accesa gradle tasks from within Eclipse using the "Window > Show View > Other" menu and then selecting "Gradle Tasks". |
==Running and debugging== | ==Running and debugging== | ||
Line 45: | Line 44: | ||
=Using IDEA to build PCGen= | =Using IDEA to build PCGen= | ||
− | You can build PCGen from within IDEA. | + | You can build PCGen from within IntelliJ IDEA. Intellij will recognize the Gradle build for the project and provide access to the tasks. |
− | |||
− | |||
− | |||
==Running and debugging== | ==Running and debugging== |
Revision as of 10:32, 20 December 2014
Building PCGen from the command line
This process uses the Gradle tool, you need the following software packages:
- Java Development Kit (aka Java SDK or JDK). You should use the latest version (update) of the JDK 6.0 available for download from here. At the time of writing this was Java SE 6 Update 45. Java 7 will also work, but no 1.7 specific features should be used in the code just yet. Other JDKs might work, but no one has tried.
- You will also need the latest version of the PCGen source code available from SVN. See Subversion Setup for details.
Open a command window and change to the root directory/folder where you installed the PCGen source code. There should be a file called build.gradle there.
Type gradlew at the command prompt. This will make sure you have a clean start and then build the pcgen.jar file. You can start pcgen.jar, pcgen.exe or pcgendev.sh to run it or manually run the jar file using a command line like
java -Xmx1024M -jar pcgen.jar
To generate the JavaDocs use gradlew javadoc. To run all the tests use gradlew slowtest (which can take a while).
Typing the command
gradlew
will clean the project, build the code and run a small selection of tests. Typing the command
gradlew slowtest
will build the code and run the full test suite and produce a report.
Using Eclipse to build PCGen
You can build PCGen from within Eclipse. It is configured by default to use the gradle dependencies however you will need the "Gradle Integration for Eclipse" plugin which can be installed free from the Eclipse Marketplace.
Once installed, Eclipse will share the jars as specified in build.gradle. You can also accesa gradle tasks from within Eclipse using the "Window > Show View > Other" menu and then selecting "Gradle Tasks".
Running and debugging
- Open the PCGen project.
- Open the Run dialog by right-clicking on the PCGen project and selecting Run As > Run Configurations
- Select the Java Application node.
- Press the New button for a new configuration. Edit by field, thus:
Name -> PCGen
Main class -> pcgen.system.Main
VM arguments (Arguments tab) -> -Xmx1024M
- Press Apply to save the configuration.
- Press Run to start PCGen.
You can also run a single test by right clicking on the test and selecting Debug > JUnit Test. This is a great way to track through a bug too.
Using IDEA to build PCGen
You can build PCGen from within IntelliJ IDEA. Intellij will recognize the Gradle build for the project and provide access to the tasks.
Running and debugging
NB - IDEA will build the software sufficient for running and debugging within the IDE automatically just by following these step. This is not the same as the build from the Building section, above, which builds the software suitable for command-line use.
- Open the PCGen.ipr project file.
- Get the Run/Debug Configurations dialog with Run > Edit Configurations from the menu bar.
- Select the Application tab.
- Press the [+] button for a new configuration. Edit by field, thus:
Name -> PCGen
Main class -> pcgen.system.Main
- Uncheck Display settings before running/debugging.
- Press Ok.
You can now run PCGen with the green right-pointing triangle on the toolbar and debug with the green right-facing beetle on a blue diamond. Or just use the Run menu.