Wait for refresh jobs after a build
Brought to you by:
raner
Some builds (for example, those involving MWE2 workflows) have an additional job that refreshes the workspace, after the actual build job terminated ("Refreshing workspace after mwe2 launch"). For such projects to build properly, ebuilder needs to wait until the refresh job is finished (not just until the build job itself is finished). This may be difficult (or even impossible) to implement in a generic fashion. If it cannot implemented in a generic fashion there needs to be a hook or an option to wait for those type of refresh jobs.
It turns out that the Mwe2LaunchDelegate sets up an IDebugEventSetListener that listens for a DebugEvent.TERMINATE of the IProcess that is associated with the MWE2 launch configuration:
http://dev.eclipse.org/viewcvs/viewvc.cgi/org.eclipse.emf/org.eclipse.emf.mwe/plugins/org.eclipse.emf.mwe2.launch/src/org/eclipse/emf/mwe2/launch/shortcut/Mwe2LaunchDelegate.java?view=markup&revision=1.4&root=Modeling_Project#l26
This is a fairly custom way of triggering a refresh after the MWE2 build terminates. Most likely, waiting for the refresh job can only be achieved by specifically waiting for the job with the name "Refreshing after mwe2 launch." Additionally, it might not be deterministic whether the DebugEvent.TERMINATE used by the Mwe2LaunchDelegate is sent before or after the ILaunchesListener used by ebuilder is called. Also, as job scheduling is done asynchronously there may be a gap between the terminating the build and launching of the refresh job.
For now, it looks like the only viable solution is to make ebuilder aware of MWE2 launches (can be done by looking at the builder name/ID) and synchronize those builds by waiting for the refresh job (instead of waiting for the ILaunchesListener, which is currently done in the SynchronizedLaunch class).