API Tools provides a number of tasks to integrate the tooling into your releng builds. They are available in the <code>org.eclipse.pde.api.tools bundle</code>. The jarred task code <code>apitooling-ant.jar</code> must be on the Ant classpath.

+

== API Tooling Ant Tasks ==

−

If you are running the tasks from an Eclipse target workspace, you must preface the task name with <code>apitooling.</code>. When running the ant task directly, just the task name is required. If the task name is incorrect, you will get the following error:

+

API Tools provides a number of tasks to integrate the tooling into your releng builds.

For documentation on task parameters and results see our [http://help.eclipse.org/helios/index.jsp?nav=/4_3_0 official documentation].

+

For detailed documentation on task parameters see our [http://help.eclipse.org/index.jsp?nav=/4_3_0 official documentation].

−

== Analysis Task==

+

There are [[#Examples|example ant build files]] at the bottom of this page.

−

[http://help.eclipse.org/helios/index.jsp?topic=/org.eclipse.pde.doc.user/reference/api-tooling/ant-tasks/analysis-ant-task.htm Official Documentation]

+

=== Running the Tasks ===

+

+

The ant tasks are available in the <code>org.eclipse.pde.api.tools</code> bundle. To run the tasks from ant, the jarred code (<code>apitooling-ant.jar</code>) must be on the Ant classpath.

+

+

If you are running the tasks from an Eclipse target workspace, you must preface the task name with <code>apitooling</code>. When running the ant task directly, just the task name is required. You must also modify your ant launch configuration to "Run in the same JRE as the workspace" on the JRE tab. If the task cannot be found, you will get the following error:

+

+

<code>/target/Project/build.xml:15:<br/>

+

Problem: failed to create task or type apideprecation<br/>

+

Cause: The name is undefined.</code>

+

+

Several of the tasks will only run on bundles which have the API Tools nature enabled. To check if the nature is enabled on your project, look for the following inside of the <code>.project</code> file:

+

+

<code>

+

<natures><br/>

+

<nature>org.eclipse.pde.api.tools.apiAnalysisNature</nature><br/>

+

</natures><br/>

+

</code>

+

+

== Task Descriptions ==

+

+

The task descriptions sometimes describe the '''producers''' and '''consumers''' of a reference. The '''producer''' is the bundle that contains the code that created the API or internal code that is being referenced by another product. The '''consumer''' is the bundle that contains the code that calls the API or code. As an example, org.eclipse.debug.ui is a producer of the api type Launch. A product that provides a launch configuration may extend the Launch class and is the consumer of that API. Some tasks are intended to be run on one type of bundle. Some bundles may both produce and consume api and can act as both in the tasks.

+

+

=== Analysis Task ===

+

+

[http://help.eclipse.org/index.jsp?topic=/org.eclipse.pde.doc.user/reference/api-tooling/ant-tasks/analysis-ant-task.htm Official Documentation]

This task runs a complete API analysis of an API profile relative to a baseline - including API use, binary compatibility, and bundle version number validation. The profile is the current state of a product under development. The profile is compared to an API baseline for binary compatibility (usually the previous release of a product).

This task runs a complete API analysis of an API profile relative to a baseline - including API use, binary compatibility, and bundle version number validation. The profile is the current state of a product under development. The profile is compared to an API baseline for binary compatibility (usually the previous release of a product).

Line 15:

Line 37:

The analysis does not include @since tag validation as all verification is performed on binary class files (source is not analyzed).

The analysis does not include @since tag validation as all verification is performed on binary class files (source is not analyzed).

−

[http://help.eclipse.org/helios/index.jsp?topic=/org.eclipse.pde.doc.user/reference/api-tooling/ant-tasks/analysis-reportconversion-ant-task.htm Analysis Report Conversion] - The report conversion task converts the XML reports created by the Analysis Ant task into an HTML report.

+

[http://help.eclipse.org/index.jsp?topic=/org.eclipse.pde.doc.user/reference/api-tooling/ant-tasks/analysis-reportconversion-ant-task.htm Analysis Report Conversion] - The report conversion task converts the XML reports created by the Analysis Ant task into an HTML report.

−

== API Freeze Task ==

+

=== API Freeze Task ===

−

[http://help.eclipse.org/helios/index.jsp?topic=/org.eclipse.pde.doc.user/reference/api-tooling/ant-tasks/apifreeze-ant-task.htm Official Documentation]

+

[http://help.eclipse.org/index.jsp?topic=/org.eclipse.pde.doc.user/reference/api-tooling/ant-tasks/apifreeze-ant-task.htm Official Documentation]

This task identifies APIs that have been added, modified, or removed relative to an API baseline. This task is intended to validate no API changes occur after an API freeze.

This task identifies APIs that have been added, modified, or removed relative to an API baseline. This task is intended to validate no API changes occur after an API freeze.

[http://help.eclipse.org/helios/index.jsp?topic=/org.eclipse.pde.doc.user/reference/api-tooling/ant-tasks/deprecation-ant-task.htm Official Documentation]

+

[http://help.eclipse.org/index.jsp?topic=/org.eclipse.pde.doc.user/reference/api-tooling/ant-tasks/deprecation-ant-task.htm Official Documentation]

This task runs a complete API analysis of an API profile relative to a baseline - looking only for members (classes, fields, methods) that have been deprecated / un-deprecated. The profile is the current state of a product under development. The profile is compared to an API baseline for deprecation changes (usually the previous release of a product).

This task runs a complete API analysis of an API profile relative to a baseline - looking only for members (classes, fields, methods) that have been deprecated / un-deprecated. The profile is the current state of a product under development. The profile is compared to an API baseline for deprecation changes (usually the previous release of a product).

[http://help.eclipse.org/index.jsp?topic=/org.eclipse.pde.doc.user/reference/api-tooling/ant-tasks/apiuse-ant-task.htm Official Documentation]

−

+

−

[http://help.eclipse.org/helios/index.jsp?topic=/org.eclipse.pde.doc.user/reference/api-tooling/ant-tasks/apiuse-ant-task.htm Official Documentation]

+

This task runs a complete search of a given baseline to determine a producer-centric report of API usage.

This task runs a complete search of a given baseline to determine a producer-centric report of API usage.

Line 42:

Line 63:

The analysis does not include bundles that are not API Tools enabled.

The analysis does not include bundles that are not API Tools enabled.

−

[http://help.eclipse.org/helios/index.jsp?topic=/org.eclipse.pde.doc.user/reference/api-tooling/ant-tasks/apiuse-reportconversion-ant-task.htm API Use Report Conversion] - The report conversion task converts the XML reports created by the API Use Ant task into an HTML report.

+

[http://help.eclipse.org/index.jsp?topic=/org.eclipse.pde.doc.user/reference/api-tooling/ant-tasks/apiuse-reportconversion-ant-task.htm API Use Report Conversion] - The report conversion task converts the XML reports created by the API Use Ant task into an HTML report.

−

== API Use Migration Task ==

+

Consumer API Use Report Conversion - In 3.7, a new conversion task was introduced that organizes the use scan results to more clearly display the consumers of the references (the standard report organizes by the producers). This task runs on the same xml results as the other report task.

−

[http://help.eclipse.org/helios/index.jsp?topic=/org.eclipse.pde.doc.user/reference/api-tooling/ant-tasks/apimigration-ant-task.htm Official Documentation]

+

=== API Use Migration Task ===

+

+

[http://help.eclipse.org/index.jsp?topic=/org.eclipse.pde.doc.user/reference/api-tooling/ant-tasks/apimigration-ant-task.htm Official Documentation]

This task takes a given API use scan and tries to re-resolve it within a given candidate product release and reports any unresolved references.

This task takes a given API use scan and tries to re-resolve it within a given candidate product release and reports any unresolved references.

−

[http://help.eclipse.org/helios/index.jsp?topic=/org.eclipse.pde.doc.user/reference/api-tooling/ant-tasks/apimigration-reportconversion-ant-task.htm API Use Migration Report Conversion] - The report conversion task converts the XML reports created by the API Use Migration Ant task into an HTML report.

+

[http://help.eclipse.org/index.jsp?topic=/org.eclipse.pde.doc.user/reference/api-tooling/ant-tasks/apimigration-reportconversion-ant-task.htm API Use Migration Report Conversion] - The report conversion task converts the XML reports created by the API Use Migration Ant task into an HTML report.

−

== File Generation Task ==

+

=== API Use Scan Problems Task ===

+

+

[http://help.eclipse.org/index.jsp?topic=/org.eclipse.pde.doc.user/reference/api-tooling/ant-tasks/apiusescan-problems-ant-task.htm Official Documentation]

+

+

This task takes a compared a previous API use scan to a given baseline and reports any use references that have been removed. This task will warn you if you have removed fields, methods or types that are known to be used by downstream clients.

+

+

[http://help.eclipse.org/juno/topic/org.eclipse.pde.doc.user/reference/api-tooling/ant-tasks/apiusescan-problems-reportconversion-ant-task.htm API Use Scan Problem Report Conversion] - The report conversion task converts the XML reports created by the API Use Scan Problem Ant task into an HTML report.

+

+

=== File Generation Task ===

This task runs to generate all files required by API Tooling inside a binary bundle. This task is run during the Eclipse builds or during the bundle export for all projects that have an API Tooling nature.

This task runs to generate all files required by API Tooling inside a binary bundle. This task is run during the Eclipse builds or during the bundle export for all projects that have an API Tooling nature.

−

Right now, only the file called .api_description is created.

+

Right now, only the file called <code>.api_description</code> is created.

+

+

Projects in Eclipse that have the API Tooling nature and have the API Tooling builder enabled will have api_description files generated automatically.

+

+

[http://help.eclipse.org/index.jsp?topic=/org.eclipse.pde.doc.user/reference/api-tooling/ant-tasks/filegeneration-ant-task.htm Official Documentation]

−

[http://help.eclipse.org/helios/index.jsp?topic=/org.eclipse.pde.doc.user/reference/api-tooling/ant-tasks/filegeneration-ant-task.htm Official Documentation]

+

== Examples ==

−

== Example ==

+

Example ant build files for the various tasks.

−

This is an example of an ant build file that can run the api deprecation task.

Running the Tasks

The ant tasks are available in the org.eclipse.pde.api.tools bundle. To run the tasks from ant, the jarred code (apitooling-ant.jar) must be on the Ant classpath.

If you are running the tasks from an Eclipse target workspace, you must preface the task name with apitooling. When running the ant task directly, just the task name is required. You must also modify your ant launch configuration to "Run in the same JRE as the workspace" on the JRE tab. If the task cannot be found, you will get the following error:

/target/Project/build.xml:15:
Problem: failed to create task or type apideprecation
Cause: The name is undefined.

Several of the tasks will only run on bundles which have the API Tools nature enabled. To check if the nature is enabled on your project, look for the following inside of the .project file:

Task Descriptions

The task descriptions sometimes describe the producers and consumers of a reference. The producer is the bundle that contains the code that created the API or internal code that is being referenced by another product. The consumer is the bundle that contains the code that calls the API or code. As an example, org.eclipse.debug.ui is a producer of the api type Launch. A product that provides a launch configuration may extend the Launch class and is the consumer of that API. Some tasks are intended to be run on one type of bundle. Some bundles may both produce and consume api and can act as both in the tasks.

Analysis Task

This task runs a complete API analysis of an API profile relative to a baseline - including API use, binary compatibility, and bundle version number validation. The profile is the current state of a product under development. The profile is compared to an API baseline for binary compatibility (usually the previous release of a product).

The analysis does not include @since tag validation as all verification is performed on binary class files (source is not analyzed).

Analysis Report Conversion - The report conversion task converts the XML reports created by the Analysis Ant task into an HTML report.

API Deprecation Task

This task runs a complete API analysis of an API profile relative to a baseline - looking only for members (classes, fields, methods) that have been deprecated / un-deprecated. The profile is the current state of a product under development. The profile is compared to an API baseline for deprecation changes (usually the previous release of a product).

API Use Task

This task runs a complete search of a given baseline to determine a producer-centric report of API usage.

The analysis does not include bundles that are not API Tools enabled.

API Use Report Conversion - The report conversion task converts the XML reports created by the API Use Ant task into an HTML report.

Consumer API Use Report Conversion - In 3.7, a new conversion task was introduced that organizes the use scan results to more clearly display the consumers of the references (the standard report organizes by the producers). This task runs on the same xml results as the other report task.

API Use Scan Problems Task

This task takes a compared a previous API use scan to a given baseline and reports any use references that have been removed. This task will warn you if you have removed fields, methods or types that are known to be used by downstream clients.

File Generation Task

This task runs to generate all files required by API Tooling inside a binary bundle. This task is run during the Eclipse builds or during the bundle export for all projects that have an API Tooling nature.

Right now, only the file called .api_description is created.

Projects in Eclipse that have the API Tooling nature and have the API Tooling builder enabled will have api_description files generated automatically.