Introduction
This document summarizes the usage of the Eclipse API scanner. The goal of the Eclipse API scanner is to identify any internal API references in any Eclipse-based products. You can view the requirements document here, and the design document here.
Downloading and running the Eclipse API scanner
A binary version of the Eclipse API scanner is available here:
Download the Eclipse API scanner .The source of the Eclipse API scanner is also available in CVS: (http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.wtp.releng/apitools/?cvsroot=WebTools_Project).
Check out the org.eclipse.wtp.releng.tools.component.core project and the org.eclipse.wtp.releng.tools.component.ui project.Running the Eclipse API scanner from the command line environment
Before running the Eclipse API scanner, you should get yourself familiar with what is a component. For a definition of component, visit the design document. To begin, have your Eclipse components/plug-ins and your component.xml files ready. The Eclipse API scanner will scan all the API references in each component and check whether they are internal API references. An API violation report will be generated for each component. To generate the API violation reports, run:
genViolation.bat -eclipseDir <eclipseDir> -compXMLDir <compXMLDir> -compRefDir <compRefDir> -compVioDir <compVioDir> -genHTML -debugwhere:
To get you started more quickly, you can use genComponent.bat to generate a component.xml file per plugin. Any packages with the word "internal" in it will be excluded from the generated component.xml file. To generate default component.xml files, run:
genComponent.bat -eclipseDir <eclipseDir> -compXMLDir <compXMLDir>where:
Running the Eclipse API scanner within Eclipse
The Eclipse API scanner is also available as two Eclipse plug-ins. Therefore, you can overlay them on top of an Eclipse driver and use them to check API violations as you develop your product/plug-ins. To get these plug-ins, go to:
http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.wtp.releng/apitools/?cvsroot=WebTools_Project
and check out the org.eclipse.wtp.releng.tools.component.core project and the org.eclipse.wtp.releng.tools.component.ui project. They provide an editor for editing component.xml files.
They will also scan the plug-ins in your workspace and generate API violations in the problems views. The figure below shows a plug-in in my workspace called org.eclipse.sample. I have also created a component.xml file for this plugin.
In the next figure, I have added a reference to one of the Eclipse internal class. The Eclipse API scanner will flag this as an API violation and display it in the problems view.
You can find some sample component.xml files http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.wtp.releng/apitools/components/?cvsroot=WebTools_Project.
Disclaimer: these sample component.xml files are provided as an example only. They DO NOT reflect the actual APIs provided by the Eclipse projects.