I'm posting this discussion on the mailing
list to benefit others interested leveraging API tooling features...
Hi Barys,
API tooling is scheduled to have its
"graduation review" with the EMO on Jan 30th. You can see our
graduation review link off this page - http://www.eclipse.org/projects/whatsnew.php.
Assuming we pass the review, the code will be graduated to the Eclipse
SDK shortly after that (likely the week of Feb 11th). So, API tooling exists
as code in the CVS repository, but will not be available as a binary download
as part of the SDK until that time.
There's nothing to stop you from experimenting
with the code right now - in fact, I encourage you to do so. My only disclaimer
is that the code is under development - APIs are not frozen. In fact, as
you will see in the slides, we are not planning to ship a public API in
the first release. So, you need to be willing to accept migration effort
as API tooling evolves.
> I'd like to start with "API
> Usage Reporting" feature from
http://wiki.eclipse.org/index.
> php/PDE_UI_Incubator_ApiTools#API_Usage_Reporting_.28Batch_Mode.29.
>
> 1) What is the current state of
this feature?
Infrastructure to support API usage
analysis exists. There is *no* command line tool as of yet. We do intend
to produce rudimentary API usage reports with Eclipse builds (we will likey
write some Ant tasks to help with this). The support is designed to work
in "pure Java" mode (i.e. no OSGi or workspace required). So
you would need to write a Java program that calls our provisional APIs.
Below is a description of what you would need to do. Perhaps you could
review this, and provide some feedback on how we can make this more consumable
for you.
For example, in the SDK, we analyze
a project for API usage problems when it is built. We do this by collecting
all of its prequisite bundles' API descriptions to create search criteria
for elements that have usage restrictions. We then search the project being
built.
Steps:
* Create an API profile (translates
to a product made up of binary bundles/plug-ins).
- use the Factory to do this (based
on a location, name, id, version, and execution environment description
file)
* For each bundle in the product, create
and add the corresponding API component to the profile
- API components are created from
the profile, based on location
* Use the API search engine to search
for specific API usage problems
- define the scope to search,
and the problems you are searching for
- you could look at the APIToolBuilder
as an example that searches components for illegal API use
* Create a report with the search results
(references)
- we do not currently create reports,
we create problem markers in the SDK
Note: currently an API component initializes
its "API description" from the bundle's manifest.mf (i.e. defines
which packages are API), and from the .api_description file in the root
of the bundle (jar or folder). The .api_description file is the same format
as component.xml files - but also allows visibility and usage flags to
be set on members within types. This means you'd need to have some way
of injecting the api description files into the bundles. We plan to do
this with regular Eclipse builds. Here's an example file:
> 2) Which version of PDE API tooling
should I pick up that has this
> feature working?
The code is all in HEAD. There are instructions
on how to get the code here: http://wiki.eclipse.org/PDE_UI_Incubator_ApiTools#Getting_the_Source_Code
> 3) What are the environment requirements
(Eclipse/JRE version, etc)?
We require the latest I-build of Eclipse,
and a 1.4 JRE. Our test suite requires a 1.5 JRE.
> 4) Are there usage examples I can
follow?
The test suite provides the best examples.
API usage problems are found by performing a search (search a scope for
specific types of problems). The SearchEngineTests might be a good place
to start.
>
> Any other pointers to speed up
the adoption of the tool?
We have tried to write good javadoc
and keep it up to date. But, you will likely need to ask questions :-)