Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 238383 - pde.exportFeatures ant task should run synchronously
Summary: pde.exportFeatures ant task should run synchronously
Status: RESOLVED DUPLICATE of bug 58413
Alias: None
Product: PDE
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.4   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: PDE-UI-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-06-25 03:51 EDT by Rüdiger Herrmann CLA
Modified: 2008-07-08 21:57 EDT (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Rüdiger Herrmann CLA 2008-06-25 03:51:45 EDT
The ant script seems to fork the pde.exportFeatures task and then continues.
If - as in my case - the next task is dependent on the output of the exportFeatures task - this doesn't work too well.

	<pde.exportFeatures
			features="${feature}" 
			[ ... ] />
  <dependentTask>
    [ ... ]
    <!-- this task runs before pde.exportFeatures is done -->
  </dependentTask>

A way to tell pde.exportFeatures to wait until the actual work is done would help.
Comment 1 Andrew Niefer CLA 2008-06-25 11:28:12 EDT
pde.exportFeatures is a UI Task.
When running from a headless environment you would be better using the tasks provided by build.  See eclipse.buildScript (http://help.eclipse.org/ganymede/index.jsp?topic=/org.eclipse.pde.doc.user/tasks/pde_feature_generating_antcommandline.htm)
and http://help.eclipse.org/ganymede/index.jsp?topic=/org.eclipse.pde.doc.user/tasks/pde_feature_build.htm
Comment 2 David Henderson CLA 2008-07-01 19:22:49 EDT
I'm confused...  If pde.exportFeatures is a UI task, then why would you want to run it from an ant script?  I was expecting the same behavior as the reporter of this bug.  For me, I thought the whole point of having that ant task was so you can automate feature export in the middle of a build process that you already have implemented in Ant.  If it's asynchronous, then why not just click on the export link from the UI?
Comment 3 Darin Wright CLA 2008-07-02 15:51:24 EDT
The pde.exportFeatures and pde.exportPlugins tasks are contributed by the PDE/UI component - they are not actually "UI" tasks, they are part of the pde.core plug-in.

However, the tasks can only be run by ant script that is running in the same VM as the Eclipse workspace/OSGi framework. They cannot be used in a PDE headless build (i.e. running without Eclipse workspace/OSGi framework).

The code explicitly waits for the export to complete when the "org.eclipse.ant.core.antRunner" application is running - so it does not block when run in the SDK. I am not familiar enough with PDE to know why this is... the comment says:

// if running in ant runner, block until job is done.  Prevents Exiting before completed
// blocking will cause errors if done when running in regular runtime.

It does not say what the errors are when running in "regular" runtime.
Comment 4 Darin Wright CLA 2008-07-02 16:15:56 EDT
Wassim, do you know why this task was written to run asynchronously in the SDK? Generally, ant tasks run synchronously, unless they support an explicit "fork" attribute.

If this is just to avoid blocking the UI thread during export, it feels like we could just have callers call the task in a non-UI thread/background job (rather than forcing this in the task itself)?
Comment 5 Wassim Melhem CLA 2008-07-08 18:15:09 EDT
Darin, 

I was in Romania.  Now I am back.

this is a dup of bug 58413

The PDE/Export job instantiates an AntRunner to do the work.

Therefore, when the job is called from an Ant task in a synchronous manner, you get an error saying you can't have two instances of Ant running.

The asynchronous part was a hack to make sure the task exited before the job kicked in.

I could not figure out a way to make this work synchronous with the current programmatic way we call pde/build.  
Comment 6 Darin Wright CLA 2008-07-08 21:57:59 EDT
Thanks, Wassim.

*** This bug has been marked as a duplicate of bug 58413 ***