This section describes how to get project source code and build it.
Project source code is stored in a SVN repository at SourceForge.net
- SourceForge project information:
- SourceForge SVN repository information:
- SourceForge SVN repository checkout:
- To checkout using a command line:
- svn co https://xdv.svn.sourceforge.net/svnroot/xdv trunk
- To checkout using Eclipse (with Subversive plugin):
- Resource URL: https://xdv.svn.sourceforge.net/svnroot/xdv
- Simple mode
- URL: https://xdv.svn.sourceforge.net/svnroot/xdv/trunk
- build/ - generated automatically during the build and test time, target directory for all build and test results.
- java/ compiled Java code, generated by: ant compile
- javadoc/ generated JavaDoc, generated by: ant javadoc
- javatests/ compiled Java test code, generated by: ant compile-test
- xdv-1.0.jar XDV jar file, generated by: ant xdv.jar
- doc/ - documentation.
- javadoc/ additional resources for JavaDoc generation (CSS, images etc).
- examples/ - examples of how to use the XDV library.
- clixml-rules/ rules expressed in CLiXML.
- java/ Java sample code on how to use various functionality offered by the XDV library.
- java/ - Java source code.
- javatests/ - Java tests source code.
- lib/ - default location for external dependencies, see section "External dependencies" bellow.
- schema/ - XML-Schema definitions.
- / - build script.
- build.properties build parameters (directory names, etc).
- build.xml ANT build script.
Project distinguishes three types of dependencies:
- Build - required to build the source code.
- Test - required to complie and run tests.
- Run - required to run code that uses the XDV library.
List of external dependencies that are not distributed with the project and have to be downloaded separately:
- JRE - Java SE Runtime Environment 1.6 or above.
- JDK - Java SE Development Kit Java 1.6 or above.
- ANT 1.7 or above.
- Jaxen 1.1.1 or above.
- Type: build, test, run - required at run time only if XDV Jaxen XPath module is being used.
- Download: http://jaxen.codehaus.org/releases.html
- For build and test time copy Jaxen JAR file to the lib/ directory.
- Saxon 6.5.5.
- Type: build, test, run - required at run time only if XDV Saxon6 XPath module is being used.
- Download: http://saxon.sourceforge.net/#F6.5.5
- For build and test time copy Saxon6 JAR file to the lib/ directory.
- JUnit 4.0 or above.
All external build time dependencies have to be available in order to build the XDV project - see section "External dependencies" above.
Source code is distributed with an ANT build script that automates the build and test process. To build the XDV library simply execute command ant in the project main directory. The result (a JAR file) will be generated and placed in the build/ directory.
List of all build commands:
- ant -p - lists all available ant tasks
- ant compile - compile Java code into build/java/
- ant compile-test - compile Java tests into build/javatests/
- ant javatests - execute all Java tests and print overall result
- ant xdv.jar - build the XDV library (default build task)
- ant javadoc - generate JavaDoc into build/javadoc/
Build results are available in the build/ directory. The redistributable component is a JAR file called xdv-{version}.jar
Unit tests and functional tests are written using JUnit4 and are stored in javatests/ directory.
Command ant javatests takes all public Java classes with suffix Test from the javatests/ directory, executes them and prints a brief result.
Versioning, code trunks, releases
SVN trunks:
- trunk - the main trunk of the code, represents the most recent version.
So far there are no other branches as project is still under development.
- File header:
- // XML Document Validator. Apache License 2.0
- Formatting:
- Use only spaces - no tabs.
- Default indentation is two (2) spaces.
- Use four (4) spaces indentation if the line is a continuation of the previous one.
- Max line length is 100 characters.
- JavaDoc:
- Author tag should be provided in a form:
- @author {user first and last name} ({SourceForge-user-login})
- One blank line should be put before @param section.
- Use {@code ...} instead of <code>...</code>
- Write JavaDoc for non trivial parts of the code.
- Coding:
- Methods' parameters are not null by default. JavaDoc should say 'Can be null' if a method accepts null for a given parameter.
- Methods do not return null objects by default. JavaDoc should say 'Can be null' if a method can return a null object.
- Methods do not modify their parameters by default. JavaDoc should say 'Modified in place' if a parameter can be modified.
- Objects, methods and attributes should have least required access level.
- In particular do not make a class public if it is used used only within a package.
- The code has to compile without warning.
- Imports:
- Do to extend static import but import always everything:
- import static org.junit.Assert.*
- Tests:
- Every non trival functionality has to be tested.
- Test class to execute has to have Test suffix.
- Code in the repository should always compile correctly and should always pass all the tests.
- One should make sure those assumptions are valid before submitting any changes