mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-23 14:42:11 +02:00
Bug 330204 - Use ManagedBuildManager to build
The UI is using ManagedBuildManager to build a specified set of configurations. Insead of duplicating the logic (since clean does not support argument transfer from HeadlessBuilder all the way to CommonBuilder), call the public function for building a set of configurations. WARNING: This fix is relying on a race condition in ManagedBuildManager.buildConfigurations() since that method swaps the "active configuration" while invoking the builder for the clean target. Change-Id: I422a22e43a0acbef85420c04028475d61ad2ff85 Signed-off-by: Torbjörn Svensson <torbjorn.svensson@st.com>
This commit is contained in:
parent
0bf58281c2
commit
4881a2ecd4
1 changed files with 2 additions and 30 deletions
|
@ -14,6 +14,7 @@
|
|||
* to exit code
|
||||
* R. Zulliger, C. Walther (Indel AG) - Bug 355609 Disable indexer
|
||||
* John Dallaway - Bug 513763 Save workspace on conclusion
|
||||
* Torbjörn Svensson (STMicroelectronics) - bug #330204
|
||||
*******************************************************************************/
|
||||
|
||||
package org.eclipse.cdt.managedbuilder.internal.core;
|
||||
|
@ -264,43 +265,14 @@ public class HeadlessBuilder implements IApplication {
|
|||
*/
|
||||
private void buildConfigurations(Map<IProject, Set<ICConfigurationDescription>> projConfigs, final IProgressMonitor monitor, final int buildType) throws CoreException {
|
||||
for (Map.Entry<IProject, Set<ICConfigurationDescription>> entry : projConfigs.entrySet()) {
|
||||
final IProject proj = entry.getKey();
|
||||
Set<ICConfigurationDescription> cfgDescs = entry.getValue();
|
||||
|
||||
IConfiguration[] configs = new IConfiguration[cfgDescs.size()];
|
||||
int i = 0;
|
||||
for (ICConfigurationDescription cfgDesc : cfgDescs)
|
||||
configs[i++] = ManagedBuildManager.getConfigurationForDescription(cfgDesc);
|
||||
final Map<String, String> map = BuilderFactory.createBuildArgs(configs);
|
||||
|
||||
IWorkspaceRunnable op = new IWorkspaceRunnable() {
|
||||
@Override
|
||||
public void run(IProgressMonitor monitor) throws CoreException {
|
||||
ICommand[] commands = proj.getDescription().getBuildSpec();
|
||||
monitor.beginTask("", commands.length); //$NON-NLS-1$
|
||||
for (int i = 0; i < commands.length; i++) {
|
||||
if (commands[i].getBuilderName().equals(CommonBuilder.BUILDER_ID)) {
|
||||
proj.build(buildType, CommonBuilder.BUILDER_ID, map, new SubProgressMonitor(monitor, 1));
|
||||
} else {
|
||||
//Combine command args with build args
|
||||
Map<String, String> args = commands[i].getArguments();
|
||||
if(args != null) {
|
||||
args.putAll(map);
|
||||
} else {
|
||||
args = map;
|
||||
}
|
||||
proj.build(buildType, commands[i].getBuilderName(),
|
||||
args, new SubProgressMonitor(monitor, 1));
|
||||
}
|
||||
}
|
||||
monitor.done();
|
||||
}
|
||||
};
|
||||
try {
|
||||
ResourcesPlugin.getWorkspace().run(op, monitor);
|
||||
} finally {
|
||||
monitor.done();
|
||||
}
|
||||
ManagedBuildManager.buildConfigurations(configs, null, new SubProgressMonitor(monitor, 1), true, buildType);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue