Design > Source Code Organization and Build System

Release Information

Project: PIMS
Internal Release Number: 0.1
Related Documents:
LINKS TO OTHER DOCUMENTS

Overview

What are the most important facts that a developer should know about this source code organization and build system?
It roughly follows the standard proposed in the Tomcat documentation and is very similar to the organization used on many open source projects at the Apache Software Foundation.
What are the ranked goals of this source code organization and build system?
  1. Separation of files by type
  2. Separation of version-controlled files from files generated by the build process
  3. Compatibility with standard build processes

Developer's Working Copies

PathVCDescription
build.xml Yes Build file
build.properties Yes Build properties file
src/ Yes Source code
src/java/ Yes Java source code
src/java/[Nested packages]/ Yes Java source code of classes in each package
src/java/test/[Nested packages]/ Yes Java source code of unit tests for classes in each package
web/ Yes HTML and JSP files
web/css/ Yes CSS files, if any
web/images/ Yes Image files, if any
web/WEB-INF/web.xml Yes Java web application configuration file
conf/ Yes Configuration files, if any
data/ Yes Initial data to load into database and/or file system, if any
lib/ Yes Libraries reused by this project, if any
scripts/ Yes Command-line utility scripts used by this project, if any
project/ Yes Project documents (e.g., overview, plan, requirements, and design)
build/ No Output of build process
build/WEB-INF/classes/ No Compiled code output by build process
dist/docs/api/ No API documentation output from build process
dist/PIMS-VERSION.war No Deployable web archive of classes and config files generated by build process

Repository

PathDescription
trunk/ The current snapshot. Subject to a daily build and smoke test, and other QA activity.
releases/ A branch for each official release.
developers/ A branch for each developer, for personal use.
tags/ Tagged revisions.
To create your personal branch and get a local working copy, do
svn copy http://pims.mole.ac.uk/svn/pims/trunk \
           http://pims.mole.ac.uk/svn/pims/developers/[your name] \
      -m "Creating a private branch"
svn checkout http://pims.mole.ac.uk/svn/pims/developers/[your name]
(or the equivalent if using a GUI subversion client). To merge changes from the trunk into your branch, or publish changes you have made in your branch into the trunk, see Merging a Whole Branch to Another.

Build Targets TBD

TargetDescription
compile = default Compiles Java source code and creates .class files under the "build" directory.
dist Packages the system for distribution/deployment to servers or end users. Specifically, it creates .war archive of compiled classes and configuration files.
install Places executable code into location where it will actually be executed. Specifically, it copies .war file into Tomcat's webapps directory for use. You must then restart Tomcat or use the "reload" link in the Tomcat Manager.
javadoc Generates Java API documentation under "build/docs/api/".
clean Deletes files generated by previous build commands. Files under version control are not touched.

Build Configuration Options TBD

PropertyDescription
app.name The name of this application. This should be one short word. Used in the name of resulting package files. Specifically, the .war file. And, it will be used to access the application via http://localhost:8080/APP.NAME/
app.version Version number of this release. Used in the name of resulting package files. Specifically, the .war file.
webapps.path Path to the Tomcat "webapps" directory. Defaults to C:\Program Files\Apache Group\Tomcat 4.1\webapps\

These build system properties can be modified by editing the build.properies file.

Source Code Organization and Build System Checklist

Separation of files by type: Are files separated by type?
Yes. Except that application JSP and HTML files are in the same directory, which is convenient because sometimes we change an HTML file to be a JSP file.
Separation of version-controlled and non-version controlled files: To what extent has this been achieved?
It has been achieved. Everything is under version control except for the "build" directory. No step in the build process should create or modify any file in any other directory.
Compatibility with standard build processes: To what extent has this been achieved?
So far, so good. We can use build.xml files that are very close to the examples that come with Ant. One difference is that we keep our technical documentation under "project" rather than under "docs". Also, we have avoided the use of custom ant tasks.
Have these implementation decisions been communicated to the development team and other stakeholders?
They are available at this website and will be discussed at the first team meeting. Feedback is welcome.
Company Proprietary