Build Phex from Subversion
From PhexWiki
Contents |
Intro
This is a guide for all those, who don't want to wait for the new release of Phex but prefer staying on the cutting edge of development, with all the advantages and drawbacks it includes.
It is also a guide for those who want to try their own tricks with the code or just begin Java-Programming and want to get their fingers dirty on some nicely structured code, where their contributions really count and where they get part of a greater whole (or at least of a program in which their changes form a noticeable part of the whole image). Therefore I'll also include some hints for structuring your code to conform with the structure in Phex.
Getting the source-code from Subversion
To checkout the Phex source code use the command:
svn co https://phex.svn.sourceforge.net/svnroot/phex/phex/trunk phex
Now you are ready to compile the code to get running.
More detailed instructions on how to get the source code can be found in the Subversion instructions document.
Compiling the Code
Phex can be compiled using Apache Ant. Simply execute the "ant"-command inside the "build"-folder in the phex home folder. It fetches all build-instructions from the build.xml file and other files in that folder.
cd $(Phex Folder) cd build ant
Also there's a simple Unix script available, which starts Phex automatically after building it:
cd $(Phex Folder) ./build-and-run
This gets us to the next chapter.
Create JavaDoc
You can now also create the JavaDoc of the Phex code to get a first impression of the structure of Phex.
cd $(Phex Folder) cd build ant javadoc
A online version (likely out-of-date) of the Phex JavaDoc is also available at: http://www.phex.org/javadoc/phex. It includes links to the Phex source code and offers UML diagramms of packages and classes.
To generate this documentation yourself read the next chapter.
Create JavaDoc with UML diagrams
To create UML diagrams, you need UMLGraph and Graphviz.
Graphviz can be obtained from : http://www.graphviz.org/ To get UMLGraph visit: http://www.spinellis.gr/sw/umlgraph/
After installing Graphviz, you need to add the 'bin' directory to you PATH environment. It should be enough to do this only for the script you use to run the ant process.
To integrate UMLGraph, create a copy of build/build.default.properties and name it build/build.user.properties. Open the build.user.properties file in an editor and look for the commented line:
# doc.uml.UmlGraph.jar =
Change the line, remove the comment and let it point to the UmlGraph.jar file on your system:
doc.uml.UmlGraph.jar = /path/to/UMLGraph/UmlGraph.jar
Now you are ready to execute the ant 'uml' task:
cd $(Phex Folder) cd build ant uml
As output you will get JavaDoc documentation with integrated Phex source and UML diagrams, like they are available at: http://www.phex.org/javadoc/phex.
Advanced diagrams
For advanced usage you can also use the bash (*nix) script to create UML diagrams with the following command (from inside the phex-svn-folder, i.e. trunk):
for i in src/phex/* ; do javadoc -sourcepath ./src/ -docletpath ../javadoc/UmlGraph.jar -doclet gr.spinellis.umlgraph.doclet.UmlGraph -private -horizontal $(find $i -iname \*.java) -inferrel -hide "java.*" -hide "javax.*" -hide "com.*" -hide "sun.*" -hide "org.*" -qualify -postfixpackage -inferreltype composed -inferdep -inferdepinpackage -useimports ; dot graph.dot -Tsvg > phex-uml-$(basename $i).svg ; done;
It traverses into all directories and creates UML diagrams which are being saved as svg-images in the phex folder (i.e. trunk).
Folder Structure
Here I'll give a few infos for structuring the code and where to find what.
All Phex-specific Java-code can be found in the folder "src". The code written by the Phex-Team is in the folder src/phex.
Libraries are in the folder "thirdparty" and native code for different platforms is in the folder "native". Also as top-level folders you find the installer and docs. The folder "output" is where you find the compiled results and the class-files.
Structure of src/phex
For the most part, you should be able to guess the structure from the folder-names.
- All GUI-elements and only those should reside in the folder "gui".
- In "common" you can find classes which are used at many places in Phex.
Contributing
We are always happy to welcome new programmers, novizes as well as experts, long-term coders as well as fly-by code-casters (who write readable code, of course :) ).
We'd be especially glad to find contributers who take on one of the tasks from our Wishlist, or who contribute further Ideas.
Should you be more interested in beta-testing Phex, please have a look into our forums.
Also we search for people, who can help localizing Phex to more languages. We already have German, English, Nederlands, French and Spanish.
If you want to help localizing, please have a look at out localization-guide. We have a simple text-file with entries, which can be translated.


