You
can run a code review when you build an Eclipse plug-in in the plug-in development
environment (PDE) by adding an Apache Ant task to the
build.xml file
that belongs to the plug-in project.
To run a code review from the command line,
you must create a rules file.
The analysis.analyze Ant task provides a convenient method to run
a code review as part of a complete build process for plug-ins that you develop
in the PDE. You can configure the PDE project builder to run the Ant task
whenever you build the project and whenever you clean the project and rebuild
it from the beginning.
To run a code review as an Ant task:
- Verify that the analysis.analyze Ant task is registered:
- Click .
- In the Preferences window, click Ant,
and click Runtime.
- In the Runtime pane, click the Tasks tab
and verify that the analysis.analyze Ant task is listed in the Name column.
- If the plug-in project does not have an Ant build file, in the Package
Explorer view, right-click the project name; then click .
- Open the build.xml file and add the following Ant target:
<target name="code review">
<analysis.analyze projects="project name"
rulefile="path to rules file" />
</target>
- To test the target, in the Outline view, right-click the target
name (for example, code review); then click . The Console view
displays the results of the code review.
- Create a builder for the Ant task:
- In the Package Explorer view, click the
PDE project; then click .
- In the Properties window, in the left pane,
click Builders; then click New.
- In the Choose configuration type window,
click Ant build; then click OK.
- In the Properties for new builder window,
on the Main page, click Browse Workspace.
- In the Choose Location window, click the
name of a PDE project, click build.xml, and click OK.
- On the Targets tab,
for the After a "Clean" setting, click Set
Targets.
- In the Set Targets window,
clear the build.jars setting
- Repeat substep 5.f and
substep 5.g for the Manual
builds setting.
- In the Properties for new builder window, type a name for the
builder (for example, code review), and click OK.
- In the PDE perspective, click . The results
of the code review are displayed in the Console view.