[391874] [Releng] Generate API reports during Hudson build 
https://bugs.eclipse.org/bugs/show_bug.cgi?id=391874
diff --git a/plugins/org.eclipse.emf.cdo.releng.apireports/src/org/eclipse/emf/cdo/releng/apireports/ApiReportsActor.java b/plugins/org.eclipse.emf.cdo.releng.apireports/src/org/eclipse/emf/cdo/releng/apireports/ApiReportsActor.java
index 1041fd1..85b788a 100644
--- a/plugins/org.eclipse.emf.cdo.releng.apireports/src/org/eclipse/emf/cdo/releng/apireports/ApiReportsActor.java
+++ b/plugins/org.eclipse.emf.cdo.releng.apireports/src/org/eclipse/emf/cdo/releng/apireports/ApiReportsActor.java
@@ -27,6 +27,7 @@
 import org.eclipse.jdt.core.IPackageFragment;
 import org.eclipse.jdt.core.IPackageFragmentRoot;
 import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.JavaCore;
 import org.eclipse.jdt.core.JavaModelException;
 import org.eclipse.pde.api.tools.internal.ApiBaselineManager;
 import org.eclipse.pde.api.tools.internal.comparator.DeltaXmlVisitor;
@@ -64,31 +65,18 @@
   {
   }
 
-  public static void updateMonitor(IProgressMonitor monitor, int work) throws OperationCanceledException
-  {
-    if (monitor == null)
-    {
-      return;
-    }
-    if (monitor.isCanceled())
-    {
-      throw new OperationCanceledException();
-    }
-    monitor.worked(work);
-  }
-
-  public static void updateMonitor(IProgressMonitor monitor) throws OperationCanceledException
-  {
-    updateMonitor(monitor, 0);
-  }
-
   @Override
   protected IStatus internalPerform(IActionContext context, IProgressMonitor monitor) throws CoreException
   {
-    Map<String, ? extends Object> properties = context.getProperties();
-    String baselineName = (String)properties.get("baseline.name");
-    String reportFileName = (String)properties.get("reportfile.name");
-    String exclusionPatterns = (String)properties.get("exclusion.patterns");
+    Map<String, ? extends Object> properties = context.getAction().getActorProperties();
+    String baselineName = (String)properties.get("baseline");
+    if (baselineName == null || baselineName.length() == 0)
+    {
+      return new Status(IStatus.ERROR, Activator.PLUGIN_ID, "Baseline name not specified");
+    }
+
+    String exclusionPatterns = (String)properties.get("exclude");
+    String reportFileName = System.getProperty("api.report", new File("api.xml").getAbsolutePath());
 
     SubMonitor progress = SubMonitor.convert(monitor, 100);
     progress.subTask("Collecting elements to compare");
@@ -185,20 +173,32 @@
 
   private List<Object> collectProjects(String exclusionPatterns)
   {
-    Pattern[] patterns = new Pattern[exclusionPatterns.length()];
-    String[] split = exclusionPatterns.split(",");
-    for (int i = 0; i < split.length; i++)
+    Pattern[] patterns = new Pattern[0];
+    if (exclusionPatterns != null)
     {
-      patterns[i] = Pattern.compile(split[i]);
+      String[] split = exclusionPatterns.split(",");
+      patterns = new Pattern[split.length];
+      for (int i = 0; i < split.length; i++)
+      {
+        Pattern pattern = Pattern.compile(split[i]);
+        patterns[i] = pattern;
+      }
     }
 
     List<Object> result = new ArrayList<Object>();
     for (IProject project : ResourcesPlugin.getWorkspace().getRoot().getProjects())
     {
-      String name = project.getName();
-      if (!isExcluded(patterns, name))
+      if (project.isAccessible())
       {
-        result.add(project);
+        String name = project.getName();
+        if (!isExcluded(patterns, name))
+        {
+          IJavaProject javaProject = JavaCore.create(project);
+          if (javaProject != null)
+          {
+            result.add(javaProject);
+          }
+        }
       }
     }
 
@@ -396,4 +396,24 @@
       }
     }
   }
+
+  private static void updateMonitor(IProgressMonitor monitor, int work) throws OperationCanceledException
+  {
+    if (monitor == null)
+    {
+      return;
+    }
+
+    if (monitor.isCanceled())
+    {
+      throw new OperationCanceledException();
+    }
+
+    monitor.worked(work);
+  }
+
+  private static void updateMonitor(IProgressMonitor monitor) throws OperationCanceledException
+  {
+    updateMonitor(monitor, 0);
+  }
 }
diff --git a/plugins/org.eclipse.emf.cdo.releng/buckminster.cspex b/plugins/org.eclipse.emf.cdo.releng/buckminster.cspex
index ce6f97e..d9b158d 100644
--- a/plugins/org.eclipse.emf.cdo.releng/buckminster.cspex
+++ b/plugins/org.eclipse.emf.cdo.releng/buckminster.cspex
@@ -48,10 +48,10 @@
 	</cs:dependencies>
 
 	<cs:actions>
-		<cs:public name="generate.api.reports" actor="ant" always="true">
+		<cs:public name="generate.api.reports" actor="apireports" always="true">
 			<cs:actorProperties>
-				<cs:property key="buildFile" value="${releng}/hudson/api_reports.ant"/>
-				<cs:property key="targets" value="main"/>
+				<cs:property key="baseline" value="CDO Baseline"/>
+				<cs:property key="exclude" value=".*\.doc.*,.*\.tests.*,.*\.releng.*,.*\.examples.*,.*\.jms.*,.*\.buddies.*,.*\.gastro.*"/>
 			</cs:actorProperties>
 		</cs:public>
 	</cs:actions>
diff --git a/plugins/org.eclipse.emf.cdo.releng/build.xml b/plugins/org.eclipse.emf.cdo.releng/build.xml
index 052685d..8d70e19 100644
--- a/plugins/org.eclipse.emf.cdo.releng/build.xml
+++ b/plugins/org.eclipse.emf.cdo.releng/build.xml
@@ -667,26 +667,14 @@
 
 	<target name="-generate.api">
 		<echo message="Generating API reports" />
-		<copy todir="${temp.dropins}/plugins" overwrite="false">
-			<fileset dir="${tp}/plugins">
-				<include name="**" />
-			</fileset>
-		</copy>
+		<!--
 		<buckminster command="perform">
 			<cmdargs>
 				<arg value="-D" />
-				<arg value="api.profile=${temp.dropins}" />
-				<arg value="-D" />
-				<arg value="api.report=${hudson.WORKSPACE}" />
+				<arg value="api.report=${hudson.WORKSPACE}/api.xml" />
 				<arg value="org.eclipse.emf.cdo.releng#generate.api.reports" />
 			</cmdargs>
 		</buckminster>
-		<delete includeemptydirs="true" quiet="true">
-			<fileset dir="${buckminster.temp.root}">
-				<include name="_dropins/**" />
-			</fileset>
-		</delete>
-		<move file="${hudson.WORKSPACE}/compare.xml" tofile="${hudson.WORKSPACE}/api.xml" verbose="false" />
 		<java classname="org.eclipse.emf.cdo.releng.Api2Html">
 			<classpath>
 				<pathelement location="${releng}/bin/" />
@@ -698,6 +686,7 @@
 			<arg value="${tp}/plugins" />
 		</java>
 		<copy file="${releng}/hudson/api.css" todir="${hudson.WORKSPACE}" overwrite="true" />
+		-->
 	</target>
 
 	<!-- ================= -->