Releng : Automatically set Require-Bundle and Export-Package versions
diff --git a/releng.new/build.xml b/releng.new/build.xml
index 9ecb760..d8914f8 100644
--- a/releng.new/build.xml
+++ b/releng.new/build.xml
@@ -189,7 +189,12 @@
 
           <echo message="Setting versions of Export-Package entries..."/>
 
-          <set-export-package-version bundles="${build.dir}/repository/temp"/>
+          <set-export-package-version bundles="${build.dir}/repository/temp">
+            <exclude id=".*\.source"/>
+            <exclude id="javax\..*"/>
+            <exclude id="net\.sourceforge\..*"/>
+            <exclude id="org\.apache\..*"/>
+          </set-export-package-version>
             
           <zip-dirs source.dir="${build.dir}/repository/temp" dest.dir="${build.dir}/repository/plugins" suffix="jar"/>
 
diff --git a/releng.new/releng/ant-library/src/org/eclipse/sapphire/releng/ant/SetExportPackageVersionTask.java b/releng.new/releng/ant-library/src/org/eclipse/sapphire/releng/ant/SetExportPackageVersionTask.java
index 462a961..ef095f5 100644
--- a/releng.new/releng/ant-library/src/org/eclipse/sapphire/releng/ant/SetExportPackageVersionTask.java
+++ b/releng.new/releng/ant-library/src/org/eclipse/sapphire/releng/ant/SetExportPackageVersionTask.java
@@ -13,6 +13,8 @@
 
 import java.io.File;
 import java.io.IOException;
+import java.util.List;
+import java.util.ArrayList;
 
 import org.apache.tools.ant.BuildException;
 
@@ -26,12 +28,52 @@
     private static final String PROP_EXPORT_PACKAGE = "Export-Package";
     
     private File bundlesLocation = null;
+    private final List<ExcludeEntry> excludes = new ArrayList<ExcludeEntry>();
     
     public void setBundles( final File bundlesLocation )
     {
         this.bundlesLocation = bundlesLocation;
     }
     
+    public ExcludeEntry createExclude()
+    {
+        final ExcludeEntry exclude = new ExcludeEntry();
+        this.excludes.add( exclude );
+        return exclude;
+    }
+    
+    private boolean isExcluded( final String id )
+    {
+        for( ExcludeEntry entry : this.excludes )
+        {
+            final String pattern = entry.getId();
+            
+            if( pattern != null && id.matches( pattern ) )
+            {
+                return true;
+            }
+        }
+        
+        return false;
+    }
+    
+    private boolean isExcluded( final File bundle )
+    {
+        try
+        {
+            return isExcluded( ( new BundleInfo( bundle ) ).getId() );
+        }
+        catch( Exception e )
+        {
+             if( "true".equals( System.getProperty( "debug" ) ) )
+             {
+                e.printStackTrace();
+             }
+        }
+        
+        return true;
+    }
+    
     @Override
     public void execute() throws BuildException
     {
@@ -46,7 +88,7 @@
             {
                 for( File location : this.bundlesLocation.listFiles() )
                 {
-                    if( BundleInfo.isValidBundle( location ) )
+                    if( BundleInfo.isValidBundle( location ) && ! isExcluded( location ) )
                     {
                         final String originalExportPackage = ManifestUtil.readManifestEntry( location, PROP_EXPORT_PACKAGE );
                         
@@ -95,4 +137,19 @@
         }
     }
     
+    public static final class ExcludeEntry
+    {
+        private String id;
+        
+        public String getId()
+        {
+            return this.id;
+        }
+        
+        public void setId( final String id )
+        {
+            this.id = id;
+        }
+    }
+    
 }