WTP
Development Practices |
This document is to describe some guidelines, procedures, and "best practices" for doing WTP development. In some cases its simply covers consistency/procedure issues, but also recommends best practices to help community review and involvement. While all component teams can have their own practices, if anyone has some good tips or recommendations, please post to wtp-dev for discussion or suggest that they be added here.
The component developers should provide the following information to accompany code checked into CVS. Some of this information will become part of the components 'development' directory in cvs, or on the component's WTP website, and should be kept up to date as changes take place and development progresses. (See Web and development resources for guidelines on what goes where).
A brief description of the component. This might be an initial design document, if it exists, but the actual design document can come later. This brief description should overview the function provided by the component, but should also list at least a few API's, extension points, or other "starting points" for anyone wanting to use or extend the component. (See PluginOverview.html for example).
A brief initial work plan: describing what development tasks are expected for the next milestone or two (or simply in "future" if not yet planned for a specific milestone). Specific bugs and feature requests can be tracked with bugzilla, but this plan should be given as a prose "overview" or highlights of work that is planned towards refactoring or making the component "platform quality". (See SSEDevelopmentPlan.html for example). In particular, if there are areas that can be explicity tagged with "HELP WANTED", that would be good since can help let potenital contributors know what areas
Each plugin and build feature should contain a 'description' in the plugin.xml (or feature.xml) file (there is a description tag for such purpose).
A plan for how the component will be documented: both the "developers guide" type of information (see Platform Plugin Developers Guide and JDT Plugin Developers Guide in the base Eclipse for examples) and also the status and plan for design overviews and "javadoc" type of information.
All copyrights and appropriate license files should be correctly provided.
Team Project Set. Each component team should have a "team project set" in their 'development' directory to make it easy for others to check out what is needed for that particular component.
Source Folders A minor consistency point: If there's only one "source directory" it should be named 'src'. If there's more than one, the additional ones should be named similar to src-wizards, so its obvious both that's its source, and what its conceptual division is. Multiple folders are not typically required, but can be handy when one team has responsibility for one part, and another team responsibility for another part of the plugin.
Compiled code jar. Its recommended the jar for the plugin be in the "root" of the plugin. Its also recommended a directory such as "runtime" be reserved for those few cases where a pre-existing binary jar is shipped with a plugin.
cvsignore A .cvsignore file should be provided which has at least 'bin' in it to prevent the check in of .class files -- please do this before bin is committed to the repository (since you can not ignore after its there). Typically, other "transient files" (such as a non-custom build.xml, etc) are also added to this .cvsignore file.
Source Formatting Source should be formatted according to some stated standard (e.g. see /wtp-jst-home/development/format) and appropriate Eclipse compiler options used (e.g. see /wtp-jst-home/development/compilersettings) to produce "clean code" (no unnecessary casts, no unused imports, etc.) Its also recommended the source originally have 'sorted members'. The intent here is to have clean, consistent code that makes it easier for others to do diffs, compares, and supply patches.
Obsolete directories in CVS. If, due to renaming, refactoring, or just spelling mistakes, a directory in CVS should literally be deleted, to avoid a large of confusing directories, please use following procedure. First, if it contains source, its recommend to version that plugin's source, with a name such as "obsolete<date>". Next delete the source, and leave in its place a single file named "obsolete.txt" . If appropriate, that file can contain information about why obsolete, where the replacement is, etc. Lastly, someone will occasionally delete those directories from CVS (not typically an desirable thing to do, since it is a source code control system! Note: if some code or project simply become old or outdated, it is usually not appropriate to delete it since it might be required for simple historical reason. In these cases, its recommed to version the final version with some descriptive name like "outdated<date>" and leave a file in the directory called something like "outdated.txt" with some description of when and why, if there's a similar function offered elsewhere, etc.
As features are added to bugzilla and fixes done and patches are applied, enter the CVS commit comment as
[BUGNO] Bugzilla abstract or explanation (eg: [6788] Fixed NPE on open)
This will allow us to generate a "what is fixed " list automatically with links to bugzilla with each build.
For an example of output in another project, see
http://download.eclipse.org/tools/emf/scripts/news-release-notes.php?ver=2.1.0#I200411180800
Avoid using the export="true" attribute on pre-req (imported) plugins.
Its never appropriate to use it just so your upstream clients save typing a line in their plugin.xml file. But,
sometimes it is appropriate to use it -- when the classes/interfaces in pre-req plugin really are part of the pre-reqing
plugins API. If it fits this later case, that is it is part of the plugin's API, please document what part of the API
requires it. For example:
<!-- need to re-export org.eclipse.text since our API depends on it,
such as IStructuredDocument extends IDocument
-->
<import plugin="org.eclipse.text" export="true"/>
The reason for this convention is that it forces upstream clients to stay better aware of exactly what they are
pre-reqing instead of picking up some classes simply as a side effect of pre-reqing your plugin.
By convention, a directory named 'development' should be used in the component's CVS directory structure. This directory would be a peer with 'features' and 'plugins'. These directories should hold things that may be useful or relevant not only to the developers of the components, but others interested in contributing (e.g. project team sets, Rose source files of designs, etc). Things in these directories are not intended to be in a build. If they are intended for an SDK build, they would be part of the plugins directory structure.
[Note: there's some CVS work still needed to map the website to an area in CVS, so the following paragraph will be expanded after that is established]
For resources that are to be published or linked on the WTP web site, there will be an area in CVS that parallels the website, so resources that are placed there will be periodically copied to the whosoever for proper serving.
Nightly builds will be built from the head stream. Occasional compile errors or unit tests failures would not be abnormal, but should be fixed by the next nightly build.
Weekly integration builds will be built from developer tagged versions. There should never be compile errors or unit tests failures in an integration build, but if that happens then 1) immediate fixes are required and 2) the offender must wear a red clown nose for the day :). Integration builds are expected to be of sufficient quality they can be used as the target in the development environment, though will have received little or no testing.
Milestone builds are like weekly integration builds except they get substantial testing. The expectation is that milestone builds be of sufficient quality that they can be used to self host development.
Most development should take place in the HEAD stream. However, if a component knows its making large breaking changes that would cause clients a lot of churn (such as daily changes, to avoid breaking nightly build), they can do the major changes in a temporary branch. The component team should keep everyone informed that major development is occurring in a branch, and naturally, well coordinate the merge back into the HEAD stream. A good guideline is that development on a branch should not occur for more than 3 weeks without being merged back into HEAD.
The following criteria can be useful to self-measure the success of a milestone or release. Component leads should monitor their progress with these expectations in mind.