Difference between revisions of "Building PCGen"

From PCGen Wiki
Jump to: navigation, search
(Building PCGen from the command line)
(remove some wrong info; update some info)
 
(11 intermediate revisions by 6 users not shown)
Line 4: Line 4:
 
=Building PCGen from the command line=
 
=Building PCGen from the command line=
  
This process uses the [[ANT]] tool, you need the following software packages:
+
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 5.0 available for download from [http://java.sun.com/javase/downloads/index_jdk5.jsp here]. At the time of writing this was JDK 5.0 Update 15. Java 1.6 will also work, but no 1.6 specific features should be used in the code. 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.
* Ant 1.7.0 (or later) from [http://jakarta.apache.org/ant/ here]. Ant is an all-Java replacement for make, and is fully cross-platform. Note: You will also need to download the jakarta-ant optional.jar file if using certain versions of Ant. See [[ANT]] section for further details
 
* If you wish to run the test suite you will need JUnit 3.6 from [http://www.junit.org/ here].
 
 
* 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.xml 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 ant clean at the command prompt. This will make sure you have a clean start. Then run ant. This will build the pcgen.jar file. The jar file will be in ./bin. You can run pcgendev.bat or pcgendev.sh to run it or manually copy the jar file to the PCGen root directory.
+
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 to run it or manually run the jar file using a command line like
 +
<code>./pcgen.sh</code>
  
'''NOTE'''
+
To generate the JavaDocs use gradlew javadoc. To run all the tests use gradlew slowtest (which can take a while).
* If you get a "Could not create task of type: javacc" you need to ensure you have the jakarta-ant optional.jar file in the $ANT_HOME/lib directory. (You only need this for older versions of Ant).
 
* If you get a "Could not create task of type: junit" you need to copy the junit.jar file from the pcgen/libs directory to the $ANT_HOME/lib directory. (You only need this for older versions of Ant).
 
  
To generate the JavaDocs use ant docs, and for deployments you can use ant deploy, and finally ant all does all of the above (clean, build, docs, deploy), and ant complete does everything including a full testing cycle (which can take a while).
+
Typing the command <pre>gradlew</pre> will clean the project, build the code and run a small selection of tests.
  
Typing the command <pre>ant</pre> will build the code and run a small selection of tests.
+
Typing the command <pre>gradlew slowtest</pre> will build the code and run the full test suite and produce a report.
  
Typing the command <pre>ant dotest</pre> will build the code and run the full test suite.
+
=Using Eclipse to build PCGen=
  
Typing the command <pre>ant reporttest</pre> after running the tests will generate a test report.  The xml result files are generated while running the tests, they can be found in ./code/build/test-results/xml/ after making the reporttest target, a browsable set of html reports can be found in ./code/build/rpt/test-results/
+
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.
  
=Using Eclipse to build PCGen=
+
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".
 
 
You can build PCGen from within Eclipse. You will need to do a little bit of setup first though:
 
# Go to Window > Preferences, then Ant > Runtime then select Ant Home Entries under the Classpath tab.
 
# Click Add Jars. Select the junit.jar under pcgen/lib/test.
 
Now you should be able to select the build.xml, right click and hit Run > Ant Build and it should work.
 
  
 
==Running and debugging==
 
==Running and debugging==
  
 
# Open the PCGen project.
 
# Open the PCGen project.
# Open the Run dialog by right-clicking on the PCGen project and selecting Run > Run....
+
# Open the Run dialog by right-clicking on the PCGen project and selecting Run As > Run Configurations
# Select the Java Application nide.
+
# Select the Java Application node.
 
# Press the New button for a new configuration. Edit by field, thus:
 
# Press the New button for a new configuration. Edit by field, thus:
 
Name -> PCGen
 
Name -> PCGen
  
Main class -> pcgen.gui.pcGenGUI
+
Main class -> pcgen.system.Main
 +
 
 +
VM arguments (Arguments tab) -> -Xmx1024M
 
# Press Apply to save the configuration.
 
# Press Apply to save the configuration.
 
# Press Run to start PCGen.
 
# Press Run to start PCGen.
Line 50: Line 44:
 
=Using IDEA to build PCGen=
 
=Using IDEA to build PCGen=
  
You can build PCGen from within IDEA. You will need to do a little bit of setup first though:
+
You can build PCGen from within IntelliJ IDEA. Intellij will recognize the Gradle build for the project and provide access to the tasks.
# Go to the Window > Tool Windows > Ant Build. Press the [+] button to add a build file.
 
# Navigate to and select the build.xml Ant script in the root of the PCGen project tree. Press Ok.
 
  
You can now select any Ant target you wish. Particularly helpful are the build and fetch-data targets.
 
  
 
==Running and debugging==
 
==Running and debugging==
Line 66: Line 57:
 
Name -> PCGen
 
Name -> PCGen
  
Main class -> pcgen.gui.pcGenGUI
+
Main class -> pcgen.system.Main
 
# Uncheck Display settings before running/debugging.
 
# Uncheck Display settings before running/debugging.
 
# Press Ok.
 
# Press Ok.
Line 72: Line 63:
 
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.
 
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.
  
=Using Maven to build PCGen=
+
=Using NetBeans to build PCGen=
 +
 
 +
You can build PCGen from within NetBeans. It is configured by default to use the gradle dependencies however you will need the "Gradle Support" plugin which can be installed free from the [http://plugins.netbeans.org/plugin/44510/gradle-support NetBeans Plugin portal].
 +
 
 +
Once installed, NetBeans will share the jars as specified in build.gradle. You can also accesa gradle tasks from within NetBeans using the "Right Click > Task".
 +
 
 +
==Running and debugging==
 +
 
 +
The Gradle Support plugin allows to use all the IDE's features normally. You can right click on a Java class with a proper main method and just click "Run File".
  
See [[MAVEN]]
+
You can now run PCGen with the green right-pointing triangle on the toolbar and debug with the green right-pointing triangle on top of a piece of a file. Or just use the Run menu.

Latest revision as of 05:25, 6 March 2017

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 to run it or manually run the jar file using a command line like ./pcgen.sh

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

  1. Open the PCGen project.
  2. Open the Run dialog by right-clicking on the PCGen project and selecting Run As > Run Configurations
  3. Select the Java Application node.
  4. Press the New button for a new configuration. Edit by field, thus:

Name -> PCGen

Main class -> pcgen.system.Main

VM arguments (Arguments tab) -> -Xmx1024M

  1. Press Apply to save the configuration.
  2. 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.

  1. Open the PCGen.ipr project file.
  2. Get the Run/Debug Configurations dialog with Run > Edit Configurations from the menu bar.
  3. Select the Application tab.
  4. Press the [+] button for a new configuration. Edit by field, thus:

Name -> PCGen

Main class -> pcgen.system.Main

  1. Uncheck Display settings before running/debugging.
  2. 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.

Using NetBeans to build PCGen

You can build PCGen from within NetBeans. It is configured by default to use the gradle dependencies however you will need the "Gradle Support" plugin which can be installed free from the NetBeans Plugin portal.

Once installed, NetBeans will share the jars as specified in build.gradle. You can also accesa gradle tasks from within NetBeans using the "Right Click > Task".

Running and debugging

The Gradle Support plugin allows to use all the IDE's features normally. You can right click on a Java class with a proper main method and just click "Run File".

You can now run PCGen with the green right-pointing triangle on the toolbar and debug with the green right-pointing triangle on top of a piece of a file. Or just use the Run menu.