Skip to main content
summaryrefslogtreecommitdiffstats
path: root/build
diff options
context:
space:
mode:
authorTorbjörn Svensson2018-03-21 16:04:46 -0400
committerWilliam Riley2018-05-09 10:56:10 -0400
commit4881a2ecd42d20dbb5e785801b122daa27f36799 (patch)
tree4ba0089004f8429521110efa3b08434b371cfa28 /build
parent0bf58281c250678e33db11db6c8163428b167220 (diff)
downloadorg.eclipse.cdt-4881a2ecd42d20dbb5e785801b122daa27f36799.tar.gz
org.eclipse.cdt-4881a2ecd42d20dbb5e785801b122daa27f36799.tar.xz
org.eclipse.cdt-4881a2ecd42d20dbb5e785801b122daa27f36799.zip
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>
Diffstat (limited to 'build')
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/HeadlessBuilder.java34
1 files changed, 3 insertions, 31 deletions
diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/HeadlessBuilder.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/HeadlessBuilder.java
index 29ad3614f9..f3ec34ea38 100644
--- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/HeadlessBuilder.java
+++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/HeadlessBuilder.java
@@ -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);
}
}

Back to the top