Skip to main content

Notice: This Wiki is now read only and edits are no longer possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

SetRequiredBundleVersionRanges

SetRequiredBundleVersionRanges is an Ant task used to automatically set RequiredBundle version range values in MANIFEST.MF files during EMF builds, rather than having to set them manually and update them manually.

Setup

Here's how it works:

This plugin is used as a jarred plugin during the EMF build, like this:

1. Eclipse Build is started from build.sh.
scriptsDir="/home/www-data/emf-build/scripts";
echo "Copy $scriptsDir/org.eclipse.emf.build.ant*.jar to $relengBaseBuilderDir/plugins/";
for f in `find $scriptsDir -name "org.eclipse.emf.build.ant*.jar"`; do cp $f $relengBaseBuilderDir/plugins/; done

echo Invoking Eclipse build

command="$vm -cp $relengBaseBuilderDir/startup.jar org.eclipse.core.launcher.Main"
command=$command" -application org.eclipse.ant.core.antRunner"
command=$command" -f $antScript $target" # for testing, add -verbose before -f to increase log verbosity (and also size!)
#command=$command" $bootclasspath" # removed: this is now specified in the ant task
command=$command" -DmapVersionTag=$mapVersionTag"
command=$command" -DbuildType=$buildType"
command=$command" $buildID"
command=$command" $buildTimestamp"
command=$command" $buildDir"
command=$command" $buildAlias"
command=$command" $downloadsDir"
command=$command" $rsyncPWFile $ftpUser $ftpPassword"
$baseDir/scripts/executeCommand.sh "$command"
2. PDE build looks in all available customTargets.xml files.
<emf.build.SetRequiredBundleVersionRanges verbose="true">
  <manifestSet dir="${eclipse.plugins}">
    <include name="org.eclipse.emf*/META-INF/MANIFEST.MF" />
    <include name="org.eclipse.xsd*/META-INF/MANIFEST.MF" />
    <exclude name="*-feature/**" />
  </manifestSet>
  <dependencySet dir="${eclipse.plugins}">
    <include name="*.jar" />
    <include name="*/META-INF/MANIFEST.MF" />
    <exclude name="org.eclipse.emf*/**" />
    <exclude name="org.eclipse.xsd*/**" />
  </dependencySet>

  <versionRangeRule requiredBundleRegex="org\.eclipse\.(emf|xsd)" />
  <versionRangeRule lowerVersion="{current}.{current}.0" />
</emf.build.SetRequiredBundleVersionRanges>  	
For more on how to use the <versionRangeRule> and other subtasks, see the javadoc in the class source for emf.build.SetRequiredBundleVersionRanges (eg., open in Eclipse). You can also view it as loosely formatted HTML.
3. emf.build.SetRequiredBundleVersionRanges task, as defined in the plugin.xml file, is then run to manipulate MANIFEST.MF files.

Output

For a file such as org.eclipse.emf.ecore/META-INF/MANIFEST.MF:

Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.emf.ecore; singleton:=true
Bundle-Version: 2.2.0.qualifier
Bundle-ClassPath: ecore.jar
Bundle-Activator: org.eclipse.emf.ecore.plugin.EcorePlugin$Implementation
Bundle-Vendor: %providerName
Bundle-Localization: plugin
Export-Package: org.eclipse.emf.ecore,
 org.eclipse.emf.ecore.impl,
 org.eclipse.emf.ecore.plugin,
 org.eclipse.emf.ecore.resource,
 org.eclipse.emf.ecore.resource.impl,
 org.eclipse.emf.ecore.util,
 org.eclipse.emf.ecore.xml.namespace,
 org.eclipse.emf.ecore.xml.namespace.impl,
 org.eclipse.emf.ecore.xml.namespace.util,
 org.eclipse.emf.ecore.xml.type,
 org.eclipse.emf.ecore.xml.type.impl,
 org.eclipse.emf.ecore.xml.type.internal,
 org.eclipse.emf.ecore.xml.type.util
Require-Bundle: org.eclipse.core.runtime,
 org.eclipse.emf.common;visibility:=reexport,
 org.eclipse.core.resources;resolution:=optional
Eclipse-LazyStart: true

The resulting MANIFEST.MF file will look like this:

Manifest-Version: 1.0
Bundle-Name: %pluginName
Bundle-ClassPath: .
Bundle-Activator: org.eclipse.emf.ecore.plugin.EcorePlugin$Implementat
 ion
Bundle-Vendor: %providerName
Bundle-ManifestVersion: 2
Bundle-Localization: plugin
Bundle-SymbolicName: org.eclipse.emf.ecore; singleton:=true
Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.2.0,4.0.0)
 ",org.eclipse.emf.common;visibility:=reexport;bundle-version="[2.2.0,
 3.0.0)",org.eclipse.core.resources;resolution:=optional;bundle-versio
 n="[3.2.0,4.0.0)"
Export-Package: org.eclipse.emf.ecore,org.eclipse.emf.ecore.impl,org.e
 clipse.emf.ecore.plugin,org.eclipse.emf.ecore.resource,org.eclipse.em
 f.ecore.resource.impl,org.eclipse.emf.ecore.util,org.eclipse.emf.ecor
 e.xml.namespace,org.eclipse.emf.ecore.xml.namespace.impl,org.eclipse.
 emf.ecore.xml.namespace.util,org.eclipse.emf.ecore.xml.type,org.eclip
 se.emf.ecore.xml.type.impl,org.eclipse.emf.ecore.xml.type.internal,or
 g.eclipse.emf.ecore.xml.type.util
Bundle-Version: 2.2.0.v200606271057
Eclipse-LazyStart: true

This tool works with both jarred and unjarred plugins. EMF's doc plugin is currently unjarred for performance reasons, and contains this MANIFEST.MF file:

Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.emf.doc; singleton:=true
Bundle-Version: 2.2.0.qualifier
Bundle-Vendor: %providerName
Bundle-Localization: plugin
Require-Bundle: org.eclipse.help
Eclipse-LazyStart: true
Manifest-Version: 1.0
Bundle-Name: %pluginName
Bundle-Vendor: %providerName
Bundle-ManifestVersion: 2
Bundle-Localization: plugin
Bundle-SymbolicName: org.eclipse.emf.doc; singleton:=true
Require-Bundle: org.eclipse.help;bundle-version="[3.2.0,4.0.0)"
Bundle-Version: 2.2.0.v200606271057
Eclipse-LazyStart: true

Note:

  • The hard line wrapping is added when PDE edits and saves these files.
  • The reason that Bundle-Version: 2.2.0.qualifier becomes Bundle-Version: 2.2.0.v200606271057 is due to another PDE tool, and is unrelated to this task.

Back to the top