Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse')
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/IConfiguration.java70
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/IManagedBuildInfo.java30
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/IManagedIsToolChainSupported.java28
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/IProjectType.java9
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/ITargetPlatform.java18
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/IToolChain.java10
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Configuration.java206
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/GeneratedMakefileBuilder.java234
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/ManagedBuildInfo.java79
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/PluginResources.properties3
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/ProjectType.java14
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Target.java4
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/TargetPlatform.java84
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/ToolChain.java50
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/makegen/IManagedBuilderMakefileGenerator.java6
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/makegen/gnu/GnuMakefileGenerator.java104
-rw-r--r--build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/projectconverter/UpdateManagedProject20.java4
17 files changed, 838 insertions, 115 deletions
diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/IConfiguration.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/IConfiguration.java
index bc1b240307..a4cb16687b 100644
--- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/IConfiguration.java
+++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/IConfiguration.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2003, 2004 IBM Corporation and others.
+ * Copyright (c) 2003, 2005 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
@@ -28,6 +28,10 @@ import org.eclipse.core.resources.IResource;
public interface IConfiguration extends IBuildObject {
public static final String ARTIFACT_NAME = "artifactName"; //$NON-NLS-1$
public static final String CLEAN_COMMAND = "cleanCommand"; //$NON-NLS-1$
+ public static final String PREBUILD_STEP = "prebuildStep"; //$NON-NLS-1$
+ public static final String POSTBUILD_STEP = "postbuildStep"; //$NON-NLS-1$
+ public static final String PREANNOUNCEBUILD_STEP = "preannouncebuildStep"; //$NON-NLS-1$
+ public static final String POSTANNOUNCEBUILD_STEP = "postannouncebuildStep"; //$NON-NLS-1$
// Schema element names
public static final String CONFIGURATION_ELEMENT_NAME = "configuration"; //$NON-NLS-1$
public static final String ERROR_PARSERS = "errorParsers"; //$NON-NLS-1$
@@ -83,6 +87,34 @@ public interface IConfiguration extends IBuildObject {
public String getBuildCommand();
/**
+ * Returns the prebuild step from this configuration's builder
+ *
+ * @return String
+ */
+ public String getPrebuildStep();
+
+ /**
+ * Returns the postbuild step from this configuration's builder
+ *
+ * @return String
+ */
+ public String getPostbuildStep();
+
+ /**
+ * Returns the display string associated with the prebuild step from this configuration's builder
+ *
+ * @return String
+ */
+ public String getPreannouncebuildStep();
+
+ /**
+ * Returns the display string associated with the postbuild step from this configuration's builder
+ *
+ * @return String
+ */
+ public String getPostannouncebuildStep();
+
+ /**
* Answers the OS-specific command to remove files created by the build
* of this configuration.
*
@@ -266,6 +298,34 @@ public interface IConfiguration extends IBuildObject {
public void setBuildCommand(String command);
/**
+ * Sets the prebuild step for the receiver to the value in the argument.
+ *
+ * @param step
+ */
+ public void setPrebuildStep(String step);
+
+ /**
+ * Sets the postbuild step for the receiver to the value in the argument.
+ *
+ * @param step
+ */
+ public void setPostbuildStep(String step);
+
+ /**
+ * Sets the prebuild step display string for the receiver to the value in the argument.
+ *
+ * @param announceStep
+ */
+ public void setPreannouncebuildStep(String announceStep);
+
+ /**
+ * Sets the postbuild step display string for the receiver to the value in the argument.
+ *
+ * @param announceStep
+ */
+ public void setPostannouncebuildStep(String announceStep);
+
+ /**
* Sets the command used to clean the outputs of this configuration.
*
* @param name
@@ -350,4 +410,12 @@ public interface IConfiguration extends IBuildObject {
* @param command The command
*/
public void setToolCommand(ITool tool, String command);
+
+ /**
+ * Returns <code>true</code> if the configuration's tool-chain is supported on the system
+ * otherwise returns <code>false</code>
+ *
+ * @return boolean
+ */
+ public boolean isSupported();
}
diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/IManagedBuildInfo.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/IManagedBuildInfo.java
index 0db12b5929..7384fd6a09 100644
--- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/IManagedBuildInfo.java
+++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/IManagedBuildInfo.java
@@ -1,5 +1,5 @@
/**********************************************************************
- * Copyright (c) 2003,2004 Rational Software Corporation and others.
+ * Copyright (c) 2003,2005 Rational Software Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v0.5
* which accompanies this distribution, and is available at
@@ -97,6 +97,34 @@ public interface IManagedBuildInfo {
public String getBuildCommand();
/**
+ * Answers the prebuild step for the default configuration
+ *
+ * @return String
+ */
+ public String getPrebuildStep();
+
+ /**
+ * Answers the postbuild step for the default configuration
+ *
+ * @return String
+ */
+ public String getPostbuildStep();
+
+ /**
+ * Answers the display string associated with the prebuild step for the default configuration
+ *
+ * @return String
+ */
+ public String getPreannouncebuildStep();
+
+ /**
+ * Answers the display string associated with the postbuild step for the default configuration
+ *
+ * @return String
+ */
+ public String getPostannouncebuildStep();
+
+ /**
* Answers the command needed to remove files on the build machine
*
* @return
diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/IManagedIsToolChainSupported.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/IManagedIsToolChainSupported.java
new file mode 100644
index 0000000000..188a38ca04
--- /dev/null
+++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/IManagedIsToolChainSupported.java
@@ -0,0 +1,28 @@
+/**********************************************************************
+ * Copyright (c) 2005 Intel Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * Intel Corporation - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.cdt.managedbuilder.core;
+
+import org.eclipse.core.runtime.PluginVersionIdentifier;
+
+/**
+ *
+ * @since 3.0
+ */
+public interface IManagedIsToolChainSupported {
+ /**
+ *
+ * @return <code>true</code> if the given tool-chain is supported on the system
+ * otherwise returns <code>false</code>
+ */
+ public boolean isSupported(IToolChain toolChain,
+ PluginVersionIdentifier version,
+ String instance);
+}
diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/IProjectType.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/IProjectType.java
index f139b73d8f..484992c42d 100644
--- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/IProjectType.java
+++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/IProjectType.java
@@ -1,5 +1,5 @@
/**********************************************************************
- * Copyright (c) 2004 Intel Corporation and others.
+ * Copyright (c) 2004, 2005 Intel Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
@@ -128,4 +128,11 @@ public interface IProjectType extends IBuildObject {
*/
public boolean isTestProjectType();
+ /**
+ * Returns <code>true</code> if at least one project-type contiguration is supported on the system
+ * otherwise returns <code>false</code>
+ *
+ * @return boolean
+ */
+ public boolean isSupported();
}
diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/ITargetPlatform.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/ITargetPlatform.java
index 8b8ffa30c4..49924bf73a 100644
--- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/ITargetPlatform.java
+++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/ITargetPlatform.java
@@ -1,5 +1,5 @@
/**********************************************************************
- * Copyright (c) 2004 Intel Corporation and others.
+ * Copyright (c) 2004, 2005 Intel Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
@@ -94,17 +94,33 @@ public interface ITargetPlatform extends IBuildObject {
* Returns the unique ID of the binary parser associated with the target platform.
*
* @return String
+ * @deprecated Use getBinaryParserList
*/
public String getBinaryParserId();
/**
+ * Returns the unique IDs of the binary parsers associated with the target platform.
+ *
+ * @return String[]
+ */
+ public String[] getBinaryParserList();
+
+ /**
* Sets the string id of the binary parser for this target platform.
*
* @param id
+ * @deprecated Use setBinaryParserList
*/
public void setBinaryParserId(String id);
/**
+ * Sets the string ids of the binary parsers for this target platform.
+ *
+ * @param ids
+ */
+ public void setBinaryParserList(String[] ids);
+
+ /**
* Returns <code>true</code> if this element has changes that need to
* be saved in the project file, else <code>false</code>.
*
diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/IToolChain.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/IToolChain.java
index a27424ea3a..2cb1e89c22 100644
--- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/IToolChain.java
+++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/IToolChain.java
@@ -1,5 +1,5 @@
/**********************************************************************
- * Copyright (c) 2004 Intel Corporation and others.
+ * Copyright (c) 2004, 2005 Intel Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
@@ -32,6 +32,7 @@ public interface IToolChain extends IBuildObject {
public static final String OS_LIST = "osList"; //$NON-NLS-1$
public static final String ARCH_LIST = "archList"; //$NON-NLS-1$
public static final String ERROR_PARSERS = "errorParsers"; //$NON-NLS-1$
+ public static final String IS_TOOL_CHAIN_SUPPORTED = "isToolChainSupported"; //$NON-NLS-1$
// The attribute name for the scanner info collector
public static final String SCANNER_CONFIG_PROFILE_ID = "scannerConfigDiscoveryProfileId"; //$NON-NLS-1$
@@ -247,4 +248,11 @@ public interface IToolChain extends IBuildObject {
*/
public boolean isExtensionElement();
+ /**
+ * Returns <code>true</code> if the tool-chain support is installed on the system
+ * otherwise returns <code>false</code>
+ *
+ * @return boolean
+ */
+ public boolean isSupported();
}
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 7d8cad4846..106bf84b4f 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
@@ -1,5 +1,5 @@
/**********************************************************************
- * Copyright (c) 2003,2004 IBM Rational Software and others.
+ * Copyright (c) 2003,2005 IBM Rational Software and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
@@ -60,6 +60,10 @@ public class Configuration extends BuildObject implements IConfiguration {
private String cleanCommand;
private String artifactExtension;
private String errorParserIds;
+ private String prebuildStep;
+ private String postbuildStep;
+ private String preannouncebuildStep;
+ private String postannouncebuildStep;
// Miscellaneous
private boolean isExtensionConfig = false;
private boolean isDirty = false;
@@ -225,9 +229,21 @@ public class Configuration extends BuildObject implements IConfiguration {
if (cloneConfig.errorParserIds != null) {
errorParserIds = new String(cloneConfig.errorParserIds);
}
+ if (cloneConfig.prebuildStep != null) {
+ prebuildStep = new String(cloneConfig.prebuildStep);
+ }
+ if (cloneConfig.postbuildStep != null) {
+ postbuildStep = new String(cloneConfig.postbuildStep);
+ }
+ if (cloneConfig.preannouncebuildStep != null) {
+ preannouncebuildStep = new String(cloneConfig.preannouncebuildStep);
+ }
+ if (cloneConfig.postannouncebuildStep != null) {
+ postannouncebuildStep = new String( cloneConfig.postannouncebuildStep);
+ }
// Clone the configuration's children
- // Tool Chain
+ // Tool Chain
int nnn = ManagedBuildManager.getRandomNumber();
String subId;
String subName;
@@ -316,6 +332,14 @@ public class Configuration extends BuildObject implements IConfiguration {
// Get the clean command
cleanCommand = element.getAttribute(CLEAN_COMMAND);
+
+ // Get the pre-build and post-build commands
+ prebuildStep = element.getAttribute(PREBUILD_STEP);
+ postbuildStep = element.getAttribute(POSTBUILD_STEP);
+
+ // Get the pre-build and post-build announcements
+ preannouncebuildStep = element.getAttribute(PREANNOUNCEBUILD_STEP);
+ postannouncebuildStep = element.getAttribute(POSTANNOUNCEBUILD_STEP);
}
/* (non-Javadoc)
@@ -362,6 +386,25 @@ public class Configuration extends BuildObject implements IConfiguration {
if (element.hasAttribute(CLEAN_COMMAND)) {
cleanCommand = element.getAttribute(CLEAN_COMMAND);
}
+
+ // Get the pre-build and post-build commands
+ if (element.hasAttribute(PREBUILD_STEP)) {
+ prebuildStep = element.getAttribute(PREBUILD_STEP);
+ }
+
+ if (element.hasAttribute(POSTBUILD_STEP)) {
+ postbuildStep = element.getAttribute(POSTBUILD_STEP);
+ }
+
+ // Get the pre-build and post-build announcements
+ if (element.hasAttribute(PREANNOUNCEBUILD_STEP)) {
+ preannouncebuildStep = element.getAttribute(PREANNOUNCEBUILD_STEP);
+ }
+
+ if (element.hasAttribute(POSTANNOUNCEBUILD_STEP)) {
+ postannouncebuildStep = element
+ .getAttribute(POSTANNOUNCEBUILD_STEP);
+ }
}
/**
@@ -390,7 +433,19 @@ public class Configuration extends BuildObject implements IConfiguration {
if (cleanCommand != null)
element.setAttribute(CLEAN_COMMAND, cleanCommand);
-
+
+ if (prebuildStep != null)
+ element.setAttribute(PREBUILD_STEP, prebuildStep);
+
+ if (postbuildStep != null)
+ element.setAttribute(POSTBUILD_STEP, postbuildStep);
+
+ if (preannouncebuildStep != null)
+ element.setAttribute(PREANNOUNCEBUILD_STEP, preannouncebuildStep);
+
+ if (postannouncebuildStep != null)
+ element.setAttribute(POSTANNOUNCEBUILD_STEP, postannouncebuildStep);
+
// Serialize my children
Element toolChainElement = doc.createElement(IToolChain.TOOL_CHAIN_ELEMENT_NAME);
element.appendChild(toolChainElement);
@@ -783,7 +838,85 @@ public class Configuration extends BuildObject implements IConfiguration {
return new String("make"); //$NON-NLS-1$
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.cdt.core.build.managed.IConfiguration#getPrebuildStep()
+ */
+ public String getPrebuildStep() {
+ if (prebuildStep == null) {
+ // If I have a parent, ask it
+ if (parent != null) {
+ return parent.getPrebuildStep();
+ } else {
+ // I'm it
+ return EMPTY_STRING;
+ }
+ } else {
+ return prebuildStep;
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.cdt.core.build.managed.IConfiguration#getPostbuildStep()
+ */
+ public String getPostbuildStep() {
+ if (postbuildStep == null) {
+ // If I have a parent, ask it
+ if (parent != null) {
+ return parent.getPostbuildStep();
+ } else {
+ // I'm it
+ return EMPTY_STRING;
+ }
+ } else {
+ return postbuildStep;
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.cdt.core.build.managed.IConfiguration#getPreannouncebuildStep()
+ */
+ public String getPreannouncebuildStep() {
+ if (preannouncebuildStep == null) {
+ // If I have a parent, ask it
+ if (parent != null) {
+ return parent.getPreannouncebuildStep();
+ } else {
+ // I'm it
+ return EMPTY_STRING;
+ }
+ } else {
+ return preannouncebuildStep;
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.cdt.core.build.managed.IConfiguration#getPostannouncebuildStep()
+ */
+ public String getPostannouncebuildStep() {
+ if (postannouncebuildStep == null) {
+ // If I have a parent, ask it
+ if (parent != null) {
+ return parent.getPostannouncebuildStep();
+ } else {
+ // I'm it
+ return EMPTY_STRING;
+ }
+ } else {
+ return postannouncebuildStep;
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.cdt.core.build.managed.IConfiguration#getCleanCommand()
*/
public String getCleanCommand() {
@@ -805,7 +938,9 @@ public class Configuration extends BuildObject implements IConfiguration {
}
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.cdt.managedbuilder.core.IConfiguration#getErrorParserIds()
*/
public String getErrorParserIds() {
@@ -817,7 +952,8 @@ public class Configuration extends BuildObject implements IConfiguration {
if (parent != null) {
errorParsers = parent.getErrorParserIds();
}
- // If no error parsers are specified by the configuration, the default is
+ // If no error parsers are specified by the configuration, the default
+ // is
// the error parsers from the tool-chain
if (errorParsers == null && toolChain != null) {
errorParsers = toolChain.getErrorParserIds(this);
@@ -928,8 +1064,66 @@ public class Configuration extends BuildObject implements IConfiguration {
}
builder.setCommand(command);
}
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.build.managed.IConfiguration#setPrebuildStep(java.lang.String)
+ */
+ public void setPrebuildStep(String step) {
+ if (step == null && prebuildStep == null) return;
+ if (prebuildStep == null || step == null || !prebuildStep.equals(step)) {
+ prebuildStep = step;
+ setRebuildState(true);
+ isDirty = true;
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.build.managed.IConfiguration#setPostbuildStep(java.lang.String)
+ */
+ public void setPostbuildStep(String step) {
+ if (step == null && postbuildStep == null) return;
+ if (postbuildStep == null || step == null || !postbuildStep.equals(step)) {
+ postbuildStep = step;
+ setRebuildState(true);
+ isDirty = true;
+ }
+ }
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.build.managed.IConfiguration#setPreannouncebuildStep(java.lang.String)
+ */
+ public void setPreannouncebuildStep(String announceStep) {
+ if (announceStep == null && preannouncebuildStep == null) return;
+ if (preannouncebuildStep == null || announceStep == null || !preannouncebuildStep.equals(announceStep)) {
+ preannouncebuildStep = announceStep;
+ setRebuildState(true);
+ isDirty = true;
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.build.managed.IConfiguration#setPostannouncebuildStep(java.lang.String)
+ */
+ public void setPostannouncebuildStep(String announceStep) {
+ if (announceStep == null && postannouncebuildStep == null) return;
+ if (postannouncebuildStep == null || announceStep == null || !postannouncebuildStep.equals(announceStep)) {
+ postannouncebuildStep = announceStep;
+ setRebuildState(true);
+ isDirty = true;
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.managedbuilder.core.IConfiguration#isSupported()
+ */
+ public boolean isSupported(){
+ IToolChain toolChain = getToolChain();
+ if(toolChain != null)
+ return toolChain.isSupported();
+ return false;
+ }
+
/*
* O B J E C T S T A T E M A I N T E N A N C E
*/
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 97e39ebfe2..9bc11868d8 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,2005 IBM Corporation and others.
+ * Copyright (c) 2002, 2005 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v0.5
* which accompanies this distribution, and is available at
@@ -29,6 +29,7 @@ import org.eclipse.cdt.core.IMarkerGenerator;
import org.eclipse.cdt.core.model.ICModelMarker;
import org.eclipse.cdt.core.resources.ACBuilder;
import org.eclipse.cdt.core.resources.IConsole;
+import org.eclipse.cdt.managedbuilder.core.IConfiguration;
import org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo;
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
import org.eclipse.cdt.managedbuilder.makegen.IManagedBuilderMakefileGenerator;
@@ -166,6 +167,7 @@ public class GeneratedMakefileBuilder extends ACBuilder {
private static final String TYPE_CLEAN = "ManagedMakeBuilder.type.clean"; //$NON-NLS-1$
private static final String TYPE_FULL = "ManagedMakeBuilder.type.full"; //$NON-NLS-1$
private static final String TYPE_INC = "ManagedMakeBuider.type.incremental"; //$NON-NLS-1$
+ private static final String WARNING_UNSUPPORTED_CONFIGURATION = "ManagedMakeBuilder.warning.unsupported.configuration"; //$NON-NLS-1$
public static boolean VERBOSE = false;
// Local variables
@@ -431,6 +433,7 @@ public class GeneratedMakefileBuilder extends ACBuilder {
/* (non-javadoc)
* Answers an array of strings with the proper make targets
+ * for a build with no custom prebuild/postbuild steps
*
* @param fullBuild
* @return
@@ -541,9 +544,10 @@ public class GeneratedMakefileBuilder extends ACBuilder {
}
/* (non-Javadoc)
- * @param fullBuild
+ * @param buildType
* @param buildDir
* @param info
+ * @param generator
* @param monitor
*/
protected void invokeMake(int buildType, IPath buildDir, IManagedBuildInfo info, IManagedBuilderMakefileGenerator generator, IProgressMonitor monitor) {
@@ -601,23 +605,18 @@ public class GeneratedMakefileBuilder extends ACBuilder {
buf.append(ManagedMakeMessages.getFormattedString(CONSOLE_HEADER, consoleHeader));
buf.append(System.getProperty("line.separator", "\n")); //$NON-NLS-1$ //$NON-NLS-2$
buf.append(System.getProperty("line.separator", "\n")); //$NON-NLS-1$ //$NON-NLS-2$
+
+ IConfiguration cfg = info.getDefaultConfiguration();
+ if(!cfg.isSupported()){
+ buf.append(ManagedMakeMessages.getFormattedString(WARNING_UNSUPPORTED_CONFIGURATION,new String[] {cfg.getName(),cfg.getToolChain().getName()}));
+ buf.append(System.getProperty("line.separator", "\n")); //$NON-NLS-1$ //$NON-NLS-2$
+ buf.append(System.getProperty("line.separator", "\n")); //$NON-NLS-1$ //$NON-NLS-2$
+ }
consoleOutStream.write(buf.toString().getBytes());
consoleOutStream.flush();
// Remove all markers for this project
removeAllMarkers(currentProject);
-
- // Get the arguments to be passed to make from build model
- ArrayList makeArgs = new ArrayList();
- 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]);
- }
- }
- makeArgs.addAll(Arrays.asList(getMakeTargets(buildType)));
- String[] makeTargets = (String[]) makeArgs.toArray(new String[makeArgs.size()]);
// Get a launcher for the make command
String errMsg = null;
@@ -646,58 +645,173 @@ public class GeneratedMakefileBuilder extends ACBuilder {
OutputStream stdout = epm.getOutputStream();
OutputStream stderr = epm.getOutputStream();
- // Launch make
- Process proc = launcher.execute(makeCommand, makeTargets, env, workingDirectory);
- if (proc != null) {
- try {
- // Close the input of the process since we will never write to it
- proc.getOutputStream().close();
- } catch (IOException e) {
+ // Get the arguments to be passed to make from build model
+ ArrayList makeArgs = new ArrayList();
+ 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]);
}
-
- if (launcher.waitAndRead(stdout, stderr, new SubProgressMonitor(monitor, IProgressMonitor.UNKNOWN)) != CommandLauncher.OK) {
- errMsg = launcher.getErrorMessage();
+ }
+
+ String[] makeTargets;
+ String prebuildStep = info.getPrebuildStep();
+ boolean prebuildStepPresent = (prebuildStep.length() > 0);
+ Process proc = null;
+ boolean isuptodate = false;
+
+ if (prebuildStepPresent) {
+ ArrayList premakeArgs = (ArrayList) 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
+ boolean quit = false;
+ premakeArgs.add("-q"); //$NON-NLS-1$
+ premakeArgs.add("main-build"); //$NON-NLS-1$
+ premakeTargets = (String[]) premakeArgs
+ .toArray(new String[premakeArgs.size()]);
+ proc = launcher.execute(makeCommand, premakeTargets,
+ env, workingDirectory);
+ 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(stdout, stderr,
+ new SubProgressMonitor(monitor,
+ IProgressMonitor.UNKNOWN)) != CommandLauncher.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.append(uptodateMsg);
+ buf.append(System.getProperty(
+ "line.separator", "\n")); //$NON-NLS-1$//$NON-NLS-2$
+ // Write message on the console
+ consoleOutStream.write(buf.toString()
+ .getBytes());
+ consoleOutStream.flush();
+ consoleOutStream.close();
+ stdout.close();
+ stderr.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;
}
-
- // 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);
- } catch (CoreException e) {
- monitor.subTask(ManagedMakeMessages.getResourceString(REFRESH_ERROR));
+ 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 {
- 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);
- buf.append(System.getProperty("line.separator", "\n")); //$NON-NLS-1$//$NON-NLS-2$
- 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);
- buf.append(System.getProperty("line.separator", "\n")); //$NON-NLS-1$//$NON-NLS-2$
+ // No prebuild step
+ //
+ makeArgs.addAll(Arrays.asList(getMakeTargets(buildType)));
}
- // Write message on the console
- consoleOutStream.write(buf.toString().getBytes());
- consoleOutStream.flush();
- stdout.close();
- stderr.close();
-
- // Generate any error markers that the build has discovered
- monitor.subTask(ManagedMakeMessages.getResourceString(MARKERS));
- addBuilderMarkers(epm);
- epm.reportProblems();
- consoleOutStream.close();
- }
+ makeTargets = (String[]) makeArgs.toArray(new String[makeArgs
+ .size()]);
+
+ // Launch make - main invocation
+ if (!isuptodate) {
+ proc = launcher.execute(makeCommand, makeTargets, env,
+ workingDirectory);
+ 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(stdout, stderr,
+ new SubProgressMonitor(monitor,
+ IProgressMonitor.UNKNOWN)) != CommandLauncher.OK) {
+ errMsg = launcher.getErrorMessage();
+ }
+
+ // 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);
+ } 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);
+ buf.append(System.getProperty("line.separator", "\n")); //$NON-NLS-1$//$NON-NLS-2$
+ 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);
+ buf.append(System.getProperty("line.separator", "\n")); //$NON-NLS-1$//$NON-NLS-2$
+ }
+
+ // Write message on the console
+ consoleOutStream.write(buf.toString().getBytes());
+ consoleOutStream.flush();
+ stdout.close();
+ stderr.close();
+
+ // Generate any error markers that the build has discovered
+ monitor.subTask(ManagedMakeMessages
+ .getResourceString(MARKERS));
+ addBuilderMarkers(epm);
+ epm.reportProblems();
+ consoleOutStream.close();
+ }
+ }
} catch (Exception e) {
forgetLastBuiltState();
} finally {
diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/ManagedBuildInfo.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/ManagedBuildInfo.java
index bc3f4046fb..5399625505 100644
--- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/ManagedBuildInfo.java
+++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/ManagedBuildInfo.java
@@ -1,5 +1,5 @@
/**********************************************************************
- * Copyright (c) 2002,2005 IBM Software Corporation and others.
+ * Copyright (c) 2002, 2005 IBM Software Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v0.5
* which accompanies this distribution, and is available at
@@ -240,7 +240,14 @@ public class ManagedBuildInfo implements IManagedBuildInfo, IScannerInfo {
}
if (defaultConfig == null) {
IConfiguration[] configs = managedProject.getConfigurations();
- if (configs.length > 0) {
+ for (int i = 0; i < configs.length; i++){
+ if (configs[i].isSupported()){
+ defaultConfig = configs[i];
+ defaultConfigId = defaultConfig.getId();
+ break;
+ }
+ }
+ if (defaultConfig == null && configs.length > 0) {
defaultConfig = configs[0];
defaultConfigId = defaultConfig.getId();
}
@@ -514,7 +521,69 @@ public class ManagedBuildInfo implements IManagedBuildInfo, IScannerInfo {
return EMPTY_STRING;
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.cdt.core.build.managed.IManagedBuildInfo#getPrebuildStep()
+ */
+ public String getPrebuildStep() {
+ // Get the default configuration and use its value
+ String name = new String();
+ IConfiguration config = getDefaultConfiguration();
+ if (config != null) {
+ name = config.getPrebuildStep();
+ }
+ return name;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.cdt.core.build.managed.IManagedBuildInfo#getPostbuildStep()
+ */
+ public String getPostbuildStep() {
+ // Get the default configuration and use its value
+ String name = new String();
+ IConfiguration config = getDefaultConfiguration();
+ if (config != null) {
+ name = config.getPostbuildStep();
+ }
+ return name;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.cdt.core.build.managed.IManagedBuildInfo#getPreannouncebuildStep()
+ */
+ public String getPreannouncebuildStep() {
+ // Get the default configuration and use its value
+ String name = new String();
+ IConfiguration config = getDefaultConfiguration();
+ if (config != null) {
+ name = config.getPreannouncebuildStep();
+ }
+ return name;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.cdt.core.build.managed.IManagedBuildInfo#getPostannouncebuildStep()
+ */
+ public String getPostannouncebuildStep() {
+ // Get the default configuration and use its value
+ String name = new String();
+ IConfiguration config = getDefaultConfiguration();
+ if (config != null) {
+ name = config.getPostannouncebuildStep();
+ }
+ return name;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.cdt.core.build.managed.IManagedBuildInfo#getOutputExtension(java.lang.String)
*/
public String getOutputExtension(String resourceExtension) {
@@ -530,7 +599,9 @@ public class ManagedBuildInfo implements IManagedBuildInfo, IScannerInfo {
return null;
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see org.eclipse.cdt.core.build.managed.IManagedBuildInfo#getOutputFlag()
*/
public String getOutputFlag(String outputExt) {
diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/PluginResources.properties b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/PluginResources.properties
index 114d4f610e..1aff3c3244 100644
--- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/PluginResources.properties
+++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/PluginResources.properties
@@ -1,5 +1,5 @@
##########################################################################
-# Copyright (c) 2002,2003 Rational Software Corporation and others.
+# Copyright (c) 2002, 2005 Rational Software Corporation and others.
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Common Public License v0.5
# which accompanies this distribution, and is available at
@@ -29,6 +29,7 @@ ManagedMakeBuilder.message.clean.build.clean=Trying a make clean in {0}
ManagedMakeBuilder.type.clean = Clean-only build
ManagedMakeBuilder.type.full = Full rebuild
ManagedMakeBuider.type.incremental = Incremental build
+ManagedMakeBuilder.warning.unsupported.configuration=**** WARNING: The "{0}" Configuration may not build ****\n**** because it uses the "{1}" ****\n**** tool-chain that is unsupported on this system. ****\n\n**** Attempting to build... ****
# Option exception messages
Option.error.bad_value_type=Bad value for type
diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/ProjectType.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/ProjectType.java
index 31606b691d..0fcbbe7b83 100644
--- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/ProjectType.java
+++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/ProjectType.java
@@ -1,5 +1,5 @@
/**********************************************************************
- * Copyright (c) 2004 Intel Corporation and others.
+ * Copyright (c) 2004, 2005 Intel Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
@@ -338,4 +338,16 @@ public class ProjectType extends BuildObject implements IProjectType {
}
}
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.build.managed.IProjectType#isSupported()
+ */
+ public boolean isSupported(){
+ Iterator configIter = getConfigurationList().iterator();
+ while (configIter.hasNext()) {
+ Configuration current = (Configuration)configIter.next();
+ if(current.isSupported())
+ return true;
+ }
+ return false;
+ }
}
diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Target.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Target.java
index 60ab3ef96c..ef6de8ee68 100644
--- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Target.java
+++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Target.java
@@ -1,5 +1,5 @@
/**********************************************************************
- * Copyright (c) 2003,2004 IBM Corporation and others.
+ * Copyright (c) 2003, 2005 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
@@ -1034,7 +1034,7 @@ public class Target extends BuildObject implements ITarget {
targetPlatform.setIsAbstract(isAbstract);
targetPlatform.setOSList(getTargetOSList());
targetPlatform.setArchList(getTargetArchList());
- targetPlatform.setBinaryParserId(getBinaryParserId());
+ targetPlatform.setBinaryParserList(new String[]{getBinaryParserId()}); // Older projects will always have only one binary parser set.
// Handle ConfigurationV2 children (ToolReference)
// The tools references fetched here are strictly local to the configuration,
diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/TargetPlatform.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/TargetPlatform.java
index f8813e5ef4..f08985fca5 100644
--- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/TargetPlatform.java
+++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/TargetPlatform.java
@@ -1,5 +1,5 @@
/**********************************************************************
- * Copyright (c) 2004 Intel Corporation and others.
+ * Copyright (c) 2004, 2005 Intel Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
@@ -38,7 +38,7 @@ public class TargetPlatform extends BuildObject implements ITargetPlatform {
private Boolean isAbstract;
private List osList;
private List archList;
- private String binaryParserId;
+ private List binaryParserList;
// Miscellaneous
private boolean isExtensionTargetPlatform = false;
private boolean isDirty = false;
@@ -146,8 +146,8 @@ public class TargetPlatform extends BuildObject implements ITargetPlatform {
if (targetPlatform.archList != null) {
archList = new ArrayList(targetPlatform.archList);
}
- if (targetPlatform.binaryParserId != null) {
- binaryParserId = new String(targetPlatform.binaryParserId);
+ if (targetPlatform.binaryParserList != null) {
+ binaryParserList = new ArrayList(targetPlatform.binaryParserList);
}
setDirty(true);
@@ -204,8 +204,15 @@ public class TargetPlatform extends BuildObject implements ITargetPlatform {
}
}
- // Get the ID of the binary parser
- binaryParserId = element.getAttribute(BINARY_PARSER);
+ // Get the IDs of the binary parsers from a semi-colon-separated list.
+ String bpars = element.getAttribute(BINARY_PARSER);
+ if (bpars != null) {
+ binaryParserList = new ArrayList();
+ String[] bparsTokens = bpars.split(";"); //$NON-NLS-1$
+ for (int j = 0; j < bparsTokens.length; ++j) {
+ binaryParserList.add(bparsTokens[j].trim());
+ }
+ }
}
/* (non-Javadoc)
@@ -270,9 +277,16 @@ public class TargetPlatform extends BuildObject implements ITargetPlatform {
}
}
- // binaryParserId
+ // Get the semi-colon-separated list of binaryParserIds
if (element.hasAttribute(BINARY_PARSER)) {
- binaryParserId = element.getAttribute(BINARY_PARSER);
+ String bpars = element.getAttribute(BINARY_PARSER);
+ if (bpars != null) {
+ binaryParserList = new ArrayList();
+ String[] bparsTokens = bpars.split(";"); //$NON-NLS-1$
+ for (int j = 0; j < bparsTokens.length; ++j) {
+ binaryParserList.add(bparsTokens[j].trim());
+ }
+ }
}
}
@@ -301,8 +315,17 @@ public class TargetPlatform extends BuildObject implements ITargetPlatform {
element.setAttribute(IProjectType.IS_ABSTRACT, isAbstract.toString());
}
- if (binaryParserId != null) {
- element.setAttribute(BINARY_PARSER, binaryParserId);
+ if (binaryParserList != null) {
+ Iterator bparsIter = binaryParserList.listIterator();
+ String listValue = EMPTY_STRING;
+ while (bparsIter.hasNext()) {
+ String current = (String) bparsIter.next();
+ listValue += current;
+ if ((bparsIter.hasNext())) {
+ listValue += ";"; //$NON-NLS-1$
+ }
+ }
+ element.setAttribute(BINARY_PARSER, listValue);
}
if (osList != null) {
@@ -386,18 +409,28 @@ public class TargetPlatform extends BuildObject implements ITargetPlatform {
}
/* (non-Javadoc)
- * @see org.eclipse.cdt.core.build.managed.ITargetPlatform#getBinaryParserI()
+ * @see org.eclipse.cdt.core.build.managed.ITargetPlatform#getBinaryParserId()
+ * @deprecated
*/
public String getBinaryParserId() {
- if (binaryParserId == null) {
+ String[] ids = getBinaryParserList();
+ if (ids.length > 0) return ids[0];
+ return EMPTY_STRING;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.build.managed.ITargetPlatform#getBinaryParserList()
+ */
+ public String[] getBinaryParserList() {
+ if (binaryParserList == null) {
// If I have a superClass, ask it
if (superClass != null) {
- return superClass.getBinaryParserId();
+ return superClass.getBinaryParserList();
} else {
- return EMPTY_STRING;
+ return new String[0];
}
}
- return binaryParserId;
+ return (String[]) binaryParserList.toArray(new String[binaryParserList.size()]);
}
/* (non-Javadoc)
@@ -434,13 +467,26 @@ public class TargetPlatform extends BuildObject implements ITargetPlatform {
/* (non-Javadoc)
* @see org.eclipse.cdt.core.build.managed.IBuilder#setBinaryParserId(String)
+ * @deprecated
*/
public void setBinaryParserId(String id) {
- if (id == null && binaryParserId == null) return;
- if (binaryParserId == null || id == null || !id.equals(binaryParserId)) {
- binaryParserId = id;
- setDirty(true);
+ String[] ids = new String[]{id};
+ setBinaryParserList(ids);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.build.managed.IBuilder#setBinaryParserList(String[])
+ */
+ public void setBinaryParserList(String[] ids) {
+ if (binaryParserList == null) {
+ binaryParserList = new ArrayList();
+ } else {
+ binaryParserList.clear();
}
+ for (int i = 0; i < ids.length; i++) {
+ binaryParserList.add(ids[i]);
+ }
+ setDirty(true);
}
/* (non-Javadoc)
diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/ToolChain.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/ToolChain.java
index bbc4139107..0316d3c144 100644
--- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/ToolChain.java
+++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/ToolChain.java
@@ -1,5 +1,5 @@
/**********************************************************************
- * Copyright (c) 2004 Intel Corporation and others.
+ * Copyright (c) 2004, 2005 Intel Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
@@ -21,11 +21,14 @@ import org.eclipse.cdt.managedbuilder.core.IBuildObject;
import org.eclipse.cdt.managedbuilder.core.IBuilder;
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
import org.eclipse.cdt.managedbuilder.core.IManagedConfigElement;
+import org.eclipse.cdt.managedbuilder.core.IManagedIsToolChainSupported;
import org.eclipse.cdt.managedbuilder.core.IProjectType;
import org.eclipse.cdt.managedbuilder.core.ITargetPlatform;
import org.eclipse.cdt.managedbuilder.core.ITool;
import org.eclipse.cdt.managedbuilder.core.IToolChain;
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
@@ -51,6 +54,8 @@ public class ToolChain extends BuildObject implements IToolChain {
private List archList;
private Boolean isAbstract;
private String scannerConfigDiscoveryProfileId;
+ private IConfigurationElement managedIsToolChainSupportedElement = null;
+ private IManagedIsToolChainSupported managedIsToolChainSupported = null;
// Miscellaneous
private boolean isExtensionToolChain = false;
private boolean isDirty = false;
@@ -208,6 +213,8 @@ public class ToolChain extends BuildObject implements IToolChain {
if (toolChain.scannerConfigDiscoveryProfileId != null) {
scannerConfigDiscoveryProfileId = new String(toolChain.scannerConfigDiscoveryProfileId);
}
+ managedIsToolChainSupportedElement = toolChain.managedIsToolChainSupportedElement;
+ managedIsToolChainSupported = toolChain.managedIsToolChainSupported;
// Clone the children
if (toolChain.builder != null) {
@@ -314,6 +321,12 @@ public class ToolChain extends BuildObject implements IToolChain {
archList.add(archTokens[j].trim());
}
}
+
+ // Get the isToolchainSupported configuration element
+ String managedIsToolChainSupported = element.getAttribute(IS_TOOL_CHAIN_SUPPORTED);
+ if (managedIsToolChainSupported != null && element instanceof DefaultManagedConfigElement) {
+ managedIsToolChainSupportedElement = ((DefaultManagedConfigElement)element).getConfigurationElement();
+ }
}
/* (non-Javadoc)
@@ -467,6 +480,12 @@ public class ToolChain extends BuildObject implements IToolChain {
tool.serialize(doc, toolElement);
}
+ // Note: isToolChainSupported cannot be specified in a project file because
+ // an IConfigurationElement is needed to load it!
+ if (managedIsToolChainSupportedElement != null) {
+ // TODO: issue warning?
+ }
+
// I am clean now
isDirty = false;
}
@@ -974,4 +993,33 @@ public class ToolChain extends BuildObject implements IToolChain {
}
}
+ private IManagedIsToolChainSupported getIsToolChainSupported(){
+ if(managedIsToolChainSupported == null && managedIsToolChainSupportedElement != null){
+ try{
+ if(managedIsToolChainSupportedElement.getAttribute(IS_TOOL_CHAIN_SUPPORTED) != null)
+ managedIsToolChainSupported =
+ (IManagedIsToolChainSupported)managedIsToolChainSupportedElement.createExecutableExtension(IS_TOOL_CHAIN_SUPPORTED);
+
+ }
+ catch(CoreException e){
+ }
+ }
+ return managedIsToolChainSupported;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.managedbuilder.core.IToolChain#isSupported()
+ */
+ public boolean isSupported(){
+ IManagedIsToolChainSupported isSupported = getIsToolChainSupported();
+ if(isSupported != null){
+ //TODO: pass the version to the "isSupported" method
+ return isSupported.isSupported(this,null,null);
+ }
+ else if(superClass != null)
+ return superClass.isSupported();
+ else
+ return true;
+ }
+
}
diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/makegen/IManagedBuilderMakefileGenerator.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/makegen/IManagedBuilderMakefileGenerator.java
index bb9a222935..98d80cb1dc 100644
--- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/makegen/IManagedBuilderMakefileGenerator.java
+++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/makegen/IManagedBuilderMakefileGenerator.java
@@ -1,5 +1,5 @@
/**********************************************************************
- * Copyright (c) 2004 IBM Corporation and others.
+ * Copyright (c) 2004, 2005 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
@@ -28,9 +28,11 @@ public interface IManagedBuilderMakefileGenerator {
public final String COLON = ":"; //$NON-NLS-1$
public final int COLS_PER_LINE = 80;
public final String COMMENT_SYMBOL = "#"; //$NON-NLS-1$
+ public final String DOLLAR_SYMBOL = "$"; //$NON-NLS-1$
public final String DEP_EXT = "d"; //$NON-NLS-1$
public final String DEPFILE_NAME = "subdir.dep"; //$NON-NLS-1$
public final String DOT = "."; //$NON-NLS-1$
+ public final String DASH = "-"; //$NON-NLS-1$
public final String ECHO = "echo"; //$NON-NLS-1$
public final String IN_MACRO = "$<"; //$NON-NLS-1$
public final String LINEBREAK = "\\\n"; //$NON-NLS-1$
@@ -39,6 +41,8 @@ public interface IManagedBuilderMakefileGenerator {
public final String MAKEFILE_INIT = "makefile.init"; //$NON-NLS-1$
public final String MAKEFILE_NAME = "makefile"; //$NON-NLS-1$
public final String MAKEFILE_TARGETS = "makefile.targets"; //$NON-NLS-1$
+ public final String MAKE = "$(MAKE)"; //$NON-NLS-1$
+ public final String NO_PRINT_DIR = "--no-print-directory"; //$NON-NLS-1$
public final String MODFILE_NAME = "subdir.mk"; //$NON-NLS-1$
public final String NEWLINE = System.getProperty("line.separator"); //$NON-NLS-1$
diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/makegen/gnu/GnuMakefileGenerator.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/makegen/gnu/GnuMakefileGenerator.java
index 09c975a22a..6fed9f1026 100644
--- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/makegen/gnu/GnuMakefileGenerator.java
+++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/makegen/gnu/GnuMakefileGenerator.java
@@ -1,5 +1,5 @@
/**********************************************************************
- * Copyright (c) 2003,2005 IBM Corporation and others.
+ * Copyright (c) 2003, 2005 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v0.5
* which accompanies this distribution, and is available at
@@ -601,6 +601,15 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator {
String flags = info.getFlagsForConfiguration(extension);
String outflag = info.getOutputFlag(extension);
String outputPrefix = info.getOutputPrefix(extension);
+ String prebuildStep = info.getPrebuildStep();
+ prebuildStep.trim(); // Remove leading and trailing whitespace (and control characters)
+ String postbuildStep = info.getPostbuildStep();
+ postbuildStep.trim(); // Remove leading and trailing whitespace (and control characters)
+ String preannouncebuildStep = info.getPreannouncebuildStep();
+ String postannouncebuildStep = info.getPostannouncebuildStep();
+ String prebuild = "pre-build"; //$NON-NLS-1$
+ String mainbuild = "main-build"; //$NON-NLS-1$
+ String postbuild = "post-build"; //$NON-NLS-1$
String targets = rebuild ? "clean all" : "all"; //$NON-NLS-1$ //$NON-NLS-2$
// Get all the projects the build target depends on
@@ -612,9 +621,32 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator {
// and neither conditions apply if we are building for it ....
}
- // Write out the all target first in case someone just runs make
- // all: targ_<target_name>
+ // If a prebuild step exists, redefine the all target to be
+ // all: {pre-build} main-build
+ // and then reset the "traditional" all target to main-build
+ // This will allow something meaningful to happen if the generated
+ // makefile is
+ // extracted and run standalone via "make all"
+ //
String defaultTarget = "all:"; //$NON-NLS-1$
+ if (prebuildStep.length() > 0) {
+
+ buffer.append(defaultTarget + WHITESPACE);
+ buffer.append(prebuild + WHITESPACE);
+
+ // Reset defaultTarget for now and for subsequent use, below
+ defaultTarget = mainbuild;
+ buffer.append(defaultTarget);
+
+ // Update the defaultTarget, main-build, by adding a colon, which is
+ // needed below
+ defaultTarget = defaultTarget.concat(COLON);
+ buffer.append(NEWLINE + NEWLINE);
+ }
+
+ // Write out the all target first in case someone just runs make
+ // all: <target_name> or mainbuild: <target_name>
+
buffer.append(defaultTarget + WHITESPACE + outputPrefix + buildTargetName);
if (extension.length() > 0) {
buffer.append(DOT + extension);
@@ -622,10 +654,9 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator {
buffer.append(NEWLINE + NEWLINE);
/*
- * The build target may depend on other projects in the workspace. These are
- * captured in the deps target:
- * deps:
- * <cd <Proj_Dep_1/build_dir>; $(MAKE) [clean all | all]>
+ * The build target may depend on other projects in the workspace. These
+ * are captured in the deps target: deps: <cd <Proj_Dep_1/build_dir>;
+ * $(MAKE) [clean all | all]>
*/
Vector managedProjectOutputs = new Vector(refdProjects.length);
if (refdProjects.length > 0) {
@@ -671,7 +702,7 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator {
* @echo 'Building target: $@'
* $(BUILD_TOOL) $(FLAGS) $(OUTPUT_FLAG)$@ $(OBJS) $(USER_OBJS) $(LIB_DEPS)
* @echo 'Finished building: $@'
- * @echo
+ * $(MAKE) --no-print-directory post-build //if postbuild step present
*/
buffer.append(outputPrefix + buildTargetName);
if (extension.length() > 0) {
@@ -685,18 +716,65 @@ public class GnuMakefileGenerator implements IManagedBuilderMakefileGenerator {
buffer.append(NEWLINE);
buffer.append(TAB + AT + ECHO + WHITESPACE + SINGLE_QUOTE + MESSAGE_START_BUILD + WHITESPACE + OUT_MACRO + SINGLE_QUOTE + NEWLINE);
buffer.append(TAB + cmd + WHITESPACE + flags + WHITESPACE + outflag + WHITESPACE + OUT_MACRO + WHITESPACE + "$(OBJS) $(USER_OBJS) $(LIBS)" + NEWLINE); //$NON-NLS-1$
- buffer.append(TAB + AT + ECHO + WHITESPACE + SINGLE_QUOTE + MESSAGE_FINISH_FILE + WHITESPACE + OUT_MACRO + SINGLE_QUOTE + NEWLINE + NEWLINE);
+ buffer.append(TAB + AT + ECHO + WHITESPACE + SINGLE_QUOTE + MESSAGE_FINISH_FILE + WHITESPACE + OUT_MACRO + SINGLE_QUOTE + NEWLINE);
+
+ // If there is a post build step, then add a recursive invocation of MAKE to invoke it after the main build
+ // Note that $(MAKE) will instantiate in the recusive invocation to the make command that was used to invoke
+ // the makefile originally
+ if (postbuildStep.length() > 0) {
+ buffer.append(TAB + AT + ECHO + WHITESPACE + SINGLE_QUOTE + WHITESPACE + SINGLE_QUOTE + NEWLINE);
+ buffer.append(TAB + MAKE + WHITESPACE + NO_PRINT_DIR + WHITESPACE + postbuild + NEWLINE);
+ }
+
+ buffer.append(NEWLINE);
// Always add a clean target
buffer.append("clean:" + NEWLINE); //$NON-NLS-1$
- buffer.append(TAB + "-$(RM)" + WHITESPACE + "$(OBJS)" + WHITESPACE + "$(DEPS)" + WHITESPACE + outputPrefix + buildTargetName); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ buffer.append(TAB
+ + "-$(RM)" + WHITESPACE + "$(OBJS)" + WHITESPACE + "$(DEPS)" //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ + WHITESPACE + outputPrefix + buildTargetName);
if (extension.length() > 0) {
buffer.append(DOT + extension);
}
- buffer.append(NEWLINE + NEWLINE);
-
+ buffer.append(NEWLINE);
+ buffer.append(TAB + DASH + AT + ECHO + WHITESPACE + SINGLE_QUOTE
+ + WHITESPACE + SINGLE_QUOTE + NEWLINE + NEWLINE);
+
+ // Add the prebuild step target, if specified
+ if (prebuildStep.length() > 0) {
+ buffer.append(prebuild + COLON + NEWLINE);
+ if (preannouncebuildStep.length() > 0) {
+ buffer.append(TAB + DASH + AT + ECHO + WHITESPACE
+ + SINGLE_QUOTE + preannouncebuildStep + SINGLE_QUOTE
+ + NEWLINE);
+ }
+ buffer.append(TAB + DASH + prebuildStep + NEWLINE);
+ buffer.append(TAB + DASH + AT + ECHO + WHITESPACE + SINGLE_QUOTE
+ + WHITESPACE + SINGLE_QUOTE + NEWLINE + NEWLINE);
+ }
+
+ // Add the postbuild step, if specified
+ if (postbuildStep.length() > 0) {
+ buffer.append(postbuild + COLON + NEWLINE);
+ if (postannouncebuildStep.length() > 0) {
+ buffer.append(TAB + DASH + AT + ECHO + WHITESPACE
+ + SINGLE_QUOTE + postannouncebuildStep + SINGLE_QUOTE
+ + NEWLINE);
+ }
+ buffer.append(TAB + DASH + postbuildStep + NEWLINE);
+ buffer.append(TAB + DASH + AT + ECHO + WHITESPACE + SINGLE_QUOTE
+ + WHITESPACE + SINGLE_QUOTE + NEWLINE + NEWLINE);
+ }
+
// Add all the eneded dummy and phony targets
- buffer.append(".PHONY: all clean dependents" + NEWLINE); //$NON-NLS-1$
+ buffer.append(".PHONY: all clean dependents"); //$NON-NLS-1$
+ if (prebuildStep.length() > 0) {
+ buffer.append(WHITESPACE + mainbuild + WHITESPACE + prebuild);
+ }
+ if (postbuildStep.length() > 0) {
+ buffer.append(WHITESPACE + postbuild);
+ }
+ buffer.append(NEWLINE);
refIter = managedProjectOutputs.listIterator();
while(refIter.hasNext()) {
buffer.append((String)refIter.next() + COLON + NEWLINE);
diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/projectconverter/UpdateManagedProject20.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/projectconverter/UpdateManagedProject20.java
index f39ce9ec3e..26e1d8d78e 100644
--- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/projectconverter/UpdateManagedProject20.java
+++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/projectconverter/UpdateManagedProject20.java
@@ -1,5 +1,5 @@
/**********************************************************************
- * Copyright (c) 2004 Intel Corporation and others.
+ * Copyright (c) 2004, 2005 Intel Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
@@ -244,7 +244,7 @@ class UpdateManagedProject20 {
String builderName = targetPlatform.getName() + "." + newConfig.getName(); //$NON-NLS-1$
toolChain.createTargetPlatform(targetPlatform,subId,builderName,false);
}
- targetPlatform.setBinaryParserId(binaryParser);
+ targetPlatform.setBinaryParserList(new String[]{binaryParser}); // Older projects have only a single binary parser.
}
if(targetEl.hasAttribute(ITarget.MAKE_COMMAND)){

Back to the top