Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Gvozdev2011-11-14 14:41:32 -0500
committerAndrew Gvozdev2011-11-14 14:41:32 -0500
commit7f438e269a654630b386900056de3bcd83f9ccad (patch)
tree639a7e355880b3c9017b723a9b3db1bded3426cb /build/org.eclipse.cdt.managedbuilder.core
parentbdd3e822167500622543cb8b332d3b9fbe8a253b (diff)
downloadorg.eclipse.cdt-7f438e269a654630b386900056de3bcd83f9ccad.tar.gz
org.eclipse.cdt-7f438e269a654630b386900056de3bcd83f9ccad.tar.xz
org.eclipse.cdt-7f438e269a654630b386900056de3bcd83f9ccad.zip
bug 259768: "Use optimal jobs number" highly misleading.
Encode "optimal" as negative number and "unlimited" as Integer.MAX_VALUE Based on patch by Mohamed Hussein <mohamed_hussein@mentor.com>
Diffstat (limited to 'build/org.eclipse.cdt.managedbuilder.core')
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/IBuilder.java17
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/IMultiConfiguration.java53
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/InternalBuildRunner.java2
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/buildmodel/BuildProcessManager.java50
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/buildmodel/ParallelBuilder.java8
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Builder.java399
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Configuration.java204
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/GeneratedMakefileBuilder.java432
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/MultiConfiguration.java188
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/newmake/core/IMakeCommonBuildInfo.java40
10 files changed, 934 insertions, 459 deletions
diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/IBuilder.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/IBuilder.java
index 3a60bedc11..9727eb04ad 100644
--- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/IBuilder.java
+++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/IBuilder.java
@@ -75,13 +75,16 @@ public interface IBuilder extends IHoldsOptions, IMakeBuilderInfo {
static final String ATTRIBUTE_CUSTOMIZED_ERROR_PARSERS = "customizedErrorParsers"; //$NON-NLS-1$
static final String ATTRIBUTE_CUSTOM_PROPS = "customBuilderProperties"; //$NON-NLS-1$
-
-// static final String ATTRIBUTE_CUSTOMIZED_ERROR_PARSERS = "customizedErrorParsers"; //$NON-NLS-1$
static final String ATTRIBUTE_IGNORE_ERR_CMD = "ignoreErrCmd"; //$NON-NLS-1$
static final String ATTRIBUTE_STOP_ON_ERR = "stopOnErr"; //$NON-NLS-1$
+
static final String ATTRIBUTE_PARALLEL_BUILD_CMD = "parallelBuildCmd"; //$NON-NLS-1$
static final String ATTRIBUTE_PARALLELIZATION_NUMBER = "parallelizationNumber"; //$NON-NLS-1$
+ /** @since 8.1 */
+ static final String VALUE_OPTIMAL = "optimal"; //$NON-NLS-1$
+ /** @since 8.1 */
+ static final String VALUE_UNLIMITED = "unlimited"; //$NON-NLS-1$
static final String ATTRIBUTE_PARALLEL_BUILD_ON = "parallelBuildOn"; //$NON-NLS-1$
static final String PARALLEL_PATTERN_NUM = "*"; //$NON-NLS-1$
static final String PARALLEL_PATTERN_NUM_START = "["; //$NON-NLS-1$
@@ -92,15 +95,9 @@ public interface IBuilder extends IHoldsOptions, IMakeBuilderInfo {
static final String DEFAULT_TARGET_INCREMENTAL = "all"; //$NON-NLS-1$
static final String DEFAULT_TARGET_CLEAN = "clean"; //$NON-NLS-1$
static final String DEFAULT_TARGET_AUTO = "all"; //$NON-NLS-1$
-
- /**
- * @since 6.0
- */
+ /** @since 6.0 */
static final String ATTRIBUTE_COMMAND_LAUNCHER = "commandLauncher"; //$NON-NLS-1$
-
- /**
- * @since 8.0
- */
+ /** @since 8.0 */
static final String ATTRIBUTE_BUILD_RUNNER = "buildRunner"; //$NON-NLS-1$
/**
diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/IMultiConfiguration.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/IMultiConfiguration.java
index a35d89b66c..f1307bb6ba 100644
--- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/IMultiConfiguration.java
+++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/IMultiConfiguration.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 Intel Corporation and others.
+ * Copyright (c) 2007, 2011 Intel Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -13,19 +13,62 @@ package org.eclipse.cdt.managedbuilder.core;
import org.eclipse.cdt.core.settings.model.ICMultiItemsHolder;
import org.eclipse.cdt.managedbuilder.buildproperties.IBuildProperty;
import org.eclipse.cdt.managedbuilder.buildproperties.IBuildPropertyValue;
+import org.eclipse.cdt.managedbuilder.internal.core.Builder;
+import org.eclipse.cdt.newmake.core.IMakeCommonBuildInfo;
/**
+ * This class is to combine multiple configurations to one to support
+ * selection of multiple configurations on property pages.
+ *
* @noextend This class is not intended to be subclassed by clients.
* @noimplement This interface is not intended to be implemented by clients.
*/
public interface IMultiConfiguration extends IConfiguration, ICMultiItemsHolder {
+ /**
+ * Check if the configuration's builder is operating in parallel mode.
+ * @return {@code true} if parallel mode is enabled, {@code false} otherwise.
+ */
boolean getParallelDef();
- void setParallelDef(boolean def);
-
- int getParallelNumber();
- void setParallelNumber(int num);
+ /**
+ * Set parallel execution mode for the configuration's builder.
+ * @see Builder#setParallelBuildOn(boolean)
+ *
+ * @param parallel - the flag to enable or disable parallel mode.
+ */
+ void setParallelDef(boolean parallel);
+
+ /**
+ * Returns maximum number of parallel threads/jobs used by the configuration's builder.
+ * Note that this function can return negative value to indicate "optimal" number.
+ *
+ * @see #setParallelDef(boolean)
+ * @see Builder#getParallelizationNum()
+ *
+ * @return - maximum number of parallel threads or jobs used by the builder or negative number.
+ * For exact interpretation see table in {@link IMakeCommonBuildInfo#getParallelizationNum()}
+ */
+ int getParallelNumber();
+ /**
+ * Sets maximum number of parallel threads/jobs to be used by builder.
+ * Note that the number will be set only if the builder is in "parallel"
+ * mode.
+ *
+ * @param jobs - maximum number of jobs or threads. If the number is 0
+ * or negative, negative "optimal" number will be set, see
+ * {@link Builder#getOptimalParallelJobNum()}.
+ */
+ void setParallelNumber(int jobs);
+ /**
+ * returns the Internal Builder parallel mode
+ * if true, internal builder will work in parallel mode
+ * otherwise it will use only one thread
+ * @return boolean
+ *
+ * @deprecated since CDT 9.0. Use {@link #getParallelDef()}
+ */
+ @Deprecated
boolean getInternalBuilderParallel();
boolean isInternalBuilderEnabled();
diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/InternalBuildRunner.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/InternalBuildRunner.java
index b8f525e1a1..502c13732d 100644
--- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/InternalBuildRunner.java
+++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/InternalBuildRunner.java
@@ -65,7 +65,7 @@ public class InternalBuildRunner extends AbstractBuildRunner {
public boolean invokeBuild(int kind, IProject project, IConfiguration configuration,
IBuilder builder, IConsole console, IMarkerGenerator markerGenerator,
IncrementalProjectBuilder projectBuilder, IProgressMonitor monitor) throws CoreException {
- boolean isParallel = builder.isParallelBuildOn() && builder.getParallelizationNum() > 1;
+ boolean isParallel = Math.abs(builder.getParallelizationNum()) > 1;
// boolean buildIncrementaly = true;
boolean resumeOnErr = !builder.isStopOnError();
diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/buildmodel/BuildProcessManager.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/buildmodel/BuildProcessManager.java
index 28a31ae2d5..ac5dfc450d 100644
--- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/buildmodel/BuildProcessManager.java
+++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/buildmodel/BuildProcessManager.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2007 Intel Corporation and others.
+ * Copyright (c) 2006, 2011 Intel Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -11,10 +11,6 @@
package org.eclipse.cdt.managedbuilder.internal.buildmodel;
-import java.io.BufferedReader;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.io.InputStreamReader;
import java.io.OutputStream;
import java.util.ArrayList;
import java.util.List;
@@ -23,9 +19,6 @@ import java.util.Map.Entry;
import java.util.Set;
import org.eclipse.cdt.managedbuilder.buildmodel.IBuildCommand;
-import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
-import org.eclipse.cdt.managedbuilder.envvar.IBuildEnvironmentVariable;
-import org.eclipse.cdt.managedbuilder.envvar.IEnvironmentVariableProvider;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
@@ -42,11 +35,6 @@ public class BuildProcessManager {
protected ProcessLauncher[] processes;
protected int maxProcesses;
-// Number of CPUs is not dependent of object instance.
-// But user can change UI settings for processes number.
-// So we cannot set procNumber directly to maxProcesses.
- static int procNumber = 0;
-
/**
* Initializes process manager
*
@@ -152,40 +140,10 @@ public class BuildProcessManager {
/**
* @return Number of processors detected
+ * @deprecated since CDT 9.0 - just use Runtime.getRuntime().availableProcessors()
*/
+ @Deprecated
static public int checkCPUNumber() {
- if (procNumber > 0) return procNumber;
-
- procNumber = 1;
- int x = 0;
- String os = System.getProperty("os.name"); //$NON-NLS-1$
- if (os != null) {
- if (os.startsWith("Win")) { //$NON-NLS-1$
- IEnvironmentVariableProvider evp = ManagedBuildManager.getEnvironmentVariableProvider();
- if (evp != null) {
- IBuildEnvironmentVariable var = evp.getVariable("NUMBER_OF_PROCESSORS", null, false, false); //$NON-NLS-1$
- if (var != null) {
- try {
- x = new Integer(var.getValue()).intValue();
- if (x > 0) { procNumber = x; }
- } catch (NumberFormatException e) {} // fallthrough and return default
- }
- }
- } else { // linux
- String p = "/proc/cpuinfo"; //$NON-NLS-1$
- try {
- BufferedReader r = new BufferedReader(new InputStreamReader(new FileInputStream(p)));
- String s;
- while ((s = r.readLine() ) != null )
- { if (s.startsWith("processor\t:")) x++; } //$NON-NLS-1$
- r.close();
- if (x > 0) { procNumber = x; }
- }
- catch (IOException e) {} // fallthrough and return default
- }
- }
- if(DbgUtil.DEBUG)
- DbgUtil.trace("Number of processors detected: " + procNumber); //$NON-NLS-1$
- return procNumber;
+ return Runtime.getRuntime().availableProcessors();
}
} \ No newline at end of file
diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/buildmodel/ParallelBuilder.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/buildmodel/ParallelBuilder.java
index 782c3d5907..7dfcedf63c 100644
--- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/buildmodel/ParallelBuilder.java
+++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/buildmodel/ParallelBuilder.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006 Intel Corporation and others.
+ * Copyright (c) 2006, 2011 Intel Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -91,6 +91,7 @@ public class ParallelBuilder {
return step.hashCode();
}
+ @Override
public int compareTo(BuildQueueElement elem) {
if (elem == null)
throw new NullPointerException();
@@ -205,10 +206,7 @@ public class ParallelBuilder {
if(cwd == null) cwd = des.getDefaultBuildDirLocation();
int threads = 1;
if (cfg instanceof Configuration) {
- if (((Configuration)cfg).getParallelDef())
- threads = BuildProcessManager.checkCPUNumber();
- else
- threads = ((Configuration)cfg).getParallelNumber();
+ threads = Math.abs(((Configuration)cfg).getParallelNumber());
}
ParallelBuilder builder = new ParallelBuilder(cwd, dirs, out, err, monitor, resumeOnErrors, buildIncrementally);
builder.enqueueAll(des);
diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Builder.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Builder.java
index bb9f105b62..22172cf3b8 100644
--- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Builder.java
+++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Builder.java
@@ -40,10 +40,10 @@ import org.eclipse.cdt.core.settings.model.extension.CBuildData;
import org.eclipse.cdt.core.settings.model.util.CDataUtil;
import org.eclipse.cdt.core.settings.model.util.LanguageSettingEntriesSerializer;
import org.eclipse.cdt.internal.core.SafeStringInterner;
+import org.eclipse.cdt.managedbuilder.core.AbstractBuildRunner;
import org.eclipse.cdt.managedbuilder.core.BuildException;
import org.eclipse.cdt.managedbuilder.core.ExternalBuildRunner;
import org.eclipse.cdt.managedbuilder.core.IBuildObject;
-import org.eclipse.cdt.managedbuilder.core.AbstractBuildRunner;
import org.eclipse.cdt.managedbuilder.core.IBuilder;
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
import org.eclipse.cdt.managedbuilder.core.IManagedConfigElement;
@@ -64,6 +64,7 @@ import org.eclipse.cdt.managedbuilder.macros.IReservedMacroNameSupplier;
import org.eclipse.cdt.managedbuilder.makegen.IManagedBuilderMakefileGenerator;
import org.eclipse.cdt.managedbuilder.makegen.IManagedBuilderMakefileGenerator2;
import org.eclipse.cdt.managedbuilder.makegen.gnu.GnuMakefileGenerator;
+import org.eclipse.cdt.newmake.core.IMakeCommonBuildInfo;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IncrementalProjectBuilder;
import org.eclipse.core.runtime.CoreException;
@@ -79,7 +80,6 @@ import org.eclipse.core.variables.VariablesPlugin;
import org.osgi.framework.Version;
public class Builder extends HoldsOptions implements IBuilder, IMatchKeyProvider<Builder>, IRealBuildObjectAssociation {
-
private static final String EMPTY_STRING = ""; //$NON-NLS-1$
// Superclass
@@ -119,10 +119,12 @@ public class Builder extends HoldsOptions implements IBuilder, IMatchKeyProvider
private HashMap<String, String> customBuildProperties;
// private Boolean isWorkspaceBuildPath;
private String ignoreErrCmd;
- private String parallelBuildCmd;
private Boolean stopOnErr;
- private Integer parallelNum;
- private Boolean parallelBuildOn;
+ // parallelization
+ private String parallelBuildCmd;
+ private Boolean isParallelBuildEnabled;
+ private Integer parallelJobsNumber; // negative number denotes "optimal" value, see getOptimalParallelJobNum()
+
private boolean isTest;
// Miscellaneous
@@ -327,9 +329,10 @@ public class Builder extends HoldsOptions implements IBuilder, IMatchKeyProvider
stopOnErr = builder.stopOnErr;
ignoreErrCmd = builder.ignoreErrCmd;
+
+ isParallelBuildEnabled = builder.isParallelBuildEnabled;
+ parallelJobsNumber = builder.parallelJobsNumber;
parallelBuildCmd = builder.parallelBuildCmd;
- parallelNum = builder.parallelNum;
- parallelBuildOn = builder.parallelBuildOn;
if(builder.outputEntries != null){
outputEntries = builder.outputEntries.clone();
@@ -372,17 +375,15 @@ public class Builder extends HoldsOptions implements IBuilder, IMatchKeyProvider
} catch (CoreException e) {
}
}
- if(getParallelizationNum() != builder.getParallelizationNum()
- && supportsParallelBuild()){
+ if (isParallelBuildOn() != builder.isParallelBuildOn() && supportsParallelBuild()) {
try {
- setParallelizationNum(builder.getParallelizationNum());
+ setParallelBuildOn(builder.isParallelBuildOn());
} catch (CoreException e) {
}
}
- if(isParallelBuildOn() != builder.isParallelBuildOn()
- && supportsParallelBuild()){
+ if (getParallelizationNum() != builder.getParallelizationNum() && supportsParallelBuild()) {
try {
- setParallelBuildOn(builder.isParallelBuildOn());
+ setParallelizationNum(builder.getParallelizationNum());
} catch (CoreException e) {
}
}
@@ -552,23 +553,23 @@ public class Builder extends HoldsOptions implements IBuilder, IMatchKeyProvider
ignoreErrCmd = SafeStringInterner.safeIntern(element.getAttribute(ATTRIBUTE_IGNORE_ERR_CMD));
- tmp = element.getAttribute(ATTRIBUTE_STOP_ON_ERR);
- if(tmp != null)
- stopOnErr = Boolean.valueOf(tmp);
-
- parallelBuildCmd = SafeStringInterner.safeIntern(element.getAttribute(ATTRIBUTE_PARALLEL_BUILD_CMD));
-
- tmp = element.getAttribute(ATTRIBUTE_PARALLELIZATION_NUMBER);
- if(tmp != null){
- try {
- parallelNum = Integer.decode(tmp);
- } catch (NumberFormatException e){
- }
- }
- tmp = element.getAttribute(ATTRIBUTE_PARALLEL_BUILD_ON);
- if(tmp != null)
- parallelBuildOn = Boolean.valueOf(tmp);
-
+ tmp = element.getAttribute(ATTRIBUTE_STOP_ON_ERR);
+ if (tmp != null)
+ stopOnErr = Boolean.valueOf(tmp);
+
+ tmp = element.getAttribute(ATTRIBUTE_PARALLEL_BUILD_CMD);
+ if (tmp != null)
+ parallelBuildCmd = SafeStringInterner.safeIntern(tmp);
+
+ tmp = element.getAttribute(ATTRIBUTE_PARALLEL_BUILD_ON);
+ if (tmp != null) {
+ isParallelBuildEnabled = Boolean.valueOf(tmp);
+ if (isParallelBuildEnabled) {
+ tmp = element.getAttribute(ATTRIBUTE_PARALLELIZATION_NUMBER);
+ decodeParallelizationNumber(element.getAttribute(ATTRIBUTE_PARALLELIZATION_NUMBER));
+ }
+ }
+
// Get the semicolon separated list of IDs of the error parsers
errorParserIds = SafeStringInterner.safeIntern(element.getAttribute(IToolChain.ERROR_PARSERS));
@@ -618,6 +619,46 @@ public class Builder extends HoldsOptions implements IBuilder, IMatchKeyProvider
fBuildRunnerElement = ((DefaultManagedConfigElement)element).getConfigurationElement();
}
+ private String encodeParallelizationNumber(Integer jobsNumber) {
+ if (jobsNumber <= 0)
+ return VALUE_OPTIMAL;
+
+ if (jobsNumber.equals(Integer.MAX_VALUE))
+ return VALUE_UNLIMITED;
+
+ return jobsNumber.toString();
+ }
+
+ private void decodeParallelizationNumber(String value) {
+ if (VALUE_OPTIMAL.equals(value)) {
+ parallelJobsNumber = -getOptimalParallelJobNum();
+ } else if (VALUE_UNLIMITED.equals(value)) {
+ if (!isInternalBuilder()) {
+ parallelJobsNumber = Integer.MAX_VALUE;
+ } else {
+ ManagedBuilderCorePlugin.error("'unlimited' number of jobs is not allowed for Internal Builder, switching to 'optimal'");
+ parallelJobsNumber = -getOptimalParallelJobNum();
+ }
+ } else {
+ try {
+ parallelJobsNumber = Integer.decode(value);
+ } catch (NumberFormatException e) {
+ ManagedBuilderCorePlugin.log(e);
+ parallelJobsNumber = getOptimalParallelJobNum();
+ }
+ if (parallelJobsNumber <= 0) {
+ // compatibility with legacy representation - it was that inconsistent
+ if (isInternalBuilder()) {
+ // "optimal" for Internal Builder
+ parallelJobsNumber = -getOptimalParallelJobNum();
+ } else {
+ // unlimited for External Builder
+ parallelJobsNumber = Integer.MAX_VALUE;
+ }
+ }
+ }
+ }
+
/**
* Initialize the builder information from the XML element
* specified in the argument
@@ -748,24 +789,22 @@ public class Builder extends HoldsOptions implements IBuilder, IMatchKeyProvider
if(element.getAttribute(ATTRIBUTE_IGNORE_ERR_CMD) != null)
ignoreErrCmd = SafeStringInterner.safeIntern(element.getAttribute(ATTRIBUTE_IGNORE_ERR_CMD));
- tmp = element.getAttribute(ATTRIBUTE_STOP_ON_ERR);
- if(tmp != null)
- stopOnErr = Boolean.valueOf(tmp);
-
- if(element.getAttribute(ATTRIBUTE_PARALLEL_BUILD_CMD) != null)
- parallelBuildCmd = SafeStringInterner.safeIntern(element.getAttribute(ATTRIBUTE_PARALLEL_BUILD_CMD));
-
- tmp = element.getAttribute(ATTRIBUTE_PARALLELIZATION_NUMBER);
- if(tmp != null){
- try {
- parallelNum = Integer.decode(tmp);
- } catch (NumberFormatException e){
- }
- }
-
- tmp = element.getAttribute(ATTRIBUTE_PARALLEL_BUILD_ON);
- if(tmp != null)
- parallelBuildOn = Boolean.valueOf(tmp);
+ tmp = element.getAttribute(ATTRIBUTE_STOP_ON_ERR);
+ if (tmp != null)
+ stopOnErr = Boolean.valueOf(tmp);
+
+ tmp = element.getAttribute(ATTRIBUTE_PARALLEL_BUILD_CMD);
+ if (tmp != null)
+ parallelBuildCmd = SafeStringInterner.safeIntern(tmp);
+
+ tmp = element.getAttribute(ATTRIBUTE_PARALLEL_BUILD_ON);
+ if (tmp != null) {
+ isParallelBuildEnabled = Boolean.valueOf(tmp);
+ if (isParallelBuildEnabled) {
+ tmp = element.getAttribute(ATTRIBUTE_PARALLELIZATION_NUMBER);
+ decodeParallelizationNumber(element.getAttribute(ATTRIBUTE_PARALLELIZATION_NUMBER));
+ }
+ }
ICStorageElement[] children = element.getChildren();
for(int i = 0; i < children.length; i++){
@@ -869,16 +908,19 @@ public class Builder extends HoldsOptions implements IBuilder, IMatchKeyProvider
if(customBuildProperties != null)
element.setAttribute(ATTRIBUTE_CUSTOM_PROPS, MapStorageElement.encodeMap(customBuildProperties));
- if(ignoreErrCmd != null)
- element.setAttribute(ATTRIBUTE_IGNORE_ERR_CMD, ignoreErrCmd);
- if(stopOnErr != null)
- element.setAttribute(ATTRIBUTE_STOP_ON_ERR, stopOnErr.toString());
- if(parallelBuildCmd != null)
- element.setAttribute(ATTRIBUTE_PARALLEL_BUILD_CMD, parallelBuildCmd);
- if(parallelNum != null)
- element.setAttribute(ATTRIBUTE_PARALLELIZATION_NUMBER, parallelNum.toString());
- if(parallelBuildOn != null)
- element.setAttribute(ATTRIBUTE_PARALLEL_BUILD_ON, parallelBuildOn.toString());
+ if (ignoreErrCmd != null)
+ element.setAttribute(ATTRIBUTE_IGNORE_ERR_CMD, ignoreErrCmd);
+ if (stopOnErr != null)
+ element.setAttribute(ATTRIBUTE_STOP_ON_ERR, stopOnErr.toString());
+
+ if (parallelBuildCmd != null)
+ element.setAttribute(ATTRIBUTE_PARALLEL_BUILD_CMD, parallelBuildCmd);
+
+ if (isParallelBuildEnabled != null)
+ element.setAttribute(ATTRIBUTE_PARALLEL_BUILD_ON, isParallelBuildEnabled.toString());
+ if (isParallelBuildOn() && parallelJobsNumber != null)
+ element.setAttribute(ATTRIBUTE_PARALLELIZATION_NUMBER, encodeParallelizationNumber(parallelJobsNumber));
+
// Note: build file generator cannot be specified in a project file because
// an IConfigurationElement is needed to load it!
if (buildFileGeneratorElement != null) {
@@ -965,13 +1007,18 @@ public class Builder extends HoldsOptions implements IBuilder, IMatchKeyProvider
if(customBuildProperties != null)
element.setAttribute(ATTRIBUTE_CUSTOM_PROPS, MapStorageElement.encodeMap(customBuildProperties));
- if(getIgnoreErrCmdAttribute() != null)
- element.setAttribute(ATTRIBUTE_IGNORE_ERR_CMD, getIgnoreErrCmdAttribute());
- element.setAttribute(ATTRIBUTE_STOP_ON_ERR, Boolean.valueOf(isStopOnError()).toString());
- if(getParrallelBuildCmd() != null)
- element.setAttribute(ATTRIBUTE_PARALLEL_BUILD_CMD, getParrallelBuildCmd());
- element.setAttribute(ATTRIBUTE_PARALLELIZATION_NUMBER, new Integer(getParallelizationNumAttribute()).toString());
- element.setAttribute(ATTRIBUTE_PARALLEL_BUILD_ON, Boolean.valueOf(isParallelBuildOn()).toString());
+ if (getIgnoreErrCmdAttribute() != null)
+ element.setAttribute(ATTRIBUTE_IGNORE_ERR_CMD, getIgnoreErrCmdAttribute());
+ element.setAttribute(ATTRIBUTE_STOP_ON_ERR, Boolean.valueOf(isStopOnError()).toString());
+
+ if (parallelBuildCmd != null)
+ element.setAttribute(ATTRIBUTE_PARALLEL_BUILD_CMD, parallelBuildCmd);
+
+ if (isParallelBuildEnabled != null)
+ element.setAttribute(ATTRIBUTE_PARALLEL_BUILD_ON, isParallelBuildEnabled.toString());
+ if (isParallelBuildOn() && parallelJobsNumber != null)
+ element.setAttribute(ATTRIBUTE_PARALLELIZATION_NUMBER, encodeParallelizationNumber(parallelJobsNumber));
+
// Note: build file generator cannot be specified in a project file because
// an IConfigurationElement is needed to load it!
if (buildFileGeneratorElement != null) {
@@ -995,6 +1042,7 @@ public class Builder extends HoldsOptions implements IBuilder, IMatchKeyProvider
* P A R E N T A N D C H I L D H A N D L I N G
*/
+ @Override
public IToolChain getParent() {
return parent;
}
@@ -1003,6 +1051,7 @@ public class Builder extends HoldsOptions implements IBuilder, IMatchKeyProvider
* M O D E L A T T R I B U T E A C C E S S O R S
*/
+ @Override
public IBuilder getSuperClass() {
return (IBuilder)superClass;
}
@@ -1012,6 +1061,7 @@ public class Builder extends HoldsOptions implements IBuilder, IMatchKeyProvider
return (name == null && superClass != null) ? superClass.getName() : name;
}
+ @Override
public boolean isAbstract() {
if (isAbstract != null) {
return isAbstract.booleanValue();
@@ -1020,6 +1070,7 @@ public class Builder extends HoldsOptions implements IBuilder, IMatchKeyProvider
}
}
+ @Override
public String getUnusedChildren() {
if (unusedChildren != null) {
return unusedChildren;
@@ -1027,6 +1078,7 @@ public class Builder extends HoldsOptions implements IBuilder, IMatchKeyProvider
return EMPTY_STRING; // Note: no inheritance from superClass
}
+ @Override
public String getCommand() {
if (command == null) {
// If I have a superClass, ask it
@@ -1039,10 +1091,11 @@ public class Builder extends HoldsOptions implements IBuilder, IMatchKeyProvider
return command;
}
+ @Override
public String getArguments() {
String args = getArgumentsAttribute();
String stopOnErrCmd = getStopOnErrCmd(isStopOnError());
- String parallelBuildCmd = isParallelBuildOn() ? getParallelizationCmd(getParallelizationNum()) : EMPTY_STRING;
+ String parallelCmd = isParallelBuildOn() ? getParallelizationCmd(getParallelizationNum()) : EMPTY_STRING;
String reversedStopOnErrCmd = getStopOnErrCmd(!isStopOnError());
String reversedParallelBuildCmd = !isParallelBuildOn() ? getParallelizationCmd(getParallelizationNum()) : EMPTY_STRING;
@@ -1051,7 +1104,7 @@ public class Builder extends HoldsOptions implements IBuilder, IMatchKeyProvider
args = removeCmd(args, reversedParallelBuildCmd);
args = addCmd(args, stopOnErrCmd);
- args = addCmd(args, parallelBuildCmd);
+ args = addCmd(args, parallelCmd);
return args != null ? args.trim() : null;
}
@@ -1121,10 +1174,19 @@ public class Builder extends HoldsOptions implements IBuilder, IMatchKeyProvider
}if(num == 0){
return EMPTY_STRING;
}
-
- return processParallelPattern(pattern, num < 0, num);
+ // "unlimited" number of jobs results in not adding the number to parallelization cmd
+ // that behavior corresponds that of "make" flag "-j".
+ return processParallelPattern(pattern, num == Integer.MAX_VALUE, Math.abs(num));
}
+ /**
+ * This method turns the supplied pattern to parallelization command
+ *
+ * It supports 2 kinds of pattern where "*" is replaced with number of jobs:
+ * <li>Pattern 1 (supports "<b>-j*</b>"): "text*text" -> "text#text"</li>
+ * <li>Pattern 2 (supports "<b>-[j*]</b>"): "text[text*text]text" -> "texttext#texttext</li>
+ * <br>Where # is num or empty if {@code empty} is {@code true})
+ */
private String processParallelPattern(String pattern, boolean empty, int num){
int start = pattern.indexOf(PARALLEL_PATTERN_NUM_START);
int end = -1;
@@ -1190,6 +1252,7 @@ public class Builder extends HoldsOptions implements IBuilder, IMatchKeyProvider
return args;
}
+ @Override
public String getErrorParserIds() {
String ids = errorParserIds;
if (ids == null) {
@@ -1201,6 +1264,7 @@ public class Builder extends HoldsOptions implements IBuilder, IMatchKeyProvider
return ids;
}
+ @Override
public String[] getErrorParserList() {
String parserIDs = getErrorParserIds();
String[] errorParsers = null;
@@ -1223,6 +1287,7 @@ public class Builder extends HoldsOptions implements IBuilder, IMatchKeyProvider
return errorParsers;
}
+ @Override
public void setCommand(String cmd) {
if(getCommand().equals(cmd)) return;
if (cmd == null && command == null) return;
@@ -1232,16 +1297,17 @@ public class Builder extends HoldsOptions implements IBuilder, IMatchKeyProvider
}
}
+ @Override
public void setArguments(String newArgs) {
if(getArguments().equals(newArgs))
return;
if(newArgs != null){
String stopOnErrCmd = getStopOnErrCmd(isStopOnError());
- String parallelBuildCmd = isParallelBuildOn() ? getParallelizationCmd(getParallelizationNum()) : EMPTY_STRING;
+ String parallelCmd = isParallelBuildOn() ? getParallelizationCmd(getParallelizationNum()) : EMPTY_STRING;
newArgs = removeCmd(newArgs, stopOnErrCmd);
- newArgs = removeCmd(newArgs, parallelBuildCmd);
+ newArgs = removeCmd(newArgs, parallelCmd);
}
setArgumentsAttribute(newArgs);
}
@@ -1254,6 +1320,7 @@ public class Builder extends HoldsOptions implements IBuilder, IMatchKeyProvider
}
}
+ @Override
public void setErrorParserIds(String ids) {
String currentIds = getErrorParserIds();
if (ids == null && currentIds == null) return;
@@ -1263,11 +1330,13 @@ public class Builder extends HoldsOptions implements IBuilder, IMatchKeyProvider
}
}
+ @Override
public void setIsAbstract(boolean b) {
isAbstract = new Boolean(b);
setDirty(true);
}
+ @Override
public IConfigurationElement getBuildFileGeneratorElement() {
if (buildFileGeneratorElement == null) {
if (superClass != null) {
@@ -1277,6 +1346,7 @@ public class Builder extends HoldsOptions implements IBuilder, IMatchKeyProvider
return buildFileGeneratorElement;
}
+ @Override
public IManagedBuilderMakefileGenerator getBuildFileGenerator(){
IConfigurationElement element = getBuildFileGeneratorElement();
if (element != null) {
@@ -1299,6 +1369,7 @@ public class Builder extends HoldsOptions implements IBuilder, IMatchKeyProvider
}
+ @Override
public void setBuildFileGeneratorElement(IConfigurationElement element) {
buildFileGeneratorElement = element;
setDirty(true);
@@ -1344,6 +1415,7 @@ public class Builder extends HoldsOptions implements IBuilder, IMatchKeyProvider
}
}
+ @Override
public String getConvertToId() {
if (convertToId == null) {
// If I have a superClass, ask it
@@ -1356,6 +1428,7 @@ public class Builder extends HoldsOptions implements IBuilder, IMatchKeyProvider
return convertToId;
}
+ @Override
public void setConvertToId(String convertToId) {
if (convertToId == null && this.convertToId == null) return;
if (convertToId == null || this.convertToId == null || !convertToId.equals(this.convertToId)) {
@@ -1365,6 +1438,7 @@ public class Builder extends HoldsOptions implements IBuilder, IMatchKeyProvider
return;
}
+ @Override
public String getVersionsSupported() {
if (versionsSupported == null) {
// If I have a superClass, ask it
@@ -1377,6 +1451,7 @@ public class Builder extends HoldsOptions implements IBuilder, IMatchKeyProvider
return versionsSupported;
}
+ @Override
public void setVersionsSupported(String versionsSupported) {
if (versionsSupported == null && this.versionsSupported == null) return;
if (versionsSupported == null || this.versionsSupported == null || !versionsSupported.equals(this.versionsSupported)) {
@@ -1386,18 +1461,21 @@ public class Builder extends HoldsOptions implements IBuilder, IMatchKeyProvider
return;
}
+ @Override
public IFileContextBuildMacroValues getFileContextBuildMacroValues(){
if(fileContextBuildMacroValues == null && superClass != null)
return getSuperClass().getFileContextBuildMacroValues();
return fileContextBuildMacroValues;
}
+ @Override
public String getBuilderVariablePattern(){
if(builderVariablePattern == null && superClass != null)
return getSuperClass().getBuilderVariablePattern();
return builderVariablePattern;
}
+ @Override
public boolean isVariableCaseSensitive(){
if(isVariableCaseSensitive == null){
if(superClass != null)
@@ -1407,12 +1485,14 @@ public class Builder extends HoldsOptions implements IBuilder, IMatchKeyProvider
return isVariableCaseSensitive.booleanValue();
}
+ @Override
public String[] getReservedMacroNames(){
if(reservedMacroNames == null && superClass != null)
return getSuperClass().getReservedMacroNames();
return reservedMacroNames;
}
+ @Override
public IReservedMacroNameSupplier getReservedMacroNameSupplier(){
if(reservedMacroNameSupplier == null && reservedMacroNameSupplierElement != null){
try{
@@ -1617,6 +1697,7 @@ public class Builder extends HoldsOptions implements IBuilder, IMatchKeyProvider
return currentMbsVersionConversionElement;
}
+ @Override
public CBuildData getBuildData() {
return fBuildData;
}
@@ -1627,6 +1708,7 @@ public class Builder extends HoldsOptions implements IBuilder, IMatchKeyProvider
// return null;
// }
+ @Override
public String[] getErrorParsers() {
if(isCustomBuilder() && customizedErrorParserIds != null)
return customizedErrorParserIds.clone();
@@ -1646,6 +1728,7 @@ public class Builder extends HoldsOptions implements IBuilder, IMatchKeyProvider
customizedErrorParserIds = ids != null ? (String[])ids.clone() : ids;
}
+ @Override
public void setErrorParsers(String[] parsers) throws CoreException {
if(isCustomBuilder()){
customizedErrorParserIds = (parsers != null && parsers.length != 0) ? (String[])parsers.clone() : parsers;
@@ -1660,6 +1743,7 @@ public class Builder extends HoldsOptions implements IBuilder, IMatchKeyProvider
return this;//!isExtensionBuilder ? (Object)this : (Object)getParent().getParent();
}
+ @Override
public String getBuildArguments() {
String args = getArguments();
IBuildMacroProvider provider = ManagedBuildManager.getBuildMacroProvider();
@@ -1672,6 +1756,7 @@ public class Builder extends HoldsOptions implements IBuilder, IMatchKeyProvider
return args;
}
+ @Override
public IPath getBuildCommand() {
String command = getCommand();
IBuildMacroProvider provider = ManagedBuildManager.getBuildMacroProvider();
@@ -1697,6 +1782,7 @@ public class Builder extends HoldsOptions implements IBuilder, IMatchKeyProvider
return buildPath;
}
+ @Override
public void setBuildPath(String path){
setBuildPathAttribute(path);
}
@@ -1706,6 +1792,7 @@ public class Builder extends HoldsOptions implements IBuilder, IMatchKeyProvider
setDirty(true);
}
+ @Override
public String getBuildPath(){
if(isManagedBuildOn())
return getDefaultBuildPath();
@@ -1791,6 +1878,7 @@ public class Builder extends HoldsOptions implements IBuilder, IMatchKeyProvider
return isWorkspaceBuildPath.booleanValue();
}
*/
+ @Override
public IPath getBuildLocation() {
String path = getBuildPath();
@@ -1804,10 +1892,12 @@ public class Builder extends HoldsOptions implements IBuilder, IMatchKeyProvider
return new Path(path);
}
+ @Override
public boolean isDefaultBuildCmd() {
return isExtensionBuilder || (command == null && args == null /*&& stopOnErr == null && parallelBuildOn == null && parallelNum == null */ && superClass != null);
}
+ @Override
public boolean isStopOnError() {
if(stopOnErr == null){
if(superClass != null){
@@ -1818,20 +1908,24 @@ public class Builder extends HoldsOptions implements IBuilder, IMatchKeyProvider
return stopOnErr.booleanValue();
}
+ @Override
public void setBuildArguments(String args) throws CoreException {
setArguments(args);
}
+ @Override
public void setBuildCommand(IPath command) throws CoreException {
String cmd = command != null ? command.toString() : null;
setCommand(cmd);
}
+ @Override
public void setBuildLocation(IPath location) throws CoreException {
String path = location != null ? location.toString() : null;
setBuildPath(path);
}
+ @Override
public void setStopOnError(boolean on) throws CoreException {
if(isStopOnError() == on)
return;
@@ -1847,6 +1941,7 @@ public class Builder extends HoldsOptions implements IBuilder, IMatchKeyProvider
setDirty(true);
}
+ @Override
public void setUseDefaultBuildCmd(boolean on) throws CoreException {
if(!isExtensionBuilder && superClass != null){
if(on){
@@ -1870,6 +1965,7 @@ public class Builder extends HoldsOptions implements IBuilder, IMatchKeyProvider
return autoBuildTarget;
}
+ @Override
public String getAutoBuildTarget() {
String attr = getAutoBuildTargetAttribute();
@@ -1898,6 +1994,7 @@ public class Builder extends HoldsOptions implements IBuilder, IMatchKeyProvider
return cleanBuildTarget;
}
+ @Override
public String getCleanBuildTarget() {
String attr = getCleanBuildTargetAttribute();
@@ -1917,6 +2014,7 @@ public class Builder extends HoldsOptions implements IBuilder, IMatchKeyProvider
}
+ @Override
public String getFullBuildTarget() {
return getIncrementalBuildTarget();
}
@@ -1930,6 +2028,7 @@ public class Builder extends HoldsOptions implements IBuilder, IMatchKeyProvider
return incrementalBuildTarget;
}
+ @Override
public String getIncrementalBuildTarget() {
String attr = getIncrementalBuildTargetAttribute();
@@ -1948,6 +2047,7 @@ public class Builder extends HoldsOptions implements IBuilder, IMatchKeyProvider
return attr;
}
+ @Override
public boolean isAutoBuildEnable() {
if(autoBuildEnabled == null){
if(superClass != null)
@@ -1957,6 +2057,7 @@ public class Builder extends HoldsOptions implements IBuilder, IMatchKeyProvider
return autoBuildEnabled.booleanValue();
}
+ @Override
public boolean isCleanBuildEnabled() {
if(cleanBuildEnabled == null){
if(superClass != null)
@@ -1966,10 +2067,12 @@ public class Builder extends HoldsOptions implements IBuilder, IMatchKeyProvider
return cleanBuildEnabled.booleanValue();
}
+ @Override
public boolean isFullBuildEnabled() {
return isIncrementalBuildEnabled();
}
+ @Override
public boolean isIncrementalBuildEnabled() {
if(incrementalBuildEnabled == null){
if(superClass != null)
@@ -1979,38 +2082,47 @@ public class Builder extends HoldsOptions implements IBuilder, IMatchKeyProvider
return incrementalBuildEnabled.booleanValue();
}
+ @Override
public void setAutoBuildEnable(boolean enabled) throws CoreException {
autoBuildEnabled = Boolean.valueOf(enabled);
}
+ @Override
public void setAutoBuildTarget(String target) throws CoreException {
autoBuildTarget = target;
}
+ @Override
public void setCleanBuildEnable(boolean enabled) throws CoreException {
cleanBuildEnabled = Boolean.valueOf(enabled);
}
+ @Override
public void setCleanBuildTarget(String target) throws CoreException {
cleanBuildTarget = target;
}
+ @Override
public void setFullBuildEnable(boolean enabled) throws CoreException {
setIncrementalBuildEnable(enabled);
}
+ @Override
public void setFullBuildTarget(String target) throws CoreException {
setIncrementalBuildTarget(target);
}
+ @Override
public void setIncrementalBuildEnable(boolean enabled) throws CoreException {
incrementalBuildEnabled = Boolean.valueOf(enabled);
}
+ @Override
public void setIncrementalBuildTarget(String target) throws CoreException {
incrementalBuildTarget = target;
}
+ @Override
public boolean appendEnvironment() {
if(appendEnvironment == null){
if(superClass != null){
@@ -2021,6 +2133,7 @@ public class Builder extends HoldsOptions implements IBuilder, IMatchKeyProvider
return appendEnvironment.booleanValue();
}
+ @Override
public String getBuildAttribute(String name, String defaultValue) {
String result = null;
if(BUILD_TARGET_INCREMENTAL.equals(name)){
@@ -2156,12 +2269,14 @@ public class Builder extends HoldsOptions implements IBuilder, IMatchKeyProvider
}
+ @Override
public Map<String, String> getEnvironment() {
if(customizedEnvironment != null)
return cloneMap(customizedEnvironment);
return null;
}
+ @Override
public Map<String, String> getExpandedEnvironment() throws CoreException {
if(customizedEnvironment != null){
Map<String, String> expanded = cloneMap(customizedEnvironment);
@@ -2183,10 +2298,12 @@ public class Builder extends HoldsOptions implements IBuilder, IMatchKeyProvider
return null;
}
+ @Override
public void setAppendEnvironment(boolean append) throws CoreException {
appendEnvironment = Boolean.valueOf(append);
}
+ @Override
public void setBuildAttribute(String name, String value)
throws CoreException {
if(BUILD_TARGET_INCREMENTAL.equals(name)){
@@ -2255,10 +2372,12 @@ public class Builder extends HoldsOptions implements IBuilder, IMatchKeyProvider
return customBuildProperties;
}
+ @Override
public void setEnvironment(Map<String, String> env) throws CoreException {
customizedEnvironment = new HashMap<String, String>(env);
}
+ @Override
public boolean isCustomBuilder() {
if(!isExtensionBuilder && getParent().getBuilder() != this)
return true;
@@ -2271,6 +2390,7 @@ public class Builder extends HoldsOptions implements IBuilder, IMatchKeyProvider
return null;
}
+ @Override
public boolean isManagedBuildOn() {
IConfiguration cfg = getConfguration();
if(cfg != null){
@@ -2295,14 +2415,17 @@ public class Builder extends HoldsOptions implements IBuilder, IMatchKeyProvider
return managedBuildOn;
}
+ @Override
public void setManagedBuildOn(boolean on) throws CoreException {
managedBuildOn = Boolean.valueOf(on);
}
+ @Override
public boolean canKeepEnvironmentVariablesInBuildfile() {
return BuildMacroProvider.canKeepMacrosInBuildfile(this);
}
+ @Override
public boolean keepEnvironmentVariablesInBuildfile() {
if(keepEnvVarInBuildfile == null){
if(superClass != null)
@@ -2312,10 +2435,12 @@ public class Builder extends HoldsOptions implements IBuilder, IMatchKeyProvider
return keepEnvVarInBuildfile.booleanValue();
}
+ @Override
public void setKeepEnvironmentVariablesInBuildfile(boolean keep) {
keepEnvVarInBuildfile = Boolean.valueOf(keep);
}
+ @Override
public boolean supportsCustomizedBuild() {
if(fSupportsCustomizedBuild == null){
IManagedBuilderMakefileGenerator makeGen = getBuildFileGenerator();
@@ -2327,6 +2452,7 @@ public class Builder extends HoldsOptions implements IBuilder, IMatchKeyProvider
return fSupportsCustomizedBuild.booleanValue();
}
+ @Override
public boolean supportsBuild(boolean managed) {
if(supportsManagedBuild == null){
if(superClass != null)
@@ -2340,6 +2466,7 @@ public class Builder extends HoldsOptions implements IBuilder, IMatchKeyProvider
parent = toolChain;
}
+ @Override
public boolean matches(IBuilder builder){
if(builder == this)
return true;
@@ -2351,6 +2478,7 @@ public class Builder extends HoldsOptions implements IBuilder, IMatchKeyProvider
return rBld == ManagedBuildManager.getRealBuilder(builder);
}
+ @Override
public MatchKey<Builder> getMatchKey() {
if(isAbstract())
return null;
@@ -2359,6 +2487,7 @@ public class Builder extends HoldsOptions implements IBuilder, IMatchKeyProvider
return new MatchKey<Builder>(this);
}
+ @Override
public void setIdenticalList(List<Builder> list) {
identicalList = list;
}
@@ -2372,10 +2501,12 @@ public class Builder extends HoldsOptions implements IBuilder, IMatchKeyProvider
return name;
}
+ @Override
public List<Builder> getIdenticalList() {
return identicalList;
}
+ @Override
public boolean isInternalBuilder() {
IBuilder internalBuilder = ManagedBuildManager.getInternalBuilder();
for(IBuilder builder = this; builder != null; builder = builder.getSuperClass()){
@@ -2385,42 +2516,86 @@ public class Builder extends HoldsOptions implements IBuilder, IMatchKeyProvider
return false;
}
- public int getParallelizationNum() {
- if(supportsParallelBuild())
- return getParallelizationNumAttribute();
- return 1;
+ /**
+ * Returns the optimal number of parallel jobs.
+ * The number is the number of available processors on the machine.
+ *
+ * The function never returns number smaller than 1.
+ */
+ public int getOptimalParallelJobNum() {
+ return Runtime.getRuntime().availableProcessors();
}
+ /**
+ * {@inheritDoc}
+ *
+ * Returns the number of parallel jobs to be used for a build.
+ * Note that "optimal" value is represented by negative number.
+ * See the table at {@link IMakeCommonBuildInfo#getParallelizationNum()}.
+ */
+ @Override
+ public int getParallelizationNum() {
+ if (!isParallelBuildOn())
+ return 1;
+
+ if(parallelJobsNumber == null){
+ if(superClass != null){
+ return ((Builder)superClass).getParallelizationNum();
+ }
+ return 1;
+ }
+ return parallelJobsNumber.intValue();
+ }
+
public int getParallelizationNumAttribute(){
- if(parallelNum == null){
+ if(parallelJobsNumber == null){
if(superClass != null){
return ((Builder)superClass).getParallelizationNumAttribute();
}
return 1;
}
- return parallelNum.intValue();
+ return parallelJobsNumber.intValue();
}
- public void setParallelizationNum(int num) throws CoreException {
-// if(num == 0 || supportsParallelBuild()){
- Integer newParallelNum = new Integer(num);
+ /**
+ * {@inheritDoc}
+ *
+ * @param jobs - maximum number of jobs or threads. If the number is 0
+ * or negative, negative "optimal" number will be set, see
+ * {@link #getOptimalParallelJobNum()}.
+ */
+ @Override
+ public void setParallelizationNum(int jobs) throws CoreException {
+ if (isParallelBuildOn() && (parallelJobsNumber == null || parallelJobsNumber != jobs)) {
String curCmd = getParallelizationCmd(getParallelizationNum());
String args = getArgumentsAttribute();
String updatedArgs = removeCmd(args, curCmd);
- if(!updatedArgs.equals(args)){
+ if (!updatedArgs.equals(args)) {
setArgumentsAttribute(updatedArgs);
}
- parallelNum = newParallelNum;
+
+ if (jobs == Integer.MAX_VALUE && isInternalBuilder()) {
+ // Internal Builder does not support "unlimited" jobs, switching to "optimal"
+ jobs = -1;
+ }
+ if (jobs > 0) {
+ parallelJobsNumber = jobs;
+ } else {
+ // "optimal"
+ parallelJobsNumber = -getOptimalParallelJobNum();
+ }
setDirty(true);
-// }
+ }
}
+ @Override
public boolean supportsParallelBuild() {
if(isInternalBuilder())
return true;
return getParrallelBuildCmd().length() != 0;
}
+ @Override
public boolean supportsStopOnError(boolean on) {
if(isInternalBuilder())
return true;
@@ -2446,42 +2621,60 @@ public class Builder extends HoldsOptions implements IBuilder, IMatchKeyProvider
return ignoreErrCmd;
}
- public String getParrallelBuildCmd(){
- if(parallelBuildCmd == null){
- if(superClass != null){
- return ((Builder)superClass).getParrallelBuildCmd();
+ public String getParrallelBuildCmd() {
+ if (parallelBuildCmd == null) {
+ if (superClass != null) {
+ return ((Builder) superClass).getParrallelBuildCmd();
}
return EMPTY_STRING;
}
return parallelBuildCmd;
}
+ @Override
public boolean isParallelBuildOn() {
- if(parallelBuildOn == null){
- if(superClass != null){
+ if (isParallelBuildEnabled == null) {
+ if (superClass != null) {
return getSuperClass().isParallelBuildOn();
}
return false;
}
- return parallelBuildOn.booleanValue();
+ return isParallelBuildEnabled.booleanValue();
}
- public void setParallelBuildOn(boolean on) throws CoreException{
- if(isParallelBuildOn() == on)
+ /**
+ * {@inheritDoc}
+ *
+ * @param on - the flag to enable or disable parallel mode.
+ * <br>{@code true} to enable, in this case the maximum number of jobs
+ * will be set to negative "optimal" number, see {@link #getOptimalParallelJobNum()}.
+ * <br>{@code false} to disable, the number of jobs will be set to 1.
+ */
+ @Override
+ public void setParallelBuildOn(boolean on) throws CoreException {
+ if (isParallelBuildOn() == on)
return;
- if(on && !supportsParallelBuild())
+ if (on && !supportsParallelBuild())
return;
-
+
String curCmd = getParallelizationCmd(getParallelizationNum());
String args = getArgumentsAttribute();
String updatedArgs = removeCmd(args, curCmd);
- if(!updatedArgs.equals(args)){
+ if (!updatedArgs.equals(args)) {
setArgumentsAttribute(updatedArgs);
}
- parallelBuildOn = Boolean.valueOf(on);
+
+ isParallelBuildEnabled = on;
+
+ if (isParallelBuildEnabled) {
+ // "optimal"
+ parallelJobsNumber = -getOptimalParallelJobNum();
+ } else {
+ parallelJobsNumber = 1;
+ }
setDirty(true);
}
-
+
public Set<String> contributeErrorParsers(Set<String> set){
if(getErrorParserIds() != null){
if(set == null)
@@ -2521,6 +2714,7 @@ public class Builder extends HoldsOptions implements IBuilder, IMatchKeyProvider
}
}
+ @Override
public boolean isSystemObject() {
if(isTest)
return true;
@@ -2533,6 +2727,7 @@ public class Builder extends HoldsOptions implements IBuilder, IMatchKeyProvider
return false;
}
+ @Override
public String getUniqueRealName() {
String name = getName();
if(name == null){
@@ -2604,6 +2799,7 @@ public class Builder extends HoldsOptions implements IBuilder, IMatchKeyProvider
return num;
}
+ @Override
public int compareTo(Builder other) {
if(other.isSystemObject() != isSystemObject())
return isSystemObject() ? 1 : -1;
@@ -2611,30 +2807,37 @@ public class Builder extends HoldsOptions implements IBuilder, IMatchKeyProvider
return getSuperClassNum() - other.getSuperClassNum();
}
+ @Override
public IRealBuildObjectAssociation getExtensionObject() {
return (Builder)ManagedBuildManager.getExtensionBuilder(this);
}
+ @Override
public IRealBuildObjectAssociation[] getIdenticBuildObjects() {
return (IRealBuildObjectAssociation[])ManagedBuildManager.findIdenticalBuilders(this);
}
+ @Override
public IRealBuildObjectAssociation getRealBuildObject() {
return (Builder)ManagedBuildManager.getRealBuilder(this);
}
+ @Override
public IRealBuildObjectAssociation getSuperClassObject() {
return (Builder)getSuperClass();
}
+ @Override
public final int getType() {
return OBJECT_BUILDER;
}
+ @Override
public boolean isRealBuildObject() {
return ManagedBuildManager.getRealBuilder(this) == this;
}
+ @Override
public boolean isExtensionBuildObject() {
return isExtensionElement();
}
@@ -2643,6 +2846,7 @@ public class Builder extends HoldsOptions implements IBuilder, IMatchKeyProvider
return getUniqueRealName();
}
+ @Override
public ICommandLauncher getCommandLauncher() {
if(fCommandLauncher != null)
return fCommandLauncher;
@@ -2664,6 +2868,7 @@ public class Builder extends HoldsOptions implements IBuilder, IMatchKeyProvider
return fCommandLauncher;
}
+ @Override
public AbstractBuildRunner getBuildRunner() throws CoreException {
// Already defined
if (fBuildRunner != null)
diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Configuration.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Configuration.java
index ef84a29dc1..271b1c94ae 100644
--- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Configuration.java
+++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Configuration.java
@@ -81,6 +81,7 @@ import org.eclipse.cdt.managedbuilder.internal.macros.OptionContextData;
import org.eclipse.cdt.managedbuilder.macros.BuildMacroException;
import org.eclipse.cdt.managedbuilder.macros.IBuildMacroProvider;
import org.eclipse.cdt.managedbuilder.macros.IConfigurationBuildMacroSupplier;
+import org.eclipse.cdt.newmake.core.IMakeCommonBuildInfo;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IResourceDelta;
@@ -752,7 +753,7 @@ public class Configuration extends BuildObject implements IConfiguration, IBuild
* E L E M E N T A T T R I B U T E R E A D E R S A N D W R I T E R S
*/
- /* (non-Javadoc)
+ /**
* Initialize the configuration information from an element in the
* manifest file or provided by a dynamicElementProvider
*
@@ -803,7 +804,7 @@ public class Configuration extends BuildObject implements IConfiguration, IBuild
isTest = Boolean.valueOf(tmp).booleanValue();
}
- /* (non-Javadoc)
+ /**
* Initialize the configuration information from the XML element
* specified in the argument
*
@@ -874,8 +875,8 @@ public class Configuration extends BuildObject implements IConfiguration, IBuild
if (element.getAttribute(CLEAN_COMMAND) != null) {
cleanCommand = SafeStringInterner.safeIntern(element.getAttribute(CLEAN_COMMAND));
}
-
- // Get the pre-build and post-build commands
+
+ // Get the pre-build and post-build commands
if (element.getAttribute(PREBUILD_STEP) != null) {
prebuildStep = SafeStringInterner.safeIntern(element.getAttribute(PREBUILD_STEP));
}
@@ -891,7 +892,7 @@ public class Configuration extends BuildObject implements IConfiguration, IBuild
if (element.getAttribute(POSTANNOUNCEBUILD_STEP) != null) {
postannouncebuildStep = SafeStringInterner.safeIntern(element.getAttribute(POSTANNOUNCEBUILD_STEP));
- }
+ }
}
/**
@@ -970,6 +971,7 @@ public class Configuration extends BuildObject implements IConfiguration, IBuild
/* (non-Javadoc)
* @see org.eclipse.cdt.core.build.managed.IConfiguration#getParent()
*/
+ @Override
public IConfiguration getParent() {
return parent;
}
@@ -977,6 +979,7 @@ public class Configuration extends BuildObject implements IConfiguration, IBuild
/* (non-Javadoc)
* @see org.eclipse.cdt.core.build.managed.IConfiguration#getOwner()
*/
+ @Override
public IResource getOwner() {
if (managedProject != null)
return managedProject.getOwner();
@@ -988,6 +991,7 @@ public class Configuration extends BuildObject implements IConfiguration, IBuild
/* (non-Javadoc)
* @see org.eclipse.cdt.core.build.managed.IConfiguration#getProjectType()
*/
+ @Override
public IProjectType getProjectType() {
return projectType;
}
@@ -995,6 +999,7 @@ public class Configuration extends BuildObject implements IConfiguration, IBuild
/* (non-Javadoc)
* @see org.eclipse.cdt.core.build.managed.IConfiguration#getManagedProject()
*/
+ @Override
public IManagedProject getManagedProject() {
return managedProject;
}
@@ -1002,6 +1007,7 @@ public class Configuration extends BuildObject implements IConfiguration, IBuild
/* (non-Javadoc)
* @see org.eclipse.cdt.core.build.managed.IConfiguration#getToolChain(IToolChain, String, String, boolean)
*/
+ @Override
public IToolChain createToolChain(IToolChain superClass, String Id, String name, boolean isExtensionElement) {
if(rootFolderInfo == null){
createRootFolderInfo();
@@ -1030,6 +1036,7 @@ public class Configuration extends BuildObject implements IConfiguration, IBuild
/* (non-Javadoc)
* @see org.eclipse.cdt.core.build.managed.IConfiguration#getToolChain()
*/
+ @Override
public IToolChain getToolChain() {
return rootFolderInfo.getToolChain();
}
@@ -1037,6 +1044,7 @@ public class Configuration extends BuildObject implements IConfiguration, IBuild
/* (non-Javadoc)
* @see org.eclipse.cdt.core.build.managed.IConfiguration#getResourceConfigurations()
*/
+ @Override
public IResourceConfiguration[] getResourceConfigurations() {
return (IResourceConfiguration[])rcInfos.getResourceInfos(ICSettingBase.SETTING_FILE, IResourceConfiguration.class);
}
@@ -1044,6 +1052,7 @@ public class Configuration extends BuildObject implements IConfiguration, IBuild
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.core.IConfiguration#getResourceConfiguration(java.lang.String)
*/
+ @Override
public IResourceConfiguration getResourceConfiguration(String resPath) {
return rcInfos.getFileInfo(new Path(resPath).removeFirstSegments(1));
}
@@ -1051,6 +1060,7 @@ public class Configuration extends BuildObject implements IConfiguration, IBuild
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.core.IConfiguration#getFilteredTools()
*/
+ @Override
public ITool[] getFilteredTools() {
return rootFolderInfo.getFilteredTools();
}
@@ -1058,6 +1068,7 @@ public class Configuration extends BuildObject implements IConfiguration, IBuild
/* (non-Javadoc)
* @see org.eclipse.cdt.core.build.managed.IConfiguration#getTools()
*/
+ @Override
public ITool[] getTools() {
return rootFolderInfo.getTools();
}
@@ -1065,6 +1076,7 @@ public class Configuration extends BuildObject implements IConfiguration, IBuild
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.core.IConfiguration#getTool(java.lang.String)
*/
+ @Override
public ITool getTool(String id) {
return rootFolderInfo.getTool(id);
}
@@ -1072,6 +1084,7 @@ public class Configuration extends BuildObject implements IConfiguration, IBuild
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.core.IConfiguration#getToolsBySuperClassId(java.lang.String)
*/
+ @Override
public ITool[] getToolsBySuperClassId(String id) {
return rootFolderInfo.getToolsBySuperClassId(id);
}
@@ -1079,6 +1092,7 @@ public class Configuration extends BuildObject implements IConfiguration, IBuild
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.core.IConfiguration#getTargetTool()
*/
+ @Override
public ITool getTargetTool() {
String[] targetToolIds = rootFolderInfo.getToolChain().getTargetToolList();
if (targetToolIds == null || targetToolIds.length == 0) return null;
@@ -1106,6 +1120,7 @@ public class Configuration extends BuildObject implements IConfiguration, IBuild
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.core.IConfiguration#setToolCommand(org.eclipse.cdt.managedbuilder.core.ITool, java.lang.String)
*/
+ @Override
public String getToolCommand(ITool tool) {
// TODO: Do we need to verify that the tool is part of the configuration?
return tool.getToolCommand();
@@ -1114,6 +1129,7 @@ public class Configuration extends BuildObject implements IConfiguration, IBuild
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.core.IConfiguration#setToolCommand(org.eclipse.cdt.managedbuilder.core.ITool, java.lang.String)
*/
+ @Override
public void setToolCommand(ITool tool, String command) {
// TODO: Do we need to verify that the tool is part of the configuration?
tool.setToolCommand(command);
@@ -1122,6 +1138,7 @@ public class Configuration extends BuildObject implements IConfiguration, IBuild
/* (non-Javadoc)
* @see org.eclipse.cdt.core.build.managed.IConfiguration#setOption(org.eclipse.cdt.core.build.managed.IOption, boolean)
*/
+ @Override
public IOption setOption(IHoldsOptions holder, IOption option, boolean value) throws BuildException {
return getRootFolderInfo().setOption(holder, option, value);
}
@@ -1129,6 +1146,7 @@ public class Configuration extends BuildObject implements IConfiguration, IBuild
/* (non-Javadoc)
* @see org.eclipse.cdt.core.build.managed.IConfiguration#setOption(org.eclipse.cdt.core.build.managed.IOption, java.lang.String)
*/
+ @Override
public IOption setOption(IHoldsOptions holder, IOption option, String value) throws BuildException {
return getRootFolderInfo().setOption(holder, option, value);
}
@@ -1136,6 +1154,7 @@ public class Configuration extends BuildObject implements IConfiguration, IBuild
/* (non-Javadoc)
* @see org.eclipse.cdt.core.build.managed.IConfiguration#setOption(org.eclipse.cdt.core.build.managed.IOption, java.lang.String[])
*/
+ @Override
public IOption setOption(IHoldsOptions holder, IOption option, String[] value) throws BuildException {
return getRootFolderInfo().setOption(holder, option, value);
}
@@ -1153,6 +1172,7 @@ public class Configuration extends BuildObject implements IConfiguration, IBuild
// rebuildNeeded = true;
}
+ @Override
public void removeResourceConfiguration(IResourceInfo resConfig) {
ManagedBuildManager.performValueHandlerEvent(resConfig,
IManagedOptionValueHandler.EVENT_CLOSE);
@@ -1178,6 +1198,7 @@ public class Configuration extends BuildObject implements IConfiguration, IBuild
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.core.IConfiguration#getArtifactExtension()
*/
+ @Override
public String getArtifactExtension() {
String ext = getArtifactExtensionAttribute(true);
return ext != null ? ext : EMPTY_STRING;
@@ -1197,6 +1218,7 @@ public class Configuration extends BuildObject implements IConfiguration, IBuild
/* (non-Javadoc)
* @see org.eclipse.cdt.core.build.managed.IConfiguration#getArtifactName()
*/
+ @Override
public String getArtifactName() {
if (artifactName == null) {
// If I have a parent, ask it
@@ -1214,6 +1236,7 @@ public class Configuration extends BuildObject implements IConfiguration, IBuild
/* (non-Javadoc)
* @see org.eclipse.cdt.core.build.managed.IConfiguration#getBuildArguments()
*/
+ @Override
public String getBuildArguments() {
IToolChain tc = getToolChain();
IBuilder builder = tc.getBuilder();
@@ -1226,6 +1249,7 @@ public class Configuration extends BuildObject implements IConfiguration, IBuild
/* (non-Javadoc)
* @see org.eclipse.cdt.core.build.managed.IConfiguration#getBuildCommand()
*/
+ @Override
public String getBuildCommand() {
IToolChain tc = getToolChain();
IBuilder builder = tc.getBuilder();
@@ -1240,6 +1264,7 @@ public class Configuration extends BuildObject implements IConfiguration, IBuild
*
* @see org.eclipse.cdt.core.build.managed.IConfiguration#getPrebuildStep()
*/
+ @Override
public String getPrebuildStep() {
if (prebuildStep == null) {
// If I have a parent, ask it
@@ -1259,6 +1284,7 @@ public class Configuration extends BuildObject implements IConfiguration, IBuild
*
* @see org.eclipse.cdt.core.build.managed.IConfiguration#getPostbuildStep()
*/
+ @Override
public String getPostbuildStep() {
if (postbuildStep == null) {
// If I have a parent, ask it
@@ -1278,6 +1304,7 @@ public class Configuration extends BuildObject implements IConfiguration, IBuild
*
* @see org.eclipse.cdt.core.build.managed.IConfiguration#getPreannouncebuildStep()
*/
+ @Override
public String getPreannouncebuildStep() {
if (preannouncebuildStep == null) {
// If I have a parent, ask it
@@ -1297,6 +1324,7 @@ public class Configuration extends BuildObject implements IConfiguration, IBuild
*
* @see org.eclipse.cdt.core.build.managed.IConfiguration#getPostannouncebuildStep()
*/
+ @Override
public String getPostannouncebuildStep() {
if (postannouncebuildStep == null) {
// If I have a parent, ask it
@@ -1316,6 +1344,7 @@ public class Configuration extends BuildObject implements IConfiguration, IBuild
*
* @see org.eclipse.cdt.core.build.managed.IConfiguration#getCleanCommand()
*/
+ @Override
public String getCleanCommand() {
// Return the command used to remove files
if (cleanCommand == null) {
@@ -1338,6 +1367,7 @@ public class Configuration extends BuildObject implements IConfiguration, IBuild
/* (non-Javadoc)
* @see org.eclipse.cdt.core.build.managed.IConfiguration#getDescription()
*/
+ @Override
public String getDescription() {
if (description == null) {
// If I have a parent, ask it
@@ -1357,6 +1387,7 @@ public class Configuration extends BuildObject implements IConfiguration, IBuild
*
* @see org.eclipse.cdt.managedbuilder.core.IConfiguration#getErrorParserIds()
*/
+ @Override
public String getErrorParserIds() {
if (errorParserIds != null) {
return errorParserIds;
@@ -1392,6 +1423,7 @@ public class Configuration extends BuildObject implements IConfiguration, IBuild
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.core.IConfiguration#getErrorParserList()
*/
+ @Override
public String[] getErrorParserList() {
Set<String> set = contributeErrorParsers(null, true);
if(set != null){
@@ -1428,6 +1460,7 @@ public class Configuration extends BuildObject implements IConfiguration, IBuild
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.core.IConfiguration#setArtifactExtension(java.lang.String)
*/
+ @Override
public void setArtifactExtension(String extension) {
if (extension == null && artifactExtension == null) return;
if (artifactExtension == null || extension == null || !artifactExtension.equals(extension)) {
@@ -1449,6 +1482,7 @@ public class Configuration extends BuildObject implements IConfiguration, IBuild
/* (non-Javadoc)
* @see org.eclipse.cdt.core.build.managed.IConfiguration#setArtifactName(java.lang.String)
*/
+ @Override
public void setArtifactName(String name) {
if (name == null && artifactName == null) return;
if (artifactName == null || name == null || !artifactName.equals(name)) {
@@ -1490,6 +1524,7 @@ public class Configuration extends BuildObject implements IConfiguration, IBuild
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.core.IConfiguration#setErrorParserIds()
*/
+ @Override
public void setErrorParserIds(String ids) {
String currentIds = getErrorParserIds();
if (ids == null && currentIds == null) return;
@@ -1502,6 +1537,7 @@ public class Configuration extends BuildObject implements IConfiguration, IBuild
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.core.IConfiguration#setCleanCommand()
*/
+ @Override
public void setCleanCommand(String command) {
if (command == null && cleanCommand == null) return;
if (cleanCommand == null || command == null || !cleanCommand.equals(command)) {
@@ -1513,6 +1549,7 @@ public class Configuration extends BuildObject implements IConfiguration, IBuild
/* (non-Javadoc)
* @see org.eclipse.cdt.core.build.managed.IConfiguration#setDescription(java.lang.String)
*/
+ @Override
public void setDescription(String description) {
if (description == null && this.description == null) return;
if (this.description == null || description == null || !description.equals(this.description)) {
@@ -1524,6 +1561,7 @@ public class Configuration extends BuildObject implements IConfiguration, IBuild
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.core.IConfiguration#setBuildArguments()
*/
+ @Override
public void setBuildArguments(String makeArgs) {
IToolChain tc = getToolChain();
IBuilder builder = tc.getBuilder();
@@ -1546,6 +1584,7 @@ public class Configuration extends BuildObject implements IConfiguration, IBuild
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.core.IConfiguration#setBuildCommand()
*/
+ @Override
public void setBuildCommand(String command) {
IToolChain tc = getToolChain();
IBuilder builder = tc.getBuilder();
@@ -1568,7 +1607,8 @@ public class Configuration extends BuildObject implements IConfiguration, IBuild
/* (non-Javadoc)
* @see org.eclipse.cdt.core.build.managed.IConfiguration#setPrebuildStep(java.lang.String)
*/
- public void setPrebuildStep(String step) {
+ @Override
+ public void setPrebuildStep(String step) {
if (step == null && prebuildStep == null) return;
if (prebuildStep == null || step == null || !prebuildStep.equals(step)) {
prebuildStep = step;
@@ -1581,7 +1621,8 @@ public class Configuration extends BuildObject implements IConfiguration, IBuild
/* (non-Javadoc)
* @see org.eclipse.cdt.core.build.managed.IConfiguration#setPostbuildStep(java.lang.String)
*/
- public void setPostbuildStep(String step) {
+ @Override
+ public void setPostbuildStep(String step) {
if (step == null && postbuildStep == null) return;
if (postbuildStep == null || step == null || !postbuildStep.equals(step)) {
postbuildStep = step;
@@ -1593,7 +1634,8 @@ public class Configuration extends BuildObject implements IConfiguration, IBuild
/* (non-Javadoc)
* @see org.eclipse.cdt.core.build.managed.IConfiguration#setPreannouncebuildStep(java.lang.String)
*/
- public void setPreannouncebuildStep(String announceStep) {
+ @Override
+ public void setPreannouncebuildStep(String announceStep) {
if (announceStep == null && preannouncebuildStep == null) return;
if (preannouncebuildStep == null || announceStep == null || !preannouncebuildStep.equals(announceStep)) {
preannouncebuildStep = announceStep;
@@ -1605,7 +1647,8 @@ public class Configuration extends BuildObject implements IConfiguration, IBuild
/* (non-Javadoc)
* @see org.eclipse.cdt.core.build.managed.IConfiguration#setPostannouncebuildStep(java.lang.String)
*/
- public void setPostannouncebuildStep(String announceStep) {
+ @Override
+ public void setPostannouncebuildStep(String announceStep) {
if (announceStep == null && postannouncebuildStep == null) return;
if (postannouncebuildStep == null || announceStep == null || !postannouncebuildStep.equals(announceStep)) {
postannouncebuildStep = announceStep;
@@ -1617,6 +1660,7 @@ public class Configuration extends BuildObject implements IConfiguration, IBuild
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.core.IConfiguration#isSupported()
*/
+ @Override
public boolean isSupported(){
IFolderInfo foInfo = getRootFolderInfo();
if(foInfo != null)
@@ -1627,6 +1671,7 @@ public class Configuration extends BuildObject implements IConfiguration, IBuild
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.core.IConfiguration#isHeaderFile(java.lang.String)
*/
+ @Override
public boolean isHeaderFile(String ext) {
return getRootFolderInfo().isHeaderFile(ext);
}
@@ -1638,6 +1683,7 @@ public class Configuration extends BuildObject implements IConfiguration, IBuild
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.core.IConfiguration#isExtensionElement()
*/
+ @Override
public boolean isExtensionElement() {
return isExtensionConfig;
}
@@ -1645,6 +1691,7 @@ public class Configuration extends BuildObject implements IConfiguration, IBuild
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.core.IConfiguration#isDirty()
*/
+ @Override
public boolean isDirty() {
// This shouldn't be called for an extension configuration
if (isExtensionConfig) return false;
@@ -1665,10 +1712,12 @@ public class Configuration extends BuildObject implements IConfiguration, IBuild
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.core.IConfiguration#needsRebuild()
*/
+ @Override
public boolean needsRebuild() {
return needsRebuild(true);
}
+ @Override
public boolean needsFullRebuild() {
return needsRebuild(false);
}
@@ -1692,6 +1741,7 @@ public class Configuration extends BuildObject implements IConfiguration, IBuild
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.core.IConfiguration#setDirty(boolean)
*/
+ @Override
public void setDirty(boolean isDirty) {
// Override the dirty flag
this.isDirty = isDirty;
@@ -1708,6 +1758,7 @@ public class Configuration extends BuildObject implements IConfiguration, IBuild
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.core.IConfiguration#setRebuildState(boolean)
*/
+ @Override
public void setRebuildState(boolean rebuild) {
if(isExtensionElement() && rebuild)
return;
@@ -1731,6 +1782,7 @@ public class Configuration extends BuildObject implements IConfiguration, IBuild
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.core.IConfiguration#hasOverriddenBuildCommand()
*/
+ @Override
public boolean hasOverriddenBuildCommand() {
IBuilder builder = getToolChain().getBuilder();
if (builder != null) {
@@ -1785,21 +1837,24 @@ public class Configuration extends BuildObject implements IConfiguration, IBuild
((FolderInfo)getRootFolderInfo()).resetOptionSettings();
}
- /*
+ /**
* Create a resource configuration object for the passed-in file
*/
+ @Override
public IResourceConfiguration createResourceConfiguration(IFile file)
{
return createFileInfo(file.getFullPath().removeFirstSegments(1));
}
+ @Override
public IFileInfo createFileInfo(IPath path){
String resourceName = path.lastSegment();
String id = ManagedBuildManager.calculateChildId(getId(), path.toString());
return createFileInfo(path, id, resourceName);
}
+ @Override
public IFileInfo createFileInfo(IPath path, String id, String name){
IResourceInfo info = getResourceInfo(path, false);
IFileInfo fileInfo = null;
@@ -1812,6 +1867,7 @@ public class Configuration extends BuildObject implements IConfiguration, IBuild
return fileInfo;
}
+ @Override
public IFileInfo createFileInfo(IPath path, IFolderInfo base, ITool baseTool, String id, String name){
if(base.getPath().equals(path))
return null;
@@ -1823,6 +1879,7 @@ public class Configuration extends BuildObject implements IConfiguration, IBuild
return fileInfo;
}
+ @Override
public IFileInfo createFileInfo(IPath path, IFileInfo base, String id, String name){
if(base.getPath().equals(path))
return null;
@@ -1837,6 +1894,7 @@ public class Configuration extends BuildObject implements IConfiguration, IBuild
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.core.IConfiguration#getEnvironmentVariableSupplier()
*/
+ @Override
public IConfigurationEnvironmentVariableSupplier getEnvironmentVariableSupplier(){
IToolChain toolChain = getToolChain();
if(toolChain != null)
@@ -1865,6 +1923,7 @@ public class Configuration extends BuildObject implements IConfiguration, IBuild
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.core.IConfiguration#getBuildMacroSupplier()
*/
+ @Override
public IConfigurationBuildMacroSupplier getBuildMacroSupplier(){
IToolChain toolChain = getToolChain();
if(toolChain != null)
@@ -1876,6 +1935,7 @@ public class Configuration extends BuildObject implements IConfiguration, IBuild
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.core.IConfiguration#isTemporary()
*/
+ @Override
public boolean isTemporary(){
return isTemporary;
}
@@ -1902,6 +1962,7 @@ public class Configuration extends BuildObject implements IConfiguration, IBuild
}
}
+ @Override
public ITool calculateTargetTool(){
ITool tool = getTargetTool();
@@ -1924,15 +1985,17 @@ public class Configuration extends BuildObject implements IConfiguration, IBuild
return tool;
}
+ @Override
public ITool getToolFromOutputExtension(String extension) {
return getRootFolderInfo().getToolFromOutputExtension(extension);
}
+ @Override
public ITool getToolFromInputExtension(String sourceExtension) {
return getRootFolderInfo().getToolFromInputExtension(sourceExtension);
}
- /*
+ /**
* The resource delta passed to the builder is not always up-to-date
* for the given configuration because between two builds of the same configuration
* any number of other configuration builds may occur
@@ -2004,7 +2067,7 @@ public class Configuration extends BuildObject implements IConfiguration, IBuild
prefs.getBoolean(pref, false) : defaultValue;
}
*/
- /*
+ /**
* this method is used for enabling/disabling the internal builder
* for the given configuration
*
@@ -2121,7 +2184,7 @@ public class Configuration extends BuildObject implements IConfiguration, IBuild
return null;
}
- /*
+ /**
* returns whether the internal builder is enabled
* @return boolean
*/
@@ -2129,7 +2192,7 @@ public class Configuration extends BuildObject implements IConfiguration, IBuild
return getBuilder().isInternalBuilder();
}
- /*
+ /**
*
* sets the Internal Builder mode
*
@@ -2144,7 +2207,7 @@ public class Configuration extends BuildObject implements IConfiguration, IBuild
}
}
- /*
+ /**
* returns the Internal Builder mode
* if true, internal builder will ignore build errors while building,
* otherwise it will stop at the first build error
@@ -2156,73 +2219,80 @@ public class Configuration extends BuildObject implements IConfiguration, IBuild
}
/**
- *
* sets the Internal Builder Parallel mode
- *
* @param parallel if true, internal builder will use parallel mode
+ *
+ * @deprecated since CDT 9.0. Use {@link #setParallelDef(boolean)}
*/
+ @Deprecated
public void setInternalBuilderParallel(boolean parallel){
- if(getInternalBuilderParallel() == parallel)
- return;
-
- try {
- getEditableBuilder().setParallelBuildOn(parallel);
- } catch (CoreException e) {
- }
+ setParallelDef(parallel);
}
/**
* returns the Internal Builder parallel mode
* if true, internal builder will work in parallel mode
* otherwise it will use only one thread
- *
* @return boolean
+ *
+ * @deprecated since CDT 9.0. Use {@link #getParallelDef()}
*/
+ @Deprecated
public boolean getInternalBuilderParallel(){
- return getBuilder().isParallelBuildOn();
+ return getParallelDef();
}
/**
- * @param parallel if true, internal builder will use parallel mode
+ * Set parallel execution mode for the configuration's builder.
+ * @see Builder#setParallelBuildOn(boolean)
+ *
+ * @param parallel - the flag to enable or disable parallel mode.
*/
public void setParallelDef(boolean parallel){
if(getParallelDef() == parallel)
return;
- int num = getParallelNumber();
- if(num != 0){
- setParallelNumber(-num);
- } else {
- if(parallel){
- setParallelNumber(-1);
- } else {
- setParallelNumber(1);
- }
+ try {
+ getEditableBuilder().setParallelBuildOn(parallel);
+ } catch (CoreException e) {
+ ManagedBuilderCorePlugin.log(e);
}
}
/**
- * @return boolean
+ * Check if the configuration's builder is operating in parallel mode.
+ * @return {@code true} if parallel mode is enabled, {@code false} otherwise.
*/
public boolean getParallelDef(){
- int num = getBuilder().getParallelizationNum();
- return num <= 0;
+ return getBuilder().isParallelBuildOn();
}
/**
- * sets number of Parallel threads
+ * Sets maximum number of parallel threads/jobs to be used by builder.
+ * Note that the number will be set only if the builder is in "parallel"
+ * mode.
+ *
+ * @param jobs - maximum number of jobs or threads. If the number is 0
+ * or negative, negative "optimal" number will be set, see
+ * {@link Builder#getOptimalParallelJobNum()}.
*/
- public void setParallelNumber(int n){
+ public void setParallelNumber(int jobs){
try {
- getEditableBuilder().setParallelizationNum(n);
+ getEditableBuilder().setParallelizationNum(jobs);
} catch (CoreException e) {
+ ManagedBuilderCorePlugin.log(e);
}
}
/**
- * returns number of Parallel threads
+ * Returns maximum number of parallel threads/jobs used by the configuration's builder.
+ * Note that this function can return negative value to indicate "optimal" number.
+ *
+ * @see #setParallelDef(boolean)
+ * @see Builder#getParallelizationNum()
*
- * @return int
+ * @return - maximum number of parallel threads or jobs used by the builder or negative number.
+ * For exact interpretation see table in {@link IMakeCommonBuildInfo#getParallelizationNum()}
*/
public int getParallelNumber(){
return getBuilder().getParallelizationNum();
@@ -2246,14 +2316,17 @@ public class Configuration extends BuildObject implements IConfiguration, IBuild
// return prefs;
// }
+ @Override
public IResourceInfo[] getResourceInfos() {
return rcInfos.getResourceInfos();
}
+ @Override
public IResourceInfo getResourceInfo(IPath path, boolean exactPath) {
return rcInfos.getResourceInfo(path, exactPath);
}
+ @Override
public IResourceInfo getResourceInfoById(String id) {
IResourceInfo infos[] = rcInfos.getResourceInfos();
for(int i = 0; i < infos.length; i++){
@@ -2263,6 +2336,7 @@ public class Configuration extends BuildObject implements IConfiguration, IBuild
return null;
}
+ @Override
public IFolderInfo getRootFolderInfo() {
return rootFolderInfo;
}
@@ -2272,22 +2346,26 @@ public class Configuration extends BuildObject implements IConfiguration, IBuild
return new ResourceInfoContainer(cr, false);
}
+ @Override
public CConfigurationData getConfigurationData(){
return fCfgData;
}
+ @Override
public void removeResourceInfo(IPath path) {
IResourceInfo info = getResourceInfo(path, true);
if(info != null)
removeResourceConfiguration(info);
}
+ @Override
public IFolderInfo createFolderInfo(IPath path) {
String resourceName = path.lastSegment();
String id = ManagedBuildManager.calculateChildId(getId(), path.toString());
return createFolderInfo(path, id, resourceName);
}
+ @Override
public IFolderInfo createFolderInfo(IPath path, String id, String name) {
IResourceInfo info = getResourceInfo(path, false);
IFolderInfo folderInfo = null;
@@ -2300,6 +2378,7 @@ public class Configuration extends BuildObject implements IConfiguration, IBuild
return folderInfo;
}
+ @Override
public IFolderInfo createFolderInfo(IPath path, IFolderInfo base, String id, String name) {
if(base.getPath().equals(path))
return null;
@@ -2312,6 +2391,7 @@ public class Configuration extends BuildObject implements IConfiguration, IBuild
return folderInfo;
}
+ @Override
public ICSourceEntry[] getSourceEntries() {
if(sourceEntries == null || sourceEntries.length == 0){
if(parent != null && sourceEntries == null)
@@ -2322,6 +2402,7 @@ public class Configuration extends BuildObject implements IConfiguration, IBuild
return sourceEntries.clone();
}
+ @Override
public void setSourceEntries(ICSourceEntry[] entries) {
setSourceEntries(entries, true);
}
@@ -2355,6 +2436,7 @@ public class Configuration extends BuildObject implements IConfiguration, IBuild
}
}
+ @Override
public void setErrorParserList(String[] ids) {
if(ids == null){
//reset
@@ -2394,10 +2476,12 @@ public class Configuration extends BuildObject implements IConfiguration, IBuild
}
}
+ @Override
public CBuildData getBuildData() {
return getEditableBuilder().getBuildData();
}
+ @Override
public IBuilder getEditableBuilder(){
IToolChain tc = getToolChain();
IBuilder builder = tc.getBuilder();
@@ -2409,10 +2493,12 @@ public class Configuration extends BuildObject implements IConfiguration, IBuild
return builder;
}
+ @Override
public IBuilder getBuilder(){
return getToolChain().getBuilder();
}
+ @Override
public String getOutputPrefix(String outputExtension) {
// Treat null extensions as empty string
String ext = outputExtension == null ? new String() : outputExtension;
@@ -2437,6 +2523,7 @@ public class Configuration extends BuildObject implements IConfiguration, IBuild
fCfgDes = cfgDes;
}
+ @Override
public IBuildObjectProperties getBuildProperties() {
if(buildProperties == null){
BuildObjectProperties parentProps = findBuildProperties();
@@ -2467,6 +2554,7 @@ public class Configuration extends BuildObject implements IConfiguration, IBuild
return supportsValue(type.getId(), value.getId());
}
+ @Override
public void propertiesChanged() {
if(isExtensionConfig)
return;
@@ -2490,6 +2578,7 @@ public class Configuration extends BuildObject implements IConfiguration, IBuild
return booleanExpressionCalculator;
}
+ @Override
public boolean isSystemObject() {
if(isTest)
return true;
@@ -2500,10 +2589,12 @@ public class Configuration extends BuildObject implements IConfiguration, IBuild
return false;
}
+ @Override
public String getOutputExtension(String resourceExtension) {
return getRootFolderInfo().getOutputExtension(resourceExtension);
}
+ @Override
public String getOutputFlag(String outputExt) {
// Treat null extension as an empty string
String ext = outputExt == null ? new String() : outputExt;
@@ -2521,6 +2612,7 @@ public class Configuration extends BuildObject implements IConfiguration, IBuild
return flags;
}
+ @Override
public IManagedCommandLineInfo generateToolCommandLineInfo( String sourceExtension, String[] flags,
String outputFlag, String outputPrefix, String outputName, String[] inputResources, IPath inputLocation, IPath outputLocation ){
ITool[] tools = getFilteredTools();
@@ -2573,6 +2665,7 @@ public class Configuration extends BuildObject implements IConfiguration, IBuild
return null;
}
+ @Override
public String[] getUserObjects(String extension) {
Vector<String> objs = new Vector<String>();
ITool tool = calculateTargetTool();
@@ -2614,6 +2707,7 @@ public class Configuration extends BuildObject implements IConfiguration, IBuild
return objs.toArray(new String[objs.size()]);
}
+ @Override
public String[] getLibs(String extension) {
Vector<String> libs = new Vector<String>();
ITool tool = calculateTargetTool();
@@ -2668,6 +2762,7 @@ public class Configuration extends BuildObject implements IConfiguration, IBuild
return libs.toArray(new String[libs.size()]);
}
+ @Override
public boolean buildsFileType(String srcExt) {
return getRootFolderInfo().buildsFileType(srcExt);
}
@@ -2735,6 +2830,7 @@ public class Configuration extends BuildObject implements IConfiguration, IBuild
}
}
+ @Override
public boolean supportsBuild(boolean managed) {
return supportsBuild(managed, true);
}
@@ -2755,6 +2851,7 @@ public class Configuration extends BuildObject implements IConfiguration, IBuild
return true;
}
+ @Override
public boolean supportsType(String typeId) {
SupportedProperties props = findSupportedProperties();
boolean supports = false;
@@ -2768,6 +2865,7 @@ public class Configuration extends BuildObject implements IConfiguration, IBuild
return supports;
}
+ @Override
public boolean supportsValue(String typeId, String valueId) {
SupportedProperties props = findSupportedProperties();
boolean supports = false;
@@ -2794,6 +2892,7 @@ public class Configuration extends BuildObject implements IConfiguration, IBuild
supportedProperties = new SupportedProperties(el);
}
+ @Override
public String[] getRequiredTypeIds() {
SupportedProperties props = findSupportedProperties();
List<String> list = new ArrayList<String>();
@@ -2806,6 +2905,7 @@ public class Configuration extends BuildObject implements IConfiguration, IBuild
return list.toArray(new String[list.size()]);
}
+ @Override
public String[] getSupportedTypeIds() {
SupportedProperties props = findSupportedProperties();
List<String> list = new ArrayList<String>();
@@ -2818,6 +2918,7 @@ public class Configuration extends BuildObject implements IConfiguration, IBuild
return list.toArray(new String[list.size()]);
}
+ @Override
public String[] getSupportedValueIds(String typeId) {
SupportedProperties props = findSupportedProperties();
List<String> list = new ArrayList<String>();
@@ -2830,6 +2931,7 @@ public class Configuration extends BuildObject implements IConfiguration, IBuild
return list.toArray(new String[list.size()]);
}
+ @Override
public boolean requiresType(String typeId) {
SupportedProperties props = findSupportedProperties();
boolean requires = false;
@@ -2843,10 +2945,12 @@ public class Configuration extends BuildObject implements IConfiguration, IBuild
return requires;
}
+ @Override
public boolean isManagedBuildOn() {
return getBuilder().isManagedBuildOn();
}
+ @Override
public void setManagedBuildOn(boolean on) throws BuildException {
try {
getEditableBuilder().setManagedBuildOn(on);
@@ -2855,6 +2959,7 @@ public class Configuration extends BuildObject implements IConfiguration, IBuild
}
}
+ @Override
public void changeBuilder(IBuilder newBuilder, String id, String name){
changeBuilder(newBuilder, id, name, false);
}
@@ -2884,6 +2989,7 @@ public class Configuration extends BuildObject implements IConfiguration, IBuild
}
}
+ @Override
public boolean isBuilderCompatible(IBuilder builder){
return builder.supportsBuild(isManagedBuildOn());
}
@@ -2964,6 +3070,7 @@ public class Configuration extends BuildObject implements IConfiguration, IBuild
return isPreferenceConfig;
}
+ @Override
public IBuildPropertyValue getBuildArtefactType() {
IBuildObjectProperties props = findBuildProperties();
if(props != null){
@@ -2974,6 +3081,7 @@ public class Configuration extends BuildObject implements IConfiguration, IBuild
return null;
}
+ @Override
public void setBuildArtefactType(String id) throws BuildException {
IBuildObjectProperties props = getBuildProperties();
try {
@@ -3026,34 +3134,42 @@ public class Configuration extends BuildObject implements IConfiguration, IBuild
}
}
+ @Override
public IRealBuildObjectAssociation getExtensionObject() {
return isExtensionConfig ? this : (Configuration)getParent();
}
+ @Override
public IRealBuildObjectAssociation[] getIdenticBuildObjects() {
return new Configuration[]{(Configuration)getExtensionObject()};
}
+ @Override
public IRealBuildObjectAssociation getRealBuildObject() {
return getExtensionObject();
}
+ @Override
public IRealBuildObjectAssociation getSuperClassObject() {
return (IRealBuildObjectAssociation)getParent();
}
+ @Override
public int getType() {
return OBJECT_CONFIGURATION;
}
+ @Override
public boolean isRealBuildObject() {
return getRealBuildObject() == this;
}
+ @Override
public String getUniqueRealName() {
return getName();
}
+ @Override
public boolean isExtensionBuildObject() {
return isExtensionElement();
}
diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/GeneratedMakefileBuilder.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/GeneratedMakefileBuilder.java
index 4acd71aeba..5446824dae 100644
--- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/GeneratedMakefileBuilder.java
+++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/GeneratedMakefileBuilder.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2002, 2010 IBM Corporation and others.
+ * Copyright (c) 2002, 2011 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -151,6 +151,7 @@ public class GeneratedMakefileBuilder extends ACBuilder {
return fullBuildNeeded;
}
+ @Override
public boolean visit(IResourceDelta delta) throws CoreException {
IResource resource = delta.getResource();
// If the project has changed, then a build is needed and we can stop
@@ -231,6 +232,7 @@ public class GeneratedMakefileBuilder extends ACBuilder {
}
}
+ @Override
public boolean visit(IResourceDelta delta) throws CoreException {
IResource rc = delta.getResource();
@@ -906,244 +908,242 @@ public class GeneratedMakefileBuilder extends ACBuilder {
}
IPath makeCommand = new Path(makeCmd);
- if (makeCommand != null) {
- String[] msgs = new String[2];
- msgs[0] = makeCommand.toString();
- msgs[1] = currentProject.getName();
- monitor.subTask(ManagedMakeMessages.getFormattedString(MAKE, msgs));
+ String[] msgs = new String[2];
+ msgs[0] = makeCommand.toString();
+ msgs[1] = currentProject.getName();
+ monitor.subTask(ManagedMakeMessages.getFormattedString(MAKE, msgs));
- // Get a build console for the project
- StringBuffer buf = new StringBuffer();
- IConsole console = CCorePlugin.getDefault().getConsole();
- console.start(currentProject);
- ConsoleOutputStream consoleOutStream = console.getOutputStream();
- String[] consoleHeader = new String[3];
- switch (buildType) {
- case FULL_BUILD:
- case INCREMENTAL_BUILD:
- consoleHeader[0] = ManagedMakeMessages.getResourceString(TYPE_INC);
- break;
- case CLEAN_BUILD:
- consoleHeader[0] = ManagedMakeMessages.getResourceString(TYPE_CLEAN);
- break;
- }
-
- consoleHeader[1] = info.getConfigurationName();
- consoleHeader[2] = currentProject.getName();
- buf.append(NEWLINE);
- buf.append(ManagedMakeMessages.getFormattedString(CONSOLE_HEADER, consoleHeader)).append(NEWLINE);
- buf.append(NEWLINE);
-
- IConfiguration cfg = info.getDefaultConfiguration();
- if(!cfg.isSupported()){
- String msg = ManagedMakeMessages.getFormattedString(WARNING_UNSUPPORTED_CONFIGURATION,new String[] {cfg.getName(),cfg.getToolChain().getName()});
- buf.append(msg).append(NEWLINE);
- buf.append(NEWLINE);
- }
- consoleOutStream.write(buf.toString().getBytes());
- consoleOutStream.flush();
-
- // Remove all markers for this project
- removeAllMarkers(currentProject);
-
- // Get a launcher for the make command
- String errMsg = null;
- IBuilder builder = info.getDefaultConfiguration().getBuilder();
- ICommandLauncher launcher = builder.getCommandLauncher();
- launcher.setProject(currentProject);
- launcher.showCommand(true);
-
- // Set the environmennt
- IBuildEnvironmentVariable variables[] = ManagedBuildManager.getEnvironmentVariableProvider().getVariables(cfg,true,true);
- String[] env = null;
- ArrayList<String> envList = new ArrayList<String>();
- if (variables != null) {
- for(int i = 0; i < variables.length; i++){
- envList.add(variables[i].getName() + "=" + variables[i].getValue()); //$NON-NLS-1$
- }
- env = envList.toArray(new String[envList.size()]);
- }
+ // Get a build console for the project
+ StringBuffer buf = new StringBuffer();
+ IConsole console = CCorePlugin.getDefault().getConsole();
+ console.start(currentProject);
+ ConsoleOutputStream consoleOutStream = console.getOutputStream();
+ String[] consoleHeader = new String[3];
+ switch (buildType) {
+ case FULL_BUILD:
+ case INCREMENTAL_BUILD:
+ consoleHeader[0] = ManagedMakeMessages.getResourceString(TYPE_INC);
+ break;
+ case CLEAN_BUILD:
+ consoleHeader[0] = ManagedMakeMessages.getResourceString(TYPE_CLEAN);
+ break;
+ }
+
+ consoleHeader[1] = info.getConfigurationName();
+ consoleHeader[2] = currentProject.getName();
+ buf.append(NEWLINE);
+ buf.append(ManagedMakeMessages.getFormattedString(CONSOLE_HEADER, consoleHeader)).append(NEWLINE);
+ buf.append(NEWLINE);
- // Hook up an error parser manager
- String[] errorParsers = info.getDefaultConfiguration().getErrorParserList();
- ErrorParserManager epm = new ErrorParserManager(getProject(), workingDirectoryURI, this, errorParsers);
- epm.setOutputStream(consoleOutStream);
- // This variable is necessary to ensure that the EPM stream stay open
- // until we explicitly close it. See bug#123302.
- OutputStream epmOutputStream = epm.getOutputStream();
+ IConfiguration cfg = info.getDefaultConfiguration();
+ if(!cfg.isSupported()){
+ String msg = ManagedMakeMessages.getFormattedString(WARNING_UNSUPPORTED_CONFIGURATION,new String[] {cfg.getName(),cfg.getToolChain().getName()});
+ buf.append(msg).append(NEWLINE);
+ buf.append(NEWLINE);
+ }
+ consoleOutStream.write(buf.toString().getBytes());
+ consoleOutStream.flush();
- // Get the arguments to be passed to make from build model
- ArrayList<String> makeArgs = new ArrayList<String>();
- String arg = info.getBuildArguments();
- if (arg.length() > 0) {
- String[] args = arg.split("\\s"); //$NON-NLS-1$
- for (int i = 0; i < args.length; ++i) {
- makeArgs.add(args[i]);
- }
- }
-
- String[] makeTargets;
- String prebuildStep = info.getPrebuildStep();
- //try to resolve the build macros in the prebuildStep
- try{
- prebuildStep = ManagedBuildManager.getBuildMacroProvider().resolveValueToMakefileFormat(
- prebuildStep,
- "", //$NON-NLS-1$
- " ", //$NON-NLS-1$
- IBuildMacroProvider.CONTEXT_CONFIGURATION,
- cfg);
- } catch (BuildMacroException e){
+ // Remove all markers for this project
+ removeAllMarkers(currentProject);
+
+ // Get a launcher for the make command
+ String errMsg = null;
+ IBuilder builder = info.getDefaultConfiguration().getBuilder();
+ ICommandLauncher launcher = builder.getCommandLauncher();
+ launcher.setProject(currentProject);
+ launcher.showCommand(true);
+
+ // Set the environmennt
+ IBuildEnvironmentVariable variables[] = ManagedBuildManager.getEnvironmentVariableProvider().getVariables(cfg,true,true);
+ String[] env = null;
+ ArrayList<String> envList = new ArrayList<String>();
+ if (variables != null) {
+ for(int i = 0; i < variables.length; i++){
+ envList.add(variables[i].getName() + "=" + variables[i].getValue()); //$NON-NLS-1$
}
- boolean prebuildStepPresent = (prebuildStep.length() > 0);
- Process proc = null;
- boolean isuptodate = false;
-
- if (prebuildStepPresent) {
- @SuppressWarnings("unchecked")
- ArrayList<String> premakeArgs = (ArrayList<String>) makeArgs.clone();
- String[] premakeTargets;
- switch (buildType) {
- case INCREMENTAL_BUILD: {
- // For an incremental build with a prebuild step:
- // Check the status of the main build with "make -q main-build"
- // If up to date:
- // then: don't invoke the prebuild step, which should be run only if
- // something needs to be built in the main build
- // else: invoke the prebuild step and the main build step
- premakeArgs.add("-q"); //$NON-NLS-1$
- premakeArgs.add("main-build"); //$NON-NLS-1$
- premakeTargets = premakeArgs.toArray(new String[premakeArgs.size()]);
- proc = launcher.execute(makeCommand, premakeTargets, env, workingDirectory, monitor);
- if (proc != null) {
- try {
- // Close the input of the process since we will never write to it
- proc.getOutputStream().close();
- } catch (IOException e) {
- }
- if (launcher.waitAndRead(epm.getOutputStream(), epm.getOutputStream(),
- new SubProgressMonitor(monitor,
- IProgressMonitor.UNKNOWN)) != ICommandLauncher.OK) {
- errMsg = launcher.getErrorMessage();
- }
- } else {
- errMsg = launcher.getErrorMessage();
- }
-
- if ((errMsg != null && errMsg.length() > 0) || proc == null) {
- // Can't tell if the build is needed, so assume it is, and let any errors be triggered
- // when the "real" build is invoked below
- makeArgs.add("pre-build"); //$NON-NLS-1$
- makeArgs.add("main-build"); //$NON-NLS-1$
- } else {
- // The "make -q" command launch was successful
- if (proc.exitValue() == 0) {
- // If the status value returned from "make -q" is 0, then the build state is up-to-date
- isuptodate = true;
- // Report that the build was up to date, and thus nothing needs to be built
- String uptodateMsg = ManagedMakeMessages.getFormattedString(NOTHING_BUILT, currentProject.getName());
- buf = new StringBuffer();
- buf.append(NEWLINE);
- buf.append(uptodateMsg).append(NEWLINE);
- // Write message on the console
- consoleOutStream.write(buf.toString().getBytes());
- consoleOutStream.flush();
- epmOutputStream.close();
- consoleOutStream.close();
- } else {
- // The status value was other than 0, so press on with the build process
- makeArgs.add("pre-build"); //$NON-NLS-1$
- makeArgs.add("main-build"); //$NON-NLS-1$
- }
- }
- break;
- }
- case FULL_BUILD: {
-// makeArgs.add("clean"); //$NON-NLS-1$
- makeArgs.add("pre-build"); //$NON-NLS-1$
- makeArgs.add("main-build"); //$NON-NLS-1$
- break;
- }
- case CLEAN_BUILD: {
- makeArgs.add("clean"); //$NON-NLS-1$
- break;
- }
- }
-
- } else {
- // No prebuild step
- //
- makeArgs.addAll(Arrays.asList(getMakeTargets(buildType)));
+ env = envList.toArray(new String[envList.size()]);
+ }
+
+ // Hook up an error parser manager
+ String[] errorParsers = info.getDefaultConfiguration().getErrorParserList();
+ ErrorParserManager epm = new ErrorParserManager(getProject(), workingDirectoryURI, this, errorParsers);
+ epm.setOutputStream(consoleOutStream);
+ // This variable is necessary to ensure that the EPM stream stay open
+ // until we explicitly close it. See bug#123302.
+ OutputStream epmOutputStream = epm.getOutputStream();
+
+ // Get the arguments to be passed to make from build model
+ ArrayList<String> makeArgs = new ArrayList<String>();
+ String arg = info.getBuildArguments();
+ if (arg.length() > 0) {
+ String[] args = arg.split("\\s"); //$NON-NLS-1$
+ for (int i = 0; i < args.length; ++i) {
+ makeArgs.add(args[i]);
}
+ }
- makeTargets = makeArgs.toArray(new String[makeArgs.size()]);
-
- // Launch make - main invocation
- if (!isuptodate) {
- proc = launcher.execute(makeCommand, makeTargets, env, workingDirectory, monitor);
+ String[] makeTargets;
+ String prebuildStep = info.getPrebuildStep();
+ //try to resolve the build macros in the prebuildStep
+ try{
+ prebuildStep = ManagedBuildManager.getBuildMacroProvider().resolveValueToMakefileFormat(
+ prebuildStep,
+ "", //$NON-NLS-1$
+ " ", //$NON-NLS-1$
+ IBuildMacroProvider.CONTEXT_CONFIGURATION,
+ cfg);
+ } catch (BuildMacroException e){
+ }
+ boolean prebuildStepPresent = (prebuildStep.length() > 0);
+ Process proc = null;
+ boolean isuptodate = false;
+
+ if (prebuildStepPresent) {
+ @SuppressWarnings("unchecked")
+ ArrayList<String> premakeArgs = (ArrayList<String>) makeArgs.clone();
+ String[] premakeTargets;
+ switch (buildType) {
+ case INCREMENTAL_BUILD: {
+ // For an incremental build with a prebuild step:
+ // Check the status of the main build with "make -q main-build"
+ // If up to date:
+ // then: don't invoke the prebuild step, which should be run only if
+ // something needs to be built in the main build
+ // else: invoke the prebuild step and the main build step
+ premakeArgs.add("-q"); //$NON-NLS-1$
+ premakeArgs.add("main-build"); //$NON-NLS-1$
+ premakeTargets = premakeArgs.toArray(new String[premakeArgs.size()]);
+ proc = launcher.execute(makeCommand, premakeTargets, env, workingDirectory, monitor);
if (proc != null) {
try {
// Close the input of the process since we will never write to it
proc.getOutputStream().close();
} catch (IOException e) {
}
-
- int state = launcher.waitAndRead(epm.getOutputStream(), epm.getOutputStream(),
+ if (launcher.waitAndRead(epm.getOutputStream(), epm.getOutputStream(),
new SubProgressMonitor(monitor,
- IProgressMonitor.UNKNOWN));
- if(state != ICommandLauncher.OK){
+ IProgressMonitor.UNKNOWN)) != ICommandLauncher.OK) {
errMsg = launcher.getErrorMessage();
-
- if(state == ICommandLauncher.COMMAND_CANCELED){
- //TODO: the better way of handling cancel is needed
- //currently the rebuild state is set to true forcing the full rebuild
- //on the next builder invocation
- info.getDefaultConfiguration().setRebuildState(true);
- }
- }
-
- // Force a resync of the projects without allowing the user to cancel.
- // This is probably unkind, but short of this there is no way to insure
- // the UI is up-to-date with the build results
- monitor.subTask(ManagedMakeMessages
- .getResourceString(REFRESH));
- try {
- //currentProject.refreshLocal(IResource.DEPTH_INFINITE, null);
-
- // use the refresh scope manager to refresh
- RefreshScopeManager refreshManager = RefreshScopeManager.getInstance();
- IWorkspaceRunnable runnable = refreshManager.getRefreshRunnable(currentProject);
- ResourcesPlugin.getWorkspace().run(runnable, null, IWorkspace.AVOID_UPDATE, null);
- } catch (CoreException e) {
- monitor.subTask(ManagedMakeMessages
- .getResourceString(REFRESH_ERROR));
}
} else {
errMsg = launcher.getErrorMessage();
}
- // Report either the success or failure of our mission
- buf = new StringBuffer();
- if (errMsg != null && errMsg.length() > 0) {
- String errorDesc = ManagedMakeMessages.getResourceString(BUILD_ERROR);
- buf.append(errorDesc).append(NEWLINE);
- buf.append("(").append(errMsg).append(")"); //$NON-NLS-1$ //$NON-NLS-2$
+ if ((errMsg != null && errMsg.length() > 0) || proc == null) {
+ // Can't tell if the build is needed, so assume it is, and let any errors be triggered
+ // when the "real" build is invoked below
+ makeArgs.add("pre-build"); //$NON-NLS-1$
+ makeArgs.add("main-build"); //$NON-NLS-1$
} else {
- // Report a successful build
- String successMsg = ManagedMakeMessages.getFormattedString(BUILD_FINISHED,
- currentProject.getName());
- buf.append(successMsg).append(NEWLINE);
+ // The "make -q" command launch was successful
+ if (proc.exitValue() == 0) {
+ // If the status value returned from "make -q" is 0, then the build state is up-to-date
+ isuptodate = true;
+ // Report that the build was up to date, and thus nothing needs to be built
+ String uptodateMsg = ManagedMakeMessages.getFormattedString(NOTHING_BUILT, currentProject.getName());
+ buf = new StringBuffer();
+ buf.append(NEWLINE);
+ buf.append(uptodateMsg).append(NEWLINE);
+ // Write message on the console
+ consoleOutStream.write(buf.toString().getBytes());
+ consoleOutStream.flush();
+ epmOutputStream.close();
+ consoleOutStream.close();
+ } else {
+ // The status value was other than 0, so press on with the build process
+ makeArgs.add("pre-build"); //$NON-NLS-1$
+ makeArgs.add("main-build"); //$NON-NLS-1$
+ }
+ }
+ break;
+ }
+ case FULL_BUILD: {
+// makeArgs.add("clean"); //$NON-NLS-1$
+ makeArgs.add("pre-build"); //$NON-NLS-1$
+ makeArgs.add("main-build"); //$NON-NLS-1$
+ break;
+ }
+ case CLEAN_BUILD: {
+ makeArgs.add("clean"); //$NON-NLS-1$
+ break;
+ }
+ }
+
+ } else {
+ // No prebuild step
+ //
+ makeArgs.addAll(Arrays.asList(getMakeTargets(buildType)));
+ }
+
+ makeTargets = makeArgs.toArray(new String[makeArgs.size()]);
+
+ // Launch make - main invocation
+ if (!isuptodate) {
+ proc = launcher.execute(makeCommand, makeTargets, env, workingDirectory, monitor);
+ if (proc != null) {
+ try {
+ // Close the input of the process since we will never write to it
+ proc.getOutputStream().close();
+ } catch (IOException e) {
}
- // Write message on the console
- consoleOutStream.write(buf.toString().getBytes());
- consoleOutStream.flush();
- epmOutputStream.close();
+ int state = launcher.waitAndRead(epm.getOutputStream(), epm.getOutputStream(),
+ new SubProgressMonitor(monitor,
+ IProgressMonitor.UNKNOWN));
+ if(state != ICommandLauncher.OK){
+ errMsg = launcher.getErrorMessage();
+
+ if(state == ICommandLauncher.COMMAND_CANCELED){
+ //TODO: the better way of handling cancel is needed
+ //currently the rebuild state is set to true forcing the full rebuild
+ //on the next builder invocation
+ info.getDefaultConfiguration().setRebuildState(true);
+ }
+ }
- // Generate any error markers that the build has discovered
- monitor.subTask(ManagedMakeMessages.getResourceString(MARKERS));
- addBuilderMarkers(epm);
- consoleOutStream.close();
+ // Force a resync of the projects without allowing the user to cancel.
+ // This is probably unkind, but short of this there is no way to insure
+ // the UI is up-to-date with the build results
+ monitor.subTask(ManagedMakeMessages
+ .getResourceString(REFRESH));
+ try {
+ //currentProject.refreshLocal(IResource.DEPTH_INFINITE, null);
+
+ // use the refresh scope manager to refresh
+ RefreshScopeManager refreshManager = RefreshScopeManager.getInstance();
+ IWorkspaceRunnable runnable = refreshManager.getRefreshRunnable(currentProject);
+ ResourcesPlugin.getWorkspace().run(runnable, null, IWorkspace.AVOID_UPDATE, null);
+ } catch (CoreException e) {
+ monitor.subTask(ManagedMakeMessages
+ .getResourceString(REFRESH_ERROR));
+ }
+ } else {
+ errMsg = launcher.getErrorMessage();
+ }
+
+ // Report either the success or failure of our mission
+ buf = new StringBuffer();
+ if (errMsg != null && errMsg.length() > 0) {
+ String errorDesc = ManagedMakeMessages.getResourceString(BUILD_ERROR);
+ buf.append(errorDesc).append(NEWLINE);
+ buf.append("(").append(errMsg).append(")"); //$NON-NLS-1$ //$NON-NLS-2$
+ } else {
+ // Report a successful build
+ String successMsg = ManagedMakeMessages.getFormattedString(BUILD_FINISHED,
+ currentProject.getName());
+ buf.append(successMsg).append(NEWLINE);
}
+
+ // Write message on the console
+ consoleOutStream.write(buf.toString().getBytes());
+ consoleOutStream.flush();
+ epmOutputStream.close();
+
+ // Generate any error markers that the build has discovered
+ monitor.subTask(ManagedMakeMessages.getResourceString(MARKERS));
+ addBuilderMarkers(epm);
+ consoleOutStream.close();
}
} catch (Exception e) {
forgetLastBuiltState();
@@ -1196,7 +1196,7 @@ public class GeneratedMakefileBuilder extends ACBuilder {
boolean resumeOnErr,
IProgressMonitor monitor) {
- boolean isParallel = ((Configuration)cfg).getInternalBuilderParallel();
+ boolean isParallel = ((Configuration)cfg).getParallelDef();
// Get the project and make sure there's a monitor to cancel the build
IProject currentProject = cfg.getOwner().getProject();
diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/MultiConfiguration.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/MultiConfiguration.java
index d9834448ca..0b1f6c233e 100644
--- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/MultiConfiguration.java
+++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/MultiConfiguration.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2010 Intel Corporation and others.
+ * Copyright (c) 2007, 2011 Intel Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -44,6 +44,7 @@ import org.eclipse.cdt.managedbuilder.envvar.IConfigurationEnvironmentVariableSu
import org.eclipse.cdt.managedbuilder.macros.IConfigurationBuildMacroSupplier;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.osgi.framework.Version;
@@ -91,6 +92,7 @@ public class MultiConfiguration extends MultiItemsHolder implements
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.core.IConfiguration#buildsFileType(java.lang.String)
*/
+ @Override
public boolean buildsFileType(String srcExt) {
return curr().buildsFileType(srcExt);
}
@@ -98,6 +100,7 @@ public class MultiConfiguration extends MultiItemsHolder implements
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.core.IConfiguration#calculateTargetTool()
*/
+ @Override
public ITool calculateTargetTool() {
return curr().calculateTargetTool();
}
@@ -105,6 +108,7 @@ public class MultiConfiguration extends MultiItemsHolder implements
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.core.IConfiguration#changeBuilder(org.eclipse.cdt.managedbuilder.core.IBuilder, java.lang.String, java.lang.String)
*/
+ @Override
public void changeBuilder(IBuilder newBuilder, String id, String name) {
for (int i=0; i<fCfgs.length; i++)
fCfgs[i].changeBuilder(newBuilder, id, name);
@@ -113,6 +117,7 @@ public class MultiConfiguration extends MultiItemsHolder implements
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.core.IConfiguration#createFileInfo(org.eclipse.core.runtime.IPath)
*/
+ @Override
public IFileInfo createFileInfo(IPath path) {
if (DEBUG)
System.out.println("Strange multi access: MultiConfiguration.createFileInfo(1)"); //$NON-NLS-1$
@@ -122,6 +127,7 @@ public class MultiConfiguration extends MultiItemsHolder implements
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.core.IConfiguration#createFileInfo(org.eclipse.core.runtime.IPath, java.lang.String, java.lang.String)
*/
+ @Override
public IFileInfo createFileInfo(IPath path, String id, String name) {
if (DEBUG)
System.out.println("Strange multi access: MultiConfiguration.createFileInfo(3)"); //$NON-NLS-1$
@@ -131,6 +137,7 @@ public class MultiConfiguration extends MultiItemsHolder implements
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.core.IConfiguration#createFileInfo(org.eclipse.core.runtime.IPath, org.eclipse.cdt.managedbuilder.core.IFolderInfo, org.eclipse.cdt.managedbuilder.core.ITool, java.lang.String, java.lang.String)
*/
+ @Override
public IFileInfo createFileInfo(IPath path, IFolderInfo base,
ITool baseTool, String id, String name) {
if (DEBUG)
@@ -141,6 +148,7 @@ public class MultiConfiguration extends MultiItemsHolder implements
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.core.IConfiguration#createFileInfo(org.eclipse.core.runtime.IPath, org.eclipse.cdt.managedbuilder.core.IFileInfo, java.lang.String, java.lang.String)
*/
+ @Override
public IFileInfo createFileInfo(IPath path, IFileInfo base, String id, String name) {
if (DEBUG)
System.out.println("Bad multi access: MultiConfiguration.createFileInfo(4)"); //$NON-NLS-1$
@@ -150,6 +158,7 @@ public class MultiConfiguration extends MultiItemsHolder implements
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.core.IConfiguration#createFolderInfo(org.eclipse.core.runtime.IPath)
*/
+ @Override
public IFolderInfo createFolderInfo(IPath path) {
if (DEBUG)
System.out.println("Bad multi access: MultiConfiguration.createFolderInfo()"); //$NON-NLS-1$
@@ -159,6 +168,7 @@ public class MultiConfiguration extends MultiItemsHolder implements
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.core.IConfiguration#createFolderInfo(org.eclipse.core.runtime.IPath, java.lang.String, java.lang.String)
*/
+ @Override
public IFolderInfo createFolderInfo(IPath path, String id, String name) {
if (DEBUG)
System.out.println("Bad multi access: MultiConfiguration.createFolderInfo(3)"); //$NON-NLS-1$
@@ -168,6 +178,7 @@ public class MultiConfiguration extends MultiItemsHolder implements
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.core.IConfiguration#createFolderInfo(org.eclipse.core.runtime.IPath, org.eclipse.cdt.managedbuilder.core.IFolderInfo, java.lang.String, java.lang.String)
*/
+ @Override
public IFolderInfo createFolderInfo(IPath path, IFolderInfo base, String id, String name) {
if (DEBUG)
System.out.println("Bad multi access: MultiConfiguration.createFolderInfo(4)"); //$NON-NLS-1$
@@ -177,6 +188,7 @@ public class MultiConfiguration extends MultiItemsHolder implements
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.core.IConfiguration#createResourceConfiguration(org.eclipse.core.resources.IFile)
*/
+ @Override
public IResourceConfiguration createResourceConfiguration(IFile file) {
if (DEBUG)
System.out.println("Bad multi access: MultiConfiguration.createResourceConfiguration()"); //$NON-NLS-1$
@@ -186,6 +198,7 @@ public class MultiConfiguration extends MultiItemsHolder implements
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.core.IConfiguration#createToolChain(org.eclipse.cdt.managedbuilder.core.IToolChain, java.lang.String, java.lang.String, boolean)
*/
+ @Override
public IToolChain createToolChain(IToolChain superClass, String Id,
String name, boolean isExtensionElement) {
if (DEBUG)
@@ -196,6 +209,7 @@ public class MultiConfiguration extends MultiItemsHolder implements
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.core.IConfiguration#generateToolCommandLineInfo(java.lang.String, java.lang.String[], java.lang.String, java.lang.String, java.lang.String, java.lang.String[], org.eclipse.core.runtime.IPath, org.eclipse.core.runtime.IPath)
*/
+ @Override
public IManagedCommandLineInfo generateToolCommandLineInfo(
String sourceExtension,
String[] flags,
@@ -221,6 +235,7 @@ public class MultiConfiguration extends MultiItemsHolder implements
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.core.IConfiguration#getArtifactExtension()
*/
+ @Override
public String getArtifactExtension() {
String s = fCfgs[0].getArtifactExtension();
for (int i=1; i<fCfgs.length; i++)
@@ -239,6 +254,7 @@ public class MultiConfiguration extends MultiItemsHolder implements
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.core.IConfiguration#getArtifactName()
*/
+ @Override
public String getArtifactName() {
String s = fCfgs[0].getArtifactName();
for (int i=1; i<fCfgs.length; i++)
@@ -253,20 +269,30 @@ public class MultiConfiguration extends MultiItemsHolder implements
return s;
}
- /* (non-Javadoc)
- * @see org.eclipse.cdt.managedbuilder.core.IConfiguration#getBuildArguments()
+ /**
+ * @return build arguments if the arguments for all configurations match
+ * or {@code null} otherwise.
*/
+ @Override
public String getBuildArguments() {
- String s = fCfgs[0].getBuildArguments();
- for (int i=1; i<fCfgs.length; i++)
- if (! s.equals(fCfgs[i].getBuildArguments()))
- return EMPTY_STR;
- return s;
+ String args0 = fCfgs[0].getBuildArguments();
+ if (args0 == null)
+ args0 = EMPTY_STR;
+
+ for (IConfiguration cfg : fCfgs) {
+ String args = cfg.getBuildArguments();
+ if (args == null)
+ args = EMPTY_STR;
+ if (!args0.equals(args))
+ return null;
+ }
+ return args0;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.core.IConfiguration#getBuildArtefactType()
*/
+ @Override
public IBuildPropertyValue getBuildArtefactType() {
IBuildPropertyValue b = fCfgs[0].getBuildArtefactType();
if (b == null)
@@ -280,6 +306,7 @@ public class MultiConfiguration extends MultiItemsHolder implements
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.core.IConfiguration#getBuildCommand()
*/
+ @Override
public String getBuildCommand() {
String s = fCfgs[0].getBuildCommand();
if (s == null || s.length() == 0)
@@ -293,6 +320,7 @@ public class MultiConfiguration extends MultiItemsHolder implements
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.core.IConfiguration#getBuildData()
*/
+ @Override
public CBuildData getBuildData() {
if (DEBUG)
System.out.println("Strange multi access: MultiConfiguration.getBuildData()"); //$NON-NLS-1$
@@ -302,6 +330,7 @@ public class MultiConfiguration extends MultiItemsHolder implements
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.core.IConfiguration#getBuildMacroSupplier()
*/
+ @Override
public IConfigurationBuildMacroSupplier getBuildMacroSupplier() {
IConfigurationBuildMacroSupplier ms = fCfgs[0].getBuildMacroSupplier();
if (ms == null)
@@ -315,6 +344,7 @@ public class MultiConfiguration extends MultiItemsHolder implements
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.core.IConfiguration#getBuilder()
*/
+ @Override
public IBuilder getBuilder() {
IBuilder b = fCfgs[0].getBuilder();
if (b == null)
@@ -328,6 +358,7 @@ public class MultiConfiguration extends MultiItemsHolder implements
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.core.IConfiguration#getCleanCommand()
*/
+ @Override
public String getCleanCommand() {
String s = fCfgs[0].getCleanCommand();
for (int i=1; i<fCfgs.length; i++)
@@ -339,6 +370,7 @@ public class MultiConfiguration extends MultiItemsHolder implements
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.core.IConfiguration#getConfigurationData()
*/
+ @Override
public CConfigurationData getConfigurationData() {
if (DEBUG)
System.out.println("Strange multi access: MultiConfiguration.getConfigurationData()"); //$NON-NLS-1$
@@ -348,6 +380,7 @@ public class MultiConfiguration extends MultiItemsHolder implements
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.core.IConfiguration#getDescription()
*/
+ @Override
public String getDescription() {
String s = fCfgs[0].getDescription();
for (int i=1; i<fCfgs.length; i++)
@@ -359,6 +392,7 @@ public class MultiConfiguration extends MultiItemsHolder implements
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.core.IConfiguration#getEditableBuilder()
*/
+ @Override
public IBuilder getEditableBuilder() {
return curr().getEditableBuilder();
}
@@ -366,6 +400,7 @@ public class MultiConfiguration extends MultiItemsHolder implements
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.core.IConfiguration#getEnvironmentVariableSupplier()
*/
+ @Override
public IConfigurationEnvironmentVariableSupplier getEnvironmentVariableSupplier() {
IConfigurationEnvironmentVariableSupplier vs = fCfgs[0].getEnvironmentVariableSupplier();
if (vs == null)
@@ -380,6 +415,7 @@ public class MultiConfiguration extends MultiItemsHolder implements
* @see org.eclipse.cdt.managedbuilder.core.IConfiguration#getErrorParserIds()
*/
+ @Override
public String getErrorParserIds() {
String s = fCfgs[0].getErrorParserIds();
if (s == null || s.length() == 0)
@@ -393,6 +429,7 @@ public class MultiConfiguration extends MultiItemsHolder implements
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.core.IConfiguration#getErrorParserList()
*/
+ @Override
public String[] getErrorParserList() {
String[] s = fCfgs[0].getErrorParserList();
if (s == null || s.length == 0)
@@ -406,6 +443,7 @@ public class MultiConfiguration extends MultiItemsHolder implements
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.core.IConfiguration#getFilteredTools()
*/
+ @Override
public ITool[] getFilteredTools() {
ITool[] ts = curr().getFilteredTools();
return ts;
@@ -414,6 +452,7 @@ public class MultiConfiguration extends MultiItemsHolder implements
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.core.IConfiguration#getLibs(java.lang.String)
*/
+ @Override
public String[] getLibs(String extension) {
String[] s = fCfgs[0].getLibs(extension);
if (s == null || s.length == 0)
@@ -427,6 +466,7 @@ public class MultiConfiguration extends MultiItemsHolder implements
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.core.IConfiguration#getManagedProject()
*/
+ @Override
public IManagedProject getManagedProject() {
IManagedProject s = fCfgs[0].getManagedProject();
if (s == null)
@@ -440,6 +480,7 @@ public class MultiConfiguration extends MultiItemsHolder implements
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.core.IConfiguration#getOutputExtension(java.lang.String)
*/
+ @Override
public String getOutputExtension(String resourceExtension) {
String s = fCfgs[0].getOutputExtension(resourceExtension);
if (s == null || s.length() == 0)
@@ -453,6 +494,7 @@ public class MultiConfiguration extends MultiItemsHolder implements
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.core.IConfiguration#getOutputFlag(java.lang.String)
*/
+ @Override
public String getOutputFlag(String outputExt) {
String s = fCfgs[0].getOutputFlag(outputExt);
if (s == null || s.length() == 0)
@@ -466,6 +508,7 @@ public class MultiConfiguration extends MultiItemsHolder implements
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.core.IConfiguration#getOutputPrefix(java.lang.String)
*/
+ @Override
public String getOutputPrefix(String outputExtension) {
String s = fCfgs[0].getOutputPrefix(outputExtension);
if (s == null || s.length() == 0)
@@ -479,6 +522,7 @@ public class MultiConfiguration extends MultiItemsHolder implements
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.core.IConfiguration#getOwner()
*/
+ @Override
public IResource getOwner() {
IResource s = fCfgs[0].getOwner();
if (s == null)
@@ -492,6 +536,7 @@ public class MultiConfiguration extends MultiItemsHolder implements
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.core.IConfiguration#getParent()
*/
+ @Override
public IConfiguration getParent() {
if (DEBUG)
System.out.println("Bad multi access: MultiConfiguration.getParent()"); //$NON-NLS-1$
@@ -501,6 +546,7 @@ public class MultiConfiguration extends MultiItemsHolder implements
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.core.IConfiguration#getPostannouncebuildStep()
*/
+ @Override
public String getPostannouncebuildStep() {
String s = fCfgs[0].getPostannouncebuildStep();
if (s == null || s.length() == 0)
@@ -514,6 +560,7 @@ public class MultiConfiguration extends MultiItemsHolder implements
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.core.IConfiguration#getPostbuildStep()
*/
+ @Override
public String getPostbuildStep() {
String s = fCfgs[0].getPostbuildStep();
if (s == null || s.length() == 0)
@@ -527,6 +574,7 @@ public class MultiConfiguration extends MultiItemsHolder implements
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.core.IConfiguration#getPreannouncebuildStep()
*/
+ @Override
public String getPreannouncebuildStep() {
String s = fCfgs[0].getPreannouncebuildStep();
if (s == null || s.length() == 0)
@@ -540,6 +588,7 @@ public class MultiConfiguration extends MultiItemsHolder implements
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.core.IConfiguration#getPrebuildStep()
*/
+ @Override
public String getPrebuildStep() {
String s = fCfgs[0].getPrebuildStep();
if (s == null || s.length() == 0)
@@ -553,6 +602,7 @@ public class MultiConfiguration extends MultiItemsHolder implements
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.core.IConfiguration#getProjectType()
*/
+ @Override
public IProjectType getProjectType() {
if (DEBUG)
System.out.println("Strange multi access: MultiConfiguration.getProjectType()"); //$NON-NLS-1$
@@ -562,6 +612,7 @@ public class MultiConfiguration extends MultiItemsHolder implements
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.core.IConfiguration#getResourceConfiguration(java.lang.String)
*/
+ @Override
public IResourceConfiguration getResourceConfiguration(String path) {
if (DEBUG)
System.out.println("Bad multi access: MultiConfiguration.getResourceConfiguration()"); //$NON-NLS-1$
@@ -571,6 +622,7 @@ public class MultiConfiguration extends MultiItemsHolder implements
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.core.IConfiguration#getResourceConfigurations()
*/
+ @Override
public IResourceConfiguration[] getResourceConfigurations() {
if (DEBUG)
System.out.println("Bad multi access: MultiConfiguration.getResourceConfigurations()"); //$NON-NLS-1$
@@ -580,6 +632,7 @@ public class MultiConfiguration extends MultiItemsHolder implements
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.core.IConfiguration#getResourceInfo(org.eclipse.core.runtime.IPath, boolean)
*/
+ @Override
public IResourceInfo getResourceInfo(IPath path, boolean exactPath) {
IResourceInfo ris[] = new IResourceInfo[fCfgs.length];
boolean isFolder = true;
@@ -599,6 +652,7 @@ public class MultiConfiguration extends MultiItemsHolder implements
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.core.IConfiguration#getResourceInfoById(java.lang.String)
*/
+ @Override
public IResourceInfo getResourceInfoById(String id) {
if (DEBUG)
System.out.println("Bad multi access: MultiConfiguration.getResourceInfoById()"); //$NON-NLS-1$
@@ -608,6 +662,7 @@ public class MultiConfiguration extends MultiItemsHolder implements
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.core.IConfiguration#getResourceInfos()
*/
+ @Override
public IResourceInfo[] getResourceInfos() {
ArrayList<IResourceInfo> ri = new ArrayList<IResourceInfo>();
for (int i=0; i<fCfgs.length; i++) {
@@ -620,6 +675,7 @@ public class MultiConfiguration extends MultiItemsHolder implements
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.core.IConfiguration#getRootFolderInfo()
*/
+ @Override
public IFolderInfo getRootFolderInfo() {
IFolderInfo ris[] = new IFolderInfo[fCfgs.length];
for (int i=0; i<fCfgs.length; i++)
@@ -630,6 +686,7 @@ public class MultiConfiguration extends MultiItemsHolder implements
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.core.IConfiguration#getSourceEntries()
*/
+ @Override
public ICSourceEntry[] getSourceEntries() {
if (DEBUG)
System.out.println("Strange multi access: MultiConfiguration.getSourceEntries()"); //$NON-NLS-1$
@@ -639,6 +696,7 @@ public class MultiConfiguration extends MultiItemsHolder implements
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.core.IConfiguration#getTargetTool()
*/
+ @Override
public ITool getTargetTool() {
if (DEBUG)
System.out.println("Strange multi access: MultiConfiguration.getTargetTool()"); //$NON-NLS-1$
@@ -648,6 +706,7 @@ public class MultiConfiguration extends MultiItemsHolder implements
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.core.IConfiguration#getTool(java.lang.String)
*/
+ @Override
public ITool getTool(String id) {
if (DEBUG)
System.out.println("Strange multi access: MultiConfiguration.getTool()"); //$NON-NLS-1$
@@ -657,6 +716,7 @@ public class MultiConfiguration extends MultiItemsHolder implements
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.core.IConfiguration#getToolChain()
*/
+ @Override
public IToolChain getToolChain() {
return curr().getToolChain();
}
@@ -664,6 +724,7 @@ public class MultiConfiguration extends MultiItemsHolder implements
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.core.IConfiguration#getToolCommand(org.eclipse.cdt.managedbuilder.core.ITool)
*/
+ @Override
public String getToolCommand(ITool tool) {
return curr().getToolCommand(tool);
}
@@ -671,6 +732,7 @@ public class MultiConfiguration extends MultiItemsHolder implements
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.core.IConfiguration#getToolFromInputExtension(java.lang.String)
*/
+ @Override
public ITool getToolFromInputExtension(String sourceExtension) {
if (DEBUG)
System.out.println("Strange multi access: MultiConfiguration.getToolFromInputExtension()"); //$NON-NLS-1$
@@ -680,6 +742,7 @@ public class MultiConfiguration extends MultiItemsHolder implements
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.core.IConfiguration#getToolFromOutputExtension(java.lang.String)
*/
+ @Override
public ITool getToolFromOutputExtension(String extension) {
if (DEBUG)
System.out.println("Strange multi access: MultiConfiguration.getToolFromOutputExtension()"); //$NON-NLS-1$
@@ -689,6 +752,7 @@ public class MultiConfiguration extends MultiItemsHolder implements
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.core.IConfiguration#getTools()
*/
+ @Override
public ITool[] getTools() {
if (DEBUG)
System.out.println("Strange multi access: MultiConfiguration.getTools()"); //$NON-NLS-1$
@@ -698,6 +762,7 @@ public class MultiConfiguration extends MultiItemsHolder implements
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.core.IConfiguration#getToolsBySuperClassId(java.lang.String)
*/
+ @Override
public ITool[] getToolsBySuperClassId(String id) {
if (DEBUG)
System.out.println("Strange multi access: MultiConfiguration.getToolsBySuperClassId()"); //$NON-NLS-1$
@@ -707,6 +772,7 @@ public class MultiConfiguration extends MultiItemsHolder implements
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.core.IConfiguration#getUserObjects(java.lang.String)
*/
+ @Override
public String[] getUserObjects(String extension) {
if (DEBUG)
System.out.println("Strange multi access: MultiConfiguration.getUserObjects()"); //$NON-NLS-1$
@@ -716,6 +782,7 @@ public class MultiConfiguration extends MultiItemsHolder implements
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.core.IConfiguration#hasOverriddenBuildCommand()
*/
+ @Override
public boolean hasOverriddenBuildCommand() {
for (int i=0; i<fCfgs.length; i++)
if (fCfgs[i].hasOverriddenBuildCommand())
@@ -726,6 +793,7 @@ public class MultiConfiguration extends MultiItemsHolder implements
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.core.IConfiguration#isBuilderCompatible(org.eclipse.cdt.managedbuilder.core.IBuilder)
*/
+ @Override
public boolean isBuilderCompatible(IBuilder builder) {
for (int i=0; i<fCfgs.length; i++)
if (! fCfgs[i].isBuilderCompatible(builder))
@@ -736,6 +804,7 @@ public class MultiConfiguration extends MultiItemsHolder implements
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.core.IConfiguration#isDirty()
*/
+ @Override
public boolean isDirty() {
for (int i=0; i<fCfgs.length; i++)
if (fCfgs[i].isDirty())
@@ -746,6 +815,7 @@ public class MultiConfiguration extends MultiItemsHolder implements
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.core.IConfiguration#isExtensionElement()
*/
+ @Override
public boolean isExtensionElement() {
if (DEBUG)
System.out.println("Strange multi access: MultiConfiguration.isExtensionElement()"); //$NON-NLS-1$
@@ -755,6 +825,7 @@ public class MultiConfiguration extends MultiItemsHolder implements
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.core.IConfiguration#isHeaderFile(java.lang.String)
*/
+ @Override
public boolean isHeaderFile(String ext) {
if (DEBUG)
System.out.println("Strange multi access: MultiConfiguration.isHeaderFile()"); //$NON-NLS-1$
@@ -764,6 +835,7 @@ public class MultiConfiguration extends MultiItemsHolder implements
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.core.IConfiguration#isManagedBuildOn()
*/
+ @Override
public boolean isManagedBuildOn() {
for (int i=0; i<fCfgs.length; i++)
if (! fCfgs[i].isManagedBuildOn())
@@ -781,6 +853,7 @@ public class MultiConfiguration extends MultiItemsHolder implements
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.core.IConfiguration#isSupported()
*/
+ @Override
public boolean isSupported() {
for (int i=0; i<fCfgs.length; i++)
if (fCfgs[i].isSupported())
@@ -791,6 +864,7 @@ public class MultiConfiguration extends MultiItemsHolder implements
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.core.IConfiguration#isSystemObject()
*/
+ @Override
public boolean isSystemObject() {
for (int i=0; i<fCfgs.length; i++)
if (! fCfgs[i].isSystemObject())
@@ -801,6 +875,7 @@ public class MultiConfiguration extends MultiItemsHolder implements
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.core.IConfiguration#isTemporary()
*/
+ @Override
public boolean isTemporary() {
for (int i=0; i<fCfgs.length; i++)
if (! fCfgs[i].isTemporary())
@@ -811,6 +886,7 @@ public class MultiConfiguration extends MultiItemsHolder implements
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.core.IConfiguration#needsFullRebuild()
*/
+ @Override
public boolean needsFullRebuild() {
for (int i=0; i<fCfgs.length; i++)
if (fCfgs[i].needsFullRebuild())
@@ -821,6 +897,7 @@ public class MultiConfiguration extends MultiItemsHolder implements
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.core.IConfiguration#needsRebuild()
*/
+ @Override
public boolean needsRebuild() {
for (int i=0; i<fCfgs.length; i++)
if (fCfgs[i].needsRebuild())
@@ -831,6 +908,7 @@ public class MultiConfiguration extends MultiItemsHolder implements
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.core.IConfiguration#removeResourceConfiguration(org.eclipse.cdt.managedbuilder.core.IResourceInfo)
*/
+ @Override
public void removeResourceConfiguration(IResourceInfo resConfig) {
for (int i=0; i<fCfgs.length; i++)
fCfgs[i].removeResourceConfiguration(resConfig);
@@ -839,6 +917,7 @@ public class MultiConfiguration extends MultiItemsHolder implements
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.core.IConfiguration#removeResourceInfo(org.eclipse.core.runtime.IPath)
*/
+ @Override
public void removeResourceInfo(IPath path) {
for (int i=0; i<fCfgs.length; i++)
fCfgs[i].removeResourceInfo(path);
@@ -847,6 +926,7 @@ public class MultiConfiguration extends MultiItemsHolder implements
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.core.IConfiguration#setArtifactExtension(java.lang.String)
*/
+ @Override
public void setArtifactExtension(String extension) {
for (int i=0; i<fCfgs.length; i++)
fCfgs[i].setArtifactExtension(extension);
@@ -855,6 +935,7 @@ public class MultiConfiguration extends MultiItemsHolder implements
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.core.IConfiguration#setArtifactName(java.lang.String)
*/
+ @Override
public void setArtifactName(String name) {
for (int i=0; i<fCfgs.length; i++)
fCfgs[i].setArtifactName(name);
@@ -863,6 +944,7 @@ public class MultiConfiguration extends MultiItemsHolder implements
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.core.IConfiguration#setBuildArguments(java.lang.String)
*/
+ @Override
public void setBuildArguments(String makeArgs) {
for (int i=0; i<fCfgs.length; i++)
fCfgs[i].setBuildArguments(makeArgs);
@@ -871,6 +953,7 @@ public class MultiConfiguration extends MultiItemsHolder implements
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.core.IConfiguration#setBuildArtefactType(java.lang.String)
*/
+ @Override
public void setBuildArtefactType(String id) throws BuildException {
for (int i=0; i<fCfgs.length; i++)
fCfgs[i].setBuildArtefactType(id);
@@ -879,6 +962,7 @@ public class MultiConfiguration extends MultiItemsHolder implements
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.core.IConfiguration#setBuildCommand(java.lang.String)
*/
+ @Override
public void setBuildCommand(String command) {
for (int i=0; i<fCfgs.length; i++)
fCfgs[i].setBuildCommand(command);
@@ -887,6 +971,7 @@ public class MultiConfiguration extends MultiItemsHolder implements
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.core.IConfiguration#setCleanCommand(java.lang.String)
*/
+ @Override
public void setCleanCommand(String command) {
for (int i=0; i<fCfgs.length; i++)
fCfgs[i].setCleanCommand(command);
@@ -895,6 +980,7 @@ public class MultiConfiguration extends MultiItemsHolder implements
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.core.IConfiguration#setDescription(java.lang.String)
*/
+ @Override
public void setDescription(String description) {
for (int i=0; i<fCfgs.length; i++)
fCfgs[i].setDescription(description);
@@ -903,6 +989,7 @@ public class MultiConfiguration extends MultiItemsHolder implements
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.core.IConfiguration#setDirty(boolean)
*/
+ @Override
public void setDirty(boolean isDirty) {
for (int i=0; i<fCfgs.length; i++)
fCfgs[i].setDirty(isDirty);
@@ -911,6 +998,7 @@ public class MultiConfiguration extends MultiItemsHolder implements
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.core.IConfiguration#setErrorParserIds(java.lang.String)
*/
+ @Override
public void setErrorParserIds(String ids) {
for (int i=0; i<fCfgs.length; i++)
fCfgs[i].setErrorParserIds(ids);
@@ -919,6 +1007,7 @@ public class MultiConfiguration extends MultiItemsHolder implements
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.core.IConfiguration#setErrorParserList(java.lang.String[])
*/
+ @Override
public void setErrorParserList(String[] ids) {
for (int i=0; i<fCfgs.length; i++)
fCfgs[i].setErrorParserList(ids);
@@ -927,6 +1016,7 @@ public class MultiConfiguration extends MultiItemsHolder implements
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.core.IConfiguration#setManagedBuildOn(boolean)
*/
+ @Override
public void setManagedBuildOn(boolean on) throws BuildException {
for (int i=0; i<fCfgs.length; i++)
fCfgs[i].setManagedBuildOn(on);
@@ -935,11 +1025,13 @@ public class MultiConfiguration extends MultiItemsHolder implements
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.core.IConfiguration#setName(java.lang.String)
*/
+ @Override
public void setName(String name) {} // do nothing
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.core.IConfiguration#setOption(org.eclipse.cdt.managedbuilder.core.IHoldsOptions, org.eclipse.cdt.managedbuilder.core.IOption, boolean)
*/
+ @Override
public IOption setOption(IHoldsOptions parent, IOption option, boolean value)
throws BuildException {
IOption op = null;
@@ -951,6 +1043,7 @@ public class MultiConfiguration extends MultiItemsHolder implements
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.core.IConfiguration#setOption(org.eclipse.cdt.managedbuilder.core.IHoldsOptions, org.eclipse.cdt.managedbuilder.core.IOption, java.lang.String)
*/
+ @Override
public IOption setOption(IHoldsOptions parent, IOption option, String value)
throws BuildException {
IOption op = null;
@@ -962,6 +1055,7 @@ public class MultiConfiguration extends MultiItemsHolder implements
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.core.IConfiguration#setOption(org.eclipse.cdt.managedbuilder.core.IHoldsOptions, org.eclipse.cdt.managedbuilder.core.IOption, java.lang.String[])
*/
+ @Override
public IOption setOption(IHoldsOptions parent, IOption option,
String[] value) throws BuildException {
IOption op = null;
@@ -973,6 +1067,7 @@ public class MultiConfiguration extends MultiItemsHolder implements
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.core.IConfiguration#setPostannouncebuildStep(java.lang.String)
*/
+ @Override
public void setPostannouncebuildStep(String announceStep) {
for (int i=0; i<fCfgs.length; i++)
fCfgs[i].setPostannouncebuildStep(announceStep);
@@ -981,6 +1076,7 @@ public class MultiConfiguration extends MultiItemsHolder implements
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.core.IConfiguration#setPostbuildStep(java.lang.String)
*/
+ @Override
public void setPostbuildStep(String step) {
for (int i=0; i<fCfgs.length; i++)
fCfgs[i].setPostbuildStep(step);
@@ -989,6 +1085,7 @@ public class MultiConfiguration extends MultiItemsHolder implements
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.core.IConfiguration#setPreannouncebuildStep(java.lang.String)
*/
+ @Override
public void setPreannouncebuildStep(String announceStep) {
for (int i=0; i<fCfgs.length; i++)
fCfgs[i].setPreannouncebuildStep(announceStep);
@@ -997,6 +1094,7 @@ public class MultiConfiguration extends MultiItemsHolder implements
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.core.IConfiguration#setPrebuildStep(java.lang.String)
*/
+ @Override
public void setPrebuildStep(String step) {
for (int i=0; i<fCfgs.length; i++)
fCfgs[i].setPrebuildStep(step);
@@ -1005,6 +1103,7 @@ public class MultiConfiguration extends MultiItemsHolder implements
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.core.IConfiguration#setRebuildState(boolean)
*/
+ @Override
public void setRebuildState(boolean rebuild) {
for (int i=0; i<fCfgs.length; i++)
fCfgs[i].setRebuildState(rebuild);
@@ -1013,6 +1112,7 @@ public class MultiConfiguration extends MultiItemsHolder implements
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.core.IConfiguration#setSourceEntries(org.eclipse.cdt.core.settings.model.ICSourceEntry[])
*/
+ @Override
public void setSourceEntries(ICSourceEntry[] entries) {
for (int i=0; i<fCfgs.length; i++)
fCfgs[i].setSourceEntries(entries);
@@ -1021,6 +1121,7 @@ public class MultiConfiguration extends MultiItemsHolder implements
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.core.IConfiguration#setToolCommand(org.eclipse.cdt.managedbuilder.core.ITool, java.lang.String)
*/
+ @Override
public void setToolCommand(ITool tool, String command) {
for (int i=0; i<fCfgs.length; i++)
fCfgs[i].setToolCommand(tool, command);
@@ -1029,6 +1130,7 @@ public class MultiConfiguration extends MultiItemsHolder implements
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.core.IConfiguration#supportsBuild(boolean)
*/
+ @Override
public boolean supportsBuild(boolean managed) {
for (int i=0; i<fCfgs.length; i++)
if (! fCfgs[i].supportsBuild(managed))
@@ -1039,6 +1141,7 @@ public class MultiConfiguration extends MultiItemsHolder implements
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.core.IBuildObject#getBaseId()
*/
+ @Override
public String getBaseId() {
if (DEBUG)
System.out.println("Strange multi access: MultiConfiguration.getBaseId()"); //$NON-NLS-1$
@@ -1048,6 +1151,7 @@ public class MultiConfiguration extends MultiItemsHolder implements
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.core.IBuildObject#getId()
*/
+ @Override
public String getId() {
return curr().getId() + "_etc"; //$NON-NLS-1$
}
@@ -1055,6 +1159,7 @@ public class MultiConfiguration extends MultiItemsHolder implements
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.core.IBuildObject#getManagedBuildRevision()
*/
+ @Override
public String getManagedBuildRevision() {
if (DEBUG)
System.out.println("Strange multi access: MultiConfiguration.getMngBuildRevision()"); //$NON-NLS-1$
@@ -1064,6 +1169,7 @@ public class MultiConfiguration extends MultiItemsHolder implements
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.core.IBuildObject#getName()
*/
+ @Override
public String getName() {
return "Multiple configurations"; //$NON-NLS-1$
}
@@ -1071,6 +1177,7 @@ public class MultiConfiguration extends MultiItemsHolder implements
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.core.IBuildObject#getVersion()
*/
+ @Override
public Version getVersion() {
if (DEBUG)
System.out.println("Strange multi access: MultiConfiguration.getVersion()"); //$NON-NLS-1$
@@ -1080,61 +1187,69 @@ public class MultiConfiguration extends MultiItemsHolder implements
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.core.IBuildObject#setVersion(org.eclipse.core.runtime.PluginVersionIdentifier)
*/
+ @Override
public void setVersion(Version version) {} // do nothing
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.core.IBuildObjectPropertiesContainer#getBuildProperties()
*/
+ @Override
public IBuildObjectProperties getBuildProperties() {
return curr().getBuildProperties();
}
+ @Override
public boolean getParallelDef() {
- for (int i=0; i<fCfgs.length; i++)
- if (fCfgs[i] instanceof Configuration) {
- if (!((Configuration)fCfgs[i]).getParallelDef())
+ for (IConfiguration cfg : fCfgs) {
+ if (cfg instanceof Configuration) {
+ if (!((Configuration)cfg).getParallelDef())
return false;
} else
return false;
+ }
return true; // all cfgs report true
}
- public void setParallelDef(boolean def) {
- for (int i=0; i<fCfgs.length; i++)
- if (fCfgs[i] instanceof Configuration)
- ((Configuration)fCfgs[i]).setParallelDef(def);
+ @Override
+ public void setParallelDef(boolean parallel) {
+ for (IConfiguration cfg : fCfgs) {
+ if (cfg instanceof Configuration)
+ ((Configuration)cfg).setParallelDef(parallel);
+ }
}
+ @Override
public int getParallelNumber() {
- int res = -1;
- for (int i=0; i<fCfgs.length; i++)
- if (fCfgs[i] instanceof Configuration) {
- int x = ((Configuration)fCfgs[i]).getParallelNumber();
- if (res == -1)
- res = x;
- else if (res != x)
+ int res = 0;
+ for (IConfiguration cfg : fCfgs) {
+ if (cfg instanceof Configuration) {
+ int num = ((Configuration)cfg).getParallelNumber();
+ Assert.isTrue(num != 0); // can't be 0, see IMakeCommonBuildInfo.getParallelizationNum()
+
+ if (res == 0)
+ res = num;
+ else if (res != num)
return 0; // values are different !
} else
return 0;
- return (res == -1 ? 0: res); // all cfgs report true
+ }
+ return res; // all cfgs report same value
}
+ @Override
public void setParallelNumber(int num) {
- for (int i=0; i<fCfgs.length; i++)
- if (fCfgs[i] instanceof Configuration)
- ((Configuration)fCfgs[i]).setParallelNumber(num);
+ for (IConfiguration cfg : fCfgs) {
+ if (cfg instanceof Configuration)
+ ((Configuration)cfg).setParallelNumber(num);
+ }
}
+ @Override
public boolean getInternalBuilderParallel() {
- for (int i=0; i<fCfgs.length; i++)
- if (fCfgs[i] instanceof Configuration) {
- if (!((Configuration)fCfgs[i]).getInternalBuilderParallel())
- return false;
- } else
- return false;
- return true; // all cfgs report true
+ return getParallelDef();
}
+ @Override
public boolean isInternalBuilderEnabled() {
for (int i=0; i<fCfgs.length; i++)
if (fCfgs[i] instanceof Configuration) {
@@ -1145,6 +1260,7 @@ public class MultiConfiguration extends MultiItemsHolder implements
return true; // all cfgs report true
}
+ @Override
public boolean canEnableInternalBuilder(boolean v) {
for (int i=0; i<fCfgs.length; i++)
if (fCfgs[i] instanceof Configuration) {
@@ -1155,6 +1271,7 @@ public class MultiConfiguration extends MultiItemsHolder implements
return true; // all cfgs report true
}
+ @Override
public void enableInternalBuilder(boolean v) {
for (int i=0; i<fCfgs.length; i++)
if (fCfgs[i] instanceof Configuration)
@@ -1168,6 +1285,7 @@ public class MultiConfiguration extends MultiItemsHolder implements
return fCfgs[curr];
}
+ @Override
public String getToolOutputPrefix() {
String s = fCfgs[0].calculateTargetTool().getOutputPrefix();
if (s == null || s.length() == 0)
@@ -1178,11 +1296,13 @@ public class MultiConfiguration extends MultiItemsHolder implements
return s;
}
+ @Override
public void setOutputPrefixForPrimaryOutput(String pref) {
for (int i=0; i<fCfgs.length; i++)
fCfgs[i].calculateTargetTool().setOutputPrefixForPrimaryOutput(pref);
}
+ @Override
public IBuildProperty getBuildProperty(String id) {
IBuildProperty b = fCfgs[0].getBuildProperties().getProperty(id);
if (b == null )
@@ -1196,6 +1316,7 @@ public class MultiConfiguration extends MultiItemsHolder implements
}
// Performing conjunction of supported values for each cfg
+ @Override
public IBuildPropertyValue[] getSupportedValues(String id) {
IBuildPropertyValue[] a = fCfgs[0].getBuildProperties().getSupportedValues(id);
if (a == null || a.length == 0)
@@ -1232,6 +1353,7 @@ public class MultiConfiguration extends MultiItemsHolder implements
}
}
+ @Override
public void setBuildProperty(String id, String val) {
try {
for (int i=0; i<fCfgs.length; i++)
diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/newmake/core/IMakeCommonBuildInfo.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/newmake/core/IMakeCommonBuildInfo.java
index 35cded8218..3d1a919d7f 100644
--- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/newmake/core/IMakeCommonBuildInfo.java
+++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/newmake/core/IMakeCommonBuildInfo.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2010 QNX Software Systems and others.
+ * Copyright (c) 2004, 2011 QNX Software Systems and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -12,6 +12,7 @@ package org.eclipse.cdt.newmake.core;
import java.util.Map;
+import org.eclipse.cdt.managedbuilder.internal.core.Builder;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
@@ -42,10 +43,45 @@ public interface IMakeCommonBuildInfo {
void setStopOnError(boolean on) throws CoreException;
boolean supportsStopOnError(boolean on);
+ /**
+ * @return the current number of parallel jobs.
+ * The value of the number is encoded as follows:
+ * <pre>
+ * Status Returns
+ * No parallel 1
+ * Unlimited Integer.MAX (N/A for Internal Builder)
+ * Optimal -CPU# (negative number of processors)
+ * Specific >0 (positive number)
+ * </pre>
+ */
int getParallelizationNum();
- void setParallelizationNum(int num) throws CoreException;
+
+ /**
+ * Sets maximum number of parallel threads/jobs to be used by builder.
+ * Note that the number will be set only if the builder is in "parallel"
+ * mode.
+ *
+ * @param jobs - number of jobs according table {@link #getParallelizationNum()}.
+ * Any number <=0 is treated as setting "optimal" property,
+ * the value of the number itself is ignored.
+ */
+ void setParallelizationNum(int jobs) throws CoreException;
+ /**
+ * @return {@code true} if builder supports parallel build,
+ * {@code false} otherwise.
+ */
boolean supportsParallelBuild();
+ /**
+ * @return {@code true} if builder support for parallel build is enabled,
+ * {@code false} otherwise.
+ */
boolean isParallelBuildOn();
+ /**
+ * Set parallel execution mode for the builder.
+ * @see Builder#setParallelBuildOn(boolean)
+ *
+ * @param on - the flag to enable or disable parallel mode.
+ */
void setParallelBuildOn(boolean on) throws CoreException;
boolean isDefaultBuildCmd();

Back to the top