Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTorbjörn SVENSSON2021-02-24 05:44:46 -0500
committerTorbjörn SVENSSON2021-03-01 05:47:47 -0500
commitafd8342ec00e2b33a7d70b80579ba054a3d9fac2 (patch)
tree0990ad1e4d2b2812d5958d931ca61852ed4ee7a3 /build/org.eclipse.cdt.managedbuilder.core/src/org
parent1404e46d70b1f8603bc46586ea5f9950d17b41bc (diff)
downloadorg.eclipse.cdt-afd8342ec00e2b33a7d70b80579ba054a3d9fac2.tar.gz
org.eclipse.cdt-afd8342ec00e2b33a7d70b80579ba054a3d9fac2.tar.xz
org.eclipse.cdt-afd8342ec00e2b33a7d70b80579ba054a3d9fac2.zip
Bug 571458: Return verdict of all configs
When invoking the headless build, the verdict should be the "sum" of all the build configurations. If one build configuration fails, then the verdict of the build should also be "failed". Contributed by STMicroelectronics Change-Id: Ic3237d3531657f7f89c9338142ebf8fdb477c481 Signed-off-by: Torbjörn SVENSSON <torbjorn.svensson@st.com>
Diffstat (limited to 'build/org.eclipse.cdt.managedbuilder.core/src/org')
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/HeadlessBuilder.java49
1 files changed, 26 insertions, 23 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 143b0e6a1d1..3d62a11e4bd 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
@@ -271,18 +271,28 @@ public class HeadlessBuilder implements IApplication {
/*
* Build the given configurations using the specified build type (FULL, CLEAN, INCREMENTAL)
*/
- protected void buildConfigurations(Map<IProject, Set<ICConfigurationDescription>> projConfigs,
- final IProgressMonitor monitor, final int buildType) throws CoreException {
+ protected boolean buildConfigurations(Map<IProject, Set<ICConfigurationDescription>> projConfigs,
+ final IProgressMonitor monitor, final int buildType, List<String> allBuildErrors) throws CoreException {
+ boolean buildSuccessful = true;
for (Map.Entry<IProject, Set<ICConfigurationDescription>> entry : projConfigs.entrySet()) {
Set<ICConfigurationDescription> cfgDescs = entry.getValue();
- IConfiguration[] configs = new IConfiguration[cfgDescs.size()];
- int i = 0;
- for (ICConfigurationDescription cfgDesc : cfgDescs)
- configs[i++] = ManagedBuildManager.getConfigurationForDescription(cfgDesc);
+ for (ICConfigurationDescription cfgDesc : cfgDescs) {
+ IConfiguration[] configs = new IConfiguration[] {
+ ManagedBuildManager.getConfigurationForDescription(cfgDesc) };
+
+ ManagedBuildManager.buildConfigurations(configs, null, new SubProgressMonitor(monitor, 1), true,
+ buildType);
+
+ buildSuccessful = buildSuccessful && isProjectSuccesfullyBuild(entry.getKey());
+ if (printErrorMarkers) {
+ accumulateErrorMarkers(entry.getKey(), allBuildErrors);
+ }
+ }
- ManagedBuildManager.buildConfigurations(configs, null, new SubProgressMonitor(monitor, 1), true, buildType);
}
+
+ return buildSuccessful;
}
/**
@@ -538,7 +548,8 @@ public class HeadlessBuilder implements IApplication {
for (String regEx : projectRegExToClean)
matchConfigurations(regEx, allProjects, configsToBuild);
// Clean the list of configurations
- buildConfigurations(configsToBuild, monitor, IncrementalProjectBuilder.CLEAN_BUILD);
+ buildConfigurations(configsToBuild, monitor, IncrementalProjectBuilder.CLEAN_BUILD,
+ new ArrayList<>());
}
// Build the projects the user wants building
@@ -547,26 +558,18 @@ public class HeadlessBuilder implements IApplication {
ACBuilder.setAllConfigBuild(true);
System.out.println(HeadlessBuildMessages.HeadlessBuilder_building_all);
- root.getWorkspace().build(IncrementalProjectBuilder.FULL_BUILD, monitor);
- for (IProject p : root.getProjects()) {
- buildSuccessful = buildSuccessful && isProjectSuccesfullyBuild(p);
- if (printErrorMarkers) {
- accumulateErrorMarkers(p, allBuildErrors);
- }
- }
+
+ // Collect build configurations for all projects in workspace
+ matchConfigurations(".*", allProjects, configsToBuild); //$NON-NLS-1$
} else {
// Resolve the regular expression project names to build configurations
for (String regEx : projectRegExToBuild)
matchConfigurations(regEx, allProjects, configsToBuild);
- // Build the list of configurations
- buildConfigurations(configsToBuild, monitor, IncrementalProjectBuilder.FULL_BUILD);
- for (IProject p : configsToBuild.keySet()) {
- buildSuccessful = buildSuccessful && isProjectSuccesfullyBuild(p);
- if (printErrorMarkers) {
- accumulateErrorMarkers(p, allBuildErrors);
- }
- }
}
+
+ // Build the list of configurations
+ buildSuccessful = buildConfigurations(configsToBuild, monitor, IncrementalProjectBuilder.FULL_BUILD,
+ allBuildErrors);
} finally {
// Reset the tool options
if (!savedToolOptions.isEmpty())

Back to the top