Jump to: navigation, search

Difference between revisions of "SetRequiredBundleVersionRanges"

(Setup)
Line 1: Line 1:
 
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.
 
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 ===
+
== Setup ==
  
 
Here's how it works:
 
Here's how it works:
Line 31: Line 31:
 
: 2. PDE build looks in all available [http://dev.eclipse.org/viewcvs/indextools.cgi/*checkout*/org.eclipse.emf.releng.build/sdk/customTargets.xml customTargets.xml] files.
 
: 2. PDE build looks in all available [http://dev.eclipse.org/viewcvs/indextools.cgi/*checkout*/org.eclipse.emf.releng.build/sdk/customTargets.xml customTargets.xml] files.
  
  <emf.build.SetRequiredBundleVersionRanges verbose="true">
+
<emf.build.SetRequiredBundleVersionRanges verbose="true">
    <manifestSet dir="${eclipse.plugins}">
+
  <manifestSet dir="${eclipse.plugins}">
      <include name="org.eclipse.emf*/META-INF/MANIFEST.MF" />
+
    <include name="org.eclipse.emf*/META-INF/MANIFEST.MF" />
      <include name="org.eclipse.xsd*/META-INF/MANIFEST.MF" />
+
    <include name="org.eclipse.xsd*/META-INF/MANIFEST.MF" />
            <exclude name="*-feature/**" />
+
    <exclude name="*-feature/**" />
    </manifestSet>
+
  </manifestSet>
 
+
  <dependencySet dir="${eclipse.plugins}">
    <dependencySet dir="${eclipse.plugins}">
+
    <include name="*.jar" />
        <include name="*.jar" />
+
    <include name="*/META-INF/MANIFEST.MF" />
        <include name="*/META-INF/MANIFEST.MF" />
+
    <exclude name="org.eclipse.emf*/**" />
        <exclude name="org.eclipse.emf*/**" />
+
    <exclude name="org.eclipse.xsd*/**" />
        <exclude name="org.eclipse.xsd*/**" />
+
  </dependencySet>
    </dependencySet>
+
 
   
 
   
    <versionRangeRule requiredBundleRegex="org\.eclipse\.(emf|xsd)" />
+
  <versionRangeRule requiredBundleRegex="org\.eclipse\.(emf|xsd)" />
    <versionRangeRule lowerVersion="{current}.{current}.0" />
+
  <versionRangeRule lowerVersion="{current}.{current}.0" />
  </emf.build.SetRequiredBundleVersionRanges> 
+
</emf.build.SetRequiredBundleVersionRanges> 
 +
 
 +
: For more on how to use the &lt;versionRangeRule&gt; and other subtasks, see the javadoc in the class source for [http://dev.eclipse.org/viewcvs/indextools.cgi/*checkout*/org.eclipse.emf.releng.build/org.eclipse.emf.build.ant/tasks/org/eclipse/emf/build/ant/taskdefs/SetRequiredBundleVersionRanges.java emf.build.SetRequiredBundleVersionRanges] (eg., open in Eclipse). You can also view it as [http://dev.eclipse.org/viewcvs/indextools.cgi/*checkout*/org.eclipse.emf.releng.build/org.eclipse.emf.build.ant/tasks/org/eclipse/emf/build/ant/taskdefs/SetRequiredBundleVersionRanges.java?rev=HEAD&content-type=text/html loosely formatted HTML].
  
 
: 3. [http://dev.eclipse.org/viewcvs/indextools.cgi/*checkout*/org.eclipse.emf.releng.build/org.eclipse.emf.build.ant/tasks/org/eclipse/emf/build/ant/taskdefs/SetRequiredBundleVersionRanges.java emf.build.SetRequiredBundleVersionRanges] task, as defined in the [http://dev.eclipse.org/viewcvs/indextools.cgi/*checkout*/org.eclipse.emf.releng.build/org.eclipse.emf.build.ant/plugin.xml plugin.xml] file, is then run to manipulate MANIFEST.MF files.
 
: 3. [http://dev.eclipse.org/viewcvs/indextools.cgi/*checkout*/org.eclipse.emf.releng.build/org.eclipse.emf.build.ant/tasks/org/eclipse/emf/build/ant/taskdefs/SetRequiredBundleVersionRanges.java emf.build.SetRequiredBundleVersionRanges] task, as defined in the [http://dev.eclipse.org/viewcvs/indextools.cgi/*checkout*/org.eclipse.emf.releng.build/org.eclipse.emf.build.ant/plugin.xml plugin.xml] file, is then run to manipulate MANIFEST.MF files.

Revision as of 16:38, 28 August 2006

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

Note that the hard line wrapping is added when PDE edits and saves these files.