Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUmair Sair2019-04-14 08:56:24 -0400
committerJonah Graham2019-06-21 13:18:06 -0400
commit15cf76040530e7bf60204bffefa202a99b495eac (patch)
treed7c79464301a96d4c911e4e2526dd9ca00f96656
parent0ee3822b0467d14393027045cb6e5ff68dfd7a0f (diff)
downloadorg.eclipse.cdt-15cf76040530e7bf60204bffefa202a99b495eac.tar.gz
org.eclipse.cdt-15cf76040530e7bf60204bffefa202a99b495eac.tar.xz
org.eclipse.cdt-15cf76040530e7bf60204bffefa202a99b495eac.zip
Bug 546407 Project dependencies are not built in the correct order
Problem: ======== filterConfigsToBuild(..) always filters the configs that are once added to set irrespective if it has been built or not. Consider scenario where there are three project a, b, c and a depends on b & c and b depends on c. When a is built, filterConfigsToBuild(..) returns configs of b and c. Then b starts building and filterConfigsToBuild(..) doesn't return config of c because its already in set. This is wrong and it should return config of c because it is not yet built and b depends on it. Fix: ==== If a referenced config by any project/config is not yet built, filterConfigsToBuild(..) shouldn't filter it. Change-Id: I5fbe77789f14ce3114200998070a7461069c98ab Signed-off-by: Umair Sair <umair_sair@hotmail.com>
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core/META-INF/MANIFEST.MF2
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/CommonBuilder.java16
2 files changed, 14 insertions, 4 deletions
diff --git a/build/org.eclipse.cdt.managedbuilder.core/META-INF/MANIFEST.MF b/build/org.eclipse.cdt.managedbuilder.core/META-INF/MANIFEST.MF
index 10e12c9038..49db430575 100644
--- a/build/org.eclipse.cdt.managedbuilder.core/META-INF/MANIFEST.MF
+++ b/build/org.eclipse.cdt.managedbuilder.core/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.cdt.managedbuilder.core; singleton:=true
-Bundle-Version: 8.7.0.qualifier
+Bundle-Version: 8.7.100.qualifier
Bundle-Activator: org.eclipse.cdt.managedbuilder.core.ManagedBuilderCorePlugin
Bundle-Vendor: %providerName
Bundle-Localization: plugin
diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/CommonBuilder.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/CommonBuilder.java
index 955f82cbd7..37bd20e529 100644
--- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/CommonBuilder.java
+++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/CommonBuilder.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2016 Intel Corporation and others.
+ * Copyright (c) 2007, 2019 Intel Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -14,6 +14,7 @@
* Dmitry Kozlov (CodeSourcery) - Build error highlighting and navigation
* Save build output (bug 294106)
* Andrew Gvozdev (Quoin Inc) - Saving build output implemented in different way (bug 306222)
+ * Umair Sair (Mentor Graphics) - Project dependencies are not built in the correct order (bug 546407)
*******************************************************************************/
package org.eclipse.cdt.managedbuilder.internal.core;
@@ -99,6 +100,7 @@ public class CommonBuilder extends ACBuilder {
private static CfgBuildSet fBuildSet = new CfgBuildSet();
private boolean fBuildErrOccured;
+ private Set<String> builtRefConfigIds = new HashSet<>();
public CommonBuilder() {
}
@@ -432,6 +434,7 @@ public class CommonBuilder extends ACBuilder {
printEvent(kind, args);
fBuildSet.start(this);
+ builtRefConfigIds.clear();
IProject project = getProject();
@@ -533,6 +536,11 @@ public class CommonBuilder extends ACBuilder {
monitor.beginTask(ManagedMakeMessages.getResourceString("CommonBuilder.22"), cfgs.length); //$NON-NLS-1$
for (IConfiguration cfg : cfgs) {
IProgressMonitor subMonitor = new SubProgressMonitor(monitor, 1);
+ if (builtRefConfigIds.contains(cfg.getId())) {
+ subMonitor.done();
+ continue;
+ }
+
nextConfigChanged.setValue(false);
try {
IBuilder builder = cfg.getEditableBuilder();
@@ -553,6 +561,7 @@ public class CommonBuilder extends ACBuilder {
} catch (CoreException e) {
ManagedBuilderCorePlugin.log(e);
} finally {
+ builtRefConfigIds.add(cfg.getId());
subMonitor.done();
}
refConfigChanged.setValue(refConfigChanged.getValue() || nextConfigChanged.getValue());
@@ -568,8 +577,9 @@ public class CommonBuilder extends ACBuilder {
List<IConfiguration> cfgList = new ArrayList<>(cfgs.length);
for (IConfiguration cfg : cfgs) {
IProject project = cfg.getOwner().getProject();
- Set<String> set = fBuildSet.getCfgIdSet(project, true);
- if (set.add(cfg.getId())) {
+ fBuildSet.getCfgIdSet(project, true).add(cfg.getId());
+
+ if (!builtRefConfigIds.contains(cfg.getId())) {
if (VERBOSE) {
outputTrace(cfg.getOwner().getProject().getName(),
"set: adding cfg " + cfg.getName() + " ( id=" + cfg.getId() + ")"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$

Back to the top