PDE API Tools and Usage Scans

PDE API Tools and Usage Scans

The PDE team has been busy at work for the Eclipse 3.5M6 milestone, from revamping the target platform story to product definition enhancements. One of my favorite upcoming enhancements comes from the API Tools part of PDE, we are enhancing API Tools to do usage scanning. What does this mean? Well, let’s turn this into a story.

Let’s pretend I’m Darin Swanson, the lead of the Eclipse Platform Ant project in Eclipse. I want to answer the question of who is using any of my API, or even better, internal code. To answer this question, I would head over to one of the usage reports from API Tools (this particular one is done against the 3.4.1 release of the Eclipse SDK).


As Darin, I would cruise over to the projects I’m responsible for… in this case I see the org.eclipse.ant.core and org.eclipse.ant.ui bundles. If I peek at org.eclipse.ant.core first, I see three bundles referencing me:


Those references look fine to me, no one is using internal APIs except org.eclipse.ant.ui but that’s fine since the internal references are permissible (via x-friends). Let’s check out how org.eclipse.ant.ui is doing:


Uh oh, looks like there’s some trouble here. The org.eclipse.pde.ui bundle (doh!) is referencing some internal APIs from the org.eclipse.ant.ui bundle. If we drill down further, we see the guilty references:


Kind of cool huh? The usage scan tooling is still in the early stages, but we hope to make more progress at the Eclipse 3.5 release comes to a close. I guess the only bad thing about this particular example was that I found myself guilty for referencing internal APIs, but it goes to show you that it’s pretty easy to do this. Now that Darin knows that I’m referencing internal APIs from Platform Ant, maybe we could spark a conversation of how to make new API or give me an alternative route that’s public API friendly.

In the end, as a developer, the usage scan tooling enables me to find out who is referencing my code across a set of bundles. On a side note, it would be really interesting to see a usage scan across the whole Galileo release. We could have a contest for the bundle who has the most abused internal references!

  • irbull
    Posted at 9:13 pm, February 17, 2009

    I can think of a good use for Zest here (maybe an addition to the PDE Viz Tool). I have even been working on container support that could be used for “drill down” actions.

  • Posted at 9:29 pm, February 17, 2009

    Good point Ian. I could envision using Zest to do some of the visualization of this information. Currently, we just have the HTML reports to go with… which is better than nothing 😉

  • Mike
    Posted at 9:34 pm, February 17, 2009

    The usage scan feature is complete, but I am still working on some form of agnostic DB support…which is not at all working well…also on the last page of info (reference details) you can click the entry in the table to see the exact reference details 🙂

    As a side-note to your side-note, if you grab the example use task from the bug report (https://bugs.eclipse.org/bugs/show_bug.cgi?id=259403 comment #4) and point it to a build of Galileo you should be able to get the contest rolling….

    Happy use scanning!

  • Posted at 11:10 pm, February 17, 2009

    Chris…anything that access WTP would beyond the trivial usage would have to access internals. So it would win hands down. 🙂

Post a Comment