Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cdt-patch] Build Model and UI


Howdy All,
Well this is the big one. Most of the changes have been summarized in the change logs, so please take a look at those. I will be posting a quick set of instructions to cdt-dev.

If you are really in a hurry and want to apply these patches, then be aware that the build UI is restricted to working in Cygwin (because that's the only tool chain I have fully defined) and is only guaranteed to work for an executable. As well, our goal for the first pass was to generate makefiles for simple projects. I have not tested this beyond the HelloWorld level of complexity, nor have I done any end-to-end testing. One final caveat, you must create a new project through the supplied wizard in order for us to generate a makefile. We ignore existing projects (for now).

Rest assured that this is a first iteration only. Based on your feedback and on our own design goals, the build system will evolve quite substantially over the next few months including the UI, the makefile builder, dependency calculation,  and more toolchains.

Sean Evoy
Rational Software - IBM Software Group
Ottawa, Ontario, Canada

Index: ChangeLog
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/ChangeLog,v
retrieving revision 1.97
diff -u -r1.97 ChangeLog
--- ChangeLog	5 Jun 2003 14:15:52 -0000	1.97
+++ ChangeLog	6 Jun 2003 20:05:17 -0000
@@ -1,3 +1,44 @@
+2003-06-06 Sean Evoy
+
+	Added new interface, IResourceBuildInfo, so clients could
+	be shielded from future implementation changes.
+	
+	ManagedBuildManager class has been updated to return an 
+	interface, IResourceBuildInfo, instead of the implementing 
+	class.
+	
+	For ITool, I added a method to determine if the tool produces 
+	an output based on a file extension, and one to determine if
+	it builds an input based on a file extension. I added a method 
+	to determine what the output file extension of a build will 
+	be based on an input extension. Finally, I added a method to 
+	extract a tool command and one to extract its flags.
+	
+	For ITarget, I added more information about the build artifact. 
+	I have added artifact name and default extension attributes to 
+	the target schema. The artifact name is intended to hold the 
+	name the user has selected as the final build object 
+	(i.e. test.exe, foo.so, etc). The default extension will be 
+	used by the toolchain provider to specify a default extension 
+	for the final build object (i.e. .dll.a for Cygwin shared libs 
+	vs .so for Linux shared libs).	There are getter and setter 
+	methods for the name of the final build artifact. There is also a 
+	method to extract the default extension that is built for targets 
+	of this type.
+	
+	The build model schema was updated to reflect these new bit of 
+	information.
+	
+	The GeneratedMakefileBuilder was updated to extract this information
+	and to create a new rule for each input to the build artifact.
+
+ 	The resource build information store now remembers the top 
+	configuration for a target as selected by the user in the UI. 
+	This is needed by the makefile generator and in persisted in the 
+	project build file. 
+	
+	The test has been updated to reflect these changes.
+
 2003-06-05 Alain Magloire
 
 	PR #38380, partially fix; would need more detail form
Index: build/org/eclipse/cdt/core/build/managed/IResourceBuildInfo.java
===================================================================
RCS file: build/org/eclipse/cdt/core/build/managed/IResourceBuildInfo.java
diff -N build/org/eclipse/cdt/core/build/managed/IResourceBuildInfo.java
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ build/org/eclipse/cdt/core/build/managed/IResourceBuildInfo.java	6 Jun 2003 20:05:17 -0000
@@ -0,0 +1,124 @@
+package org.eclipse.cdt.core.build.managed;
+
+import java.util.List;
+
+/**********************************************************************
+ * Copyright (c) 2002,2003 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
+ * http://www.eclipse.org/legal/cpl-v05.html
+ * 
+ * Contributors: 
+ * IBM Rational Software - Initial API and implementation
+***********************************************************************/
+
+public interface IResourceBuildInfo {
+
+	/**
+	 * Add a new target to the build information for the receiver
+	 * 
+	 * @param target
+	 */
+	public void addTarget(ITarget target);
+		
+	/**
+	 * Returns the name of the artifact to build for the receiver.
+	 * 
+	 * @return
+	 */
+	public String getBuildArtifactName();
+
+	/**
+	 * Get the default configuration associated with the receiver
+	 * 
+	 * @return
+	 */
+	public IConfiguration getDefaultConfiguration(ITarget target);
+	
+	
+	/**
+	 * Returns the default target in the receiver.
+	 * 
+	 * @return
+	 */
+	public ITarget getDefaultTarget();
+	
+	/**
+	 * Answers the extension that will be built by the current configuration
+	 * for the extension passed in the argument or <code>null</code>.
+	 * 
+	 * @param resourceName
+	 * @return
+	 */
+	public String getOutputExtension(String resourceExtension);
+	
+	/**
+	 * Get the target specified in the argument.
+	 * 
+	 * @param id
+	 * @return
+	 */
+	public ITarget getTarget(String id);
+	
+	/**
+	 * Get all of the targets associated with the receiver.
+	 * 
+	 * @return
+	 */
+	public List getTargets();
+	
+	/**
+	 * Returns a <code>String</code> containing the flags, including 
+	 * those overridden by the user, for the tool that handles the 
+	 * type of source file defined by the argument.
+	 * 
+	 * @param extension
+	 * @return
+	 */
+	public String getFlagsForSource(String extension);
+
+	/**
+	 * Returns a <code>String</code> containing the flags, including 
+	 * those overridden by the user, for the tool that handles the 
+	 * type of target defined by the argument.
+	 * 
+	 * @param extension
+	 * @return
+	 */
+	public String getFlagsForTarget(String extension);
+
+	/**
+	 * Returns a <code>String</code> containing the command-line invocation 
+	 * for the tool associated with the source extension.
+	 * 
+	 * @param extension
+	 * @return
+	 */
+	public String getToolForSource(String extension);
+
+	/**
+	 * Returns a <code>String</code> containing the command-line invocation 
+	 * for the tool associated with the target extension.
+	 * 
+	 * @param extension
+	 * @return
+	 */
+	public String getToolForTarget(String extension);
+	
+	/**
+	 * Set the primary configuration for the receiver.
+	 * 
+	 * @param configuration The <code>IConfiguration</code> that will be used as the default
+	 * for all building.
+	 */
+	public void setDefaultConfiguration(IConfiguration configuration);
+	
+	/**
+	 * Set the primary target for the receiver.
+	 * 
+	 * @param target
+	 */
+	public void setDefaultTarget(ITarget target);
+	
+}
Index: build/org/eclipse/cdt/core/build/managed/ITarget.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/build/org/eclipse/cdt/core/build/managed/ITarget.java,v
retrieving revision 1.8
diff -u -r1.8 ITarget.java
--- build/org/eclipse/cdt/core/build/managed/ITarget.java	29 May 2003 14:00:58 -0000	1.8
+++ build/org/eclipse/cdt/core/build/managed/ITarget.java	6 Jun 2003 20:05:17 -0000
@@ -19,36 +19,46 @@
 public interface ITarget extends IBuildObject {
 
 	/**
-	 * Returns whether this target is abstract
+	 * Creates a configuration for the target populated with the tools and
+	 * options settings from the parent configuration.  As options and tools
+	 * change in the parent, unoverridden values are updated in the child
+	 * config as well.
+	 * 
+	 * @param parent
+	 * @param id
 	 * @return
 	 */
-	public boolean isAbstract();
-	
+	public IConfiguration createConfiguration(IConfiguration parent, String id);
+
 	/**
-	 * Gets the resource that this target is applied to.
+	 * Creates a new configuration for the target.  It is populated with
+	 * the tools defined for that target and options set at their defaults.
 	 * 
+	 * @param id id for this configuration.
 	 * @return
 	 */
-	public IResource getOwner();
-
+	public IConfiguration createConfiguration(String id);
+	
 	/**
-	 * @return the <code>ITarget</code> that is the parent of the receiver.
+	 * Get the name of the final build artifact.
+	 * 
+	 * @return 
 	 */
-	public ITarget getParent();
+	public String getArtifactName();
 	
 	/**
-	 * Returns the list of platform specific tools associated with this
-	 * platform.
-	 * 
+	 * Returns all of the configurations defined by this target.
 	 * @return
 	 */
-	public ITool[] getTools();
+	public IConfiguration[] getConfigurations();
 
 	/**
-	 * Returns all of the configurations defined by this target.
+	 * Get the default extension that should be applied to build artifacts
+	 * created by this target.
+	 * 
 	 * @return
 	 */
-	public IConfiguration[] getConfigurations();
+	public String getDefaultExtension();	
 
 	/**
 	 * Returns the configuration with the given id, or null if not found.
@@ -59,23 +69,46 @@
 	public IConfiguration getConfiguration(String id);
 	
 	/**
-	 * Creates a new configuration for the target.  It is populated with
-	 * the tools defined for that target and options set at their defaults.
+	 * Gets the resource that this target is applied to.
 	 * 
-	 * @param id id for this configuration.
 	 * @return
 	 */
-	public IConfiguration createConfiguration(String id);
+	public IResource getOwner();
+
+	/**
+	 * @return the <code>ITarget</code> that is the parent of the receiver.
+	 */
+	public ITarget getParent();
 	
 	/**
-	 * Creates a configuration for the target populated with the tools and
-	 * options settings from the parent configuration.  As options and tools
-	 * change in the parent, unoverridden values are updated in the child
-	 * config as well.
+	 * Returns the list of platform specific tools associated with this
+	 * platform.
 	 * 
-	 * @param parent
-	 * @param id
 	 * @return
 	 */
-	public IConfiguration createConfiguration(IConfiguration parent, String id);
+	public ITool[] getTools();
+
+	/**
+	 * Returns whether this target is abstract.
+	 * @return 
+	 */
+	public boolean isAbstract();
+	
+	/**
+	 * Answers <code>true</code> if the receiver is a target that is defined 
+	 * for testing purposes only, else <code>false</code>. A test target will 
+	 * not be shown in the UI but can still be manipulated programmatically.
+	 * 
+	 * @return
+	 */
+	public boolean isTestTarget();
+
+	/**
+	 * Set the name of the artifact that will be produced when the receiver
+	 * is built.
+	 * 
+	 * @param name The name of the build artifact.
+	 */
+	public void setBuildArtifact(String name);
+	
 }
Index: build/org/eclipse/cdt/core/build/managed/ITool.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/build/org/eclipse/cdt/core/build/managed/ITool.java,v
retrieving revision 1.3
diff -u -r1.3 ITool.java
--- build/org/eclipse/cdt/core/build/managed/ITool.java	14 Apr 2003 20:02:38 -0000	1.3
+++ build/org/eclipse/cdt/core/build/managed/ITool.java	6 Jun 2003 20:05:17 -0000
@@ -14,12 +14,24 @@
  * 
  */
 public interface ITool extends IBuildObject {
+	public static final String WHITE_SPACE = " ";
 
 	/**
-	 * Return the target that defines this tool, if applicable
+	 * Return <code>true</code> if the receiver builds files with the
+	 * specified extension, else <code>false</code>.
+	 * 
+	 * @param extension
 	 * @return
 	 */
-	public ITarget getTarget();
+	public boolean buildsFileType(String extension);
+
+	/**
+	 * Get a particular option.
+	 * 
+	 * @param id
+	 * @return
+	 */
+	public IOption getOption(String id);
 	
 	/**
 	 * Returns the options that may be customized for this tool.
@@ -27,12 +39,34 @@
 	public IOption[] getOptions();
 	
 	/**
-	 * Get a particular option.
+	 * Answer the output extension the receiver will create from the input, 
+	 * or <code>null</code> if the tool does not understand that extension.
 	 * 
-	 * @param id
+	 * @param inputExtension The extension of the source file. 
 	 * @return
 	 */
-	public IOption getOption(String id);
+	public String getOutputExtension(String inputExtension);
+	
+	/**
+	 * Return the target that defines this tool, if applicable
+	 * @return
+	 */
+	public ITarget getTarget();
+	
+	/**
+	 * Answers the command-line invocation defined for the receiver.
+	 * 
+	 * @return
+	 */
+	public String getToolCommand();
+	
+	/**
+	 * Answers the additional command line arguments the user has specified for
+	 * the tool.
+	 * 
+	 * @return
+	 */
+	public String getToolFlags() throws BuildException ;
 	
 	/**
 	 * Options are organized into categories for UI purposes.
@@ -42,4 +76,14 @@
 	 * @return
 	 */
 	public IOptionCategory getTopOptionCategory();
+	
+	/**
+	 * Answers <code>true</code> if the receiver builds a file with the extension specified
+	 * in the argument, else <code>false</code>.
+	 * 
+	 * @param outputExtension
+	 * @return
+	 */
+	public boolean producesFileType(String outputExtension);
+	
 }
Index: build/org/eclipse/cdt/core/build/managed/ManagedBuildManager.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/build/org/eclipse/cdt/core/build/managed/ManagedBuildManager.java,v
retrieving revision 1.7
diff -u -r1.7 ManagedBuildManager.java
--- build/org/eclipse/cdt/core/build/managed/ManagedBuildManager.java	29 May 2003 14:00:58 -0000	1.7
+++ build/org/eclipse/cdt/core/build/managed/ManagedBuildManager.java	6 Jun 2003 20:05:17 -0000
@@ -108,7 +108,7 @@
 	 * @return
 	 */
 	public static ITarget[] getTargets(IResource resource) {
-		ResourceBuildInfo buildInfo = getBuildInfo(resource);
+		IResourceBuildInfo buildInfo = getBuildInfo(resource);
 		
 		if (buildInfo != null) {
 			List targets = buildInfo.getTargets();
@@ -121,7 +121,7 @@
 
 	public static ITarget getTarget(IResource resource, String id) {
 		if (resource != null) {
-			ResourceBuildInfo buildInfo = getBuildInfo(resource);
+			IResourceBuildInfo buildInfo = getBuildInfo(resource);
 			if (buildInfo != null)
 				return buildInfo.getTarget(id);
 		}
@@ -138,7 +138,7 @@
 	 * 
 	 * @param resource
 	 * @param parentTarget
-	 * @return
+	 * @return new <code>ITarget</code> with settings based on the parent passed in the arguments
 	 * @throws BuildException
 	 */
 	public static ITarget createTarget(IResource resource, ITarget parentTarget)
@@ -167,6 +167,24 @@
 	}
 	
 	/**
+	 * Sets the default configuration for the project. Note that this will also
+	 * update the default target if needed.
+	 *  
+	 * @param project
+	 * @param newDefault
+	 */
+	public static void setDefaultConfiguration(IProject project, IConfiguration newDefault) {
+		if (project == null || newDefault == null) {
+			return;
+		}
+		// Set the default in build information for the project 
+		IResourceBuildInfo info = getBuildInfo(project);
+		if (info != null) {
+			info.setDefaultConfiguration(newDefault);
+		}
+	}
+	
+	/**
 	 * Set the string value for an option for a given config.
 	 * 
 	 * @param config The configuration the option belongs to.
@@ -223,9 +241,8 @@
 		Element rootElement = doc.createElement("buildInfo");
 		doc.appendChild(rootElement);
 
-		// Populate from buildInfo
-		// To do - find other resources also
-		ResourceBuildInfo buildInfo = getBuildInfo(project);
+		// Save the build info
+		ResourceBuildInfo buildInfo = (ResourceBuildInfo) getBuildInfo(project);
 		if (buildInfo != null)
 			buildInfo.serialize(doc, rootElement);
 		
@@ -276,8 +293,7 @@
 			return;
 		extensionTargetsLoaded = true;
 
-		IExtensionPoint extensionPoint
-			= CCorePlugin.getDefault().getDescriptor().getExtensionPoint("ManagedBuildInfo");
+		IExtensionPoint extensionPoint = CCorePlugin.getDefault().getDescriptor().getExtensionPoint("ManagedBuildInfo");
 		IExtension[] extensions = extensionPoint.getExtensions();
 		for (int i = 0; i < extensions.length; ++i) {
 			IExtension extension = extensions[i];
@@ -313,7 +329,7 @@
 		return buildInfo;
 	}
 
-	public static ResourceBuildInfo getBuildInfo(IResource resource, boolean create) {
+	public static IResourceBuildInfo getBuildInfo(IResource resource, boolean create) {
 		// Make sure the extension information is loaded first
 		loadExtensions();
 		ResourceBuildInfo buildInfo = null;
@@ -338,7 +354,7 @@
 		return buildInfo;
 	}
 	
-	public static ResourceBuildInfo getBuildInfo(IResource resource) {
+	public static IResourceBuildInfo getBuildInfo(IResource resource) {
 		return getBuildInfo(resource, false);
 	}
 
Index: build/org/eclipse/cdt/internal/core/build/managed/Configuration.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/Configuration.java,v
retrieving revision 1.9
diff -u -r1.9 Configuration.java
--- build/org/eclipse/cdt/internal/core/build/managed/Configuration.java	29 May 2003 14:00:58 -0000	1.9
+++ build/org/eclipse/cdt/internal/core/build/managed/Configuration.java	6 Jun 2003 20:05:17 -0000
@@ -258,7 +258,7 @@
 		String oldValue;
 		// Check whether this is an enumerated option
 		if (option.getValueType() == IOption.ENUMERATED) {
-			oldValue = option.getEnumCommand(option.getSelectedEnum());
+			oldValue = option.getSelectedEnum();
 		}
 		else {
 			oldValue = option.getStringValue(); 
Index: build/org/eclipse/cdt/internal/core/build/managed/OptionReference.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/OptionReference.java,v
retrieving revision 1.7
diff -u -r1.7 OptionReference.java
--- build/org/eclipse/cdt/internal/core/build/managed/OptionReference.java	29 May 2003 14:00:58 -0000	1.7
+++ build/org/eclipse/cdt/internal/core/build/managed/OptionReference.java	6 Jun 2003 20:05:17 -0000
@@ -30,10 +30,14 @@
  */
 public class OptionReference implements IOption {
 
+	// Used for all option references that override the command
+	private String command;
+	// The option this reference overrides
 	private IOption option;
+	// The owner of the reference
 	private ToolReference owner;
+	// The actual value of the reference
 	private Object value;
-	private String command;
 
 	/**
 	 * Created internally.
@@ -69,7 +73,7 @@
 				value = element.getAttribute("defaultValue");
 				break;
 			case IOption.ENUMERATED:
-				value = option.getEnumCommand(option.getSelectedEnum());				
+				value = option.getSelectedEnum();
 				break;
 			case IOption.STRING_LIST:
 				List valueList = new ArrayList();
@@ -97,11 +101,11 @@
 		// value
 		switch (option.getValueType()) {
 			case IOption.BOOLEAN:
-				value = new Boolean(element.getAttribute("value"));
+				value = new Boolean(element.getAttribute("defaultValue"));
 				break;
 			case IOption.STRING:
 			case IOption.ENUMERATED:
-				value = (String) element.getAttribute("value");
+				value = (String) element.getAttribute("defaultValue");
 				break;
 			case IOption.STRING_LIST:
 				List valueList = new ArrayList();
@@ -130,11 +134,11 @@
 		// value
 		switch (option.getValueType()) {
 			case IOption.BOOLEAN:
-				element.setAttribute("value", ((Boolean)value).toString());
+				element.setAttribute("defaultValue", ((Boolean)value).toString());
 				break;
 			case IOption.STRING:
 			case IOption.ENUMERATED:
-				element.setAttribute("value", (String)value);
+				element.setAttribute("defaultValue", (String)value);
 				break;
 			case IOption.STRING_LIST:
 				ArrayList stringList = (ArrayList)value;
@@ -213,7 +217,7 @@
 			// Return the default defined for the enumeration in the manifest.
 			return option.getSelectedEnum();
 		} else {
-			// Value will contain the selection of the user
+			// Value will contain the human-readable name of the enum 
 			return (String) value;
 		}
 	}
Index: build/org/eclipse/cdt/internal/core/build/managed/ResourceBuildInfo.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/ResourceBuildInfo.java,v
retrieving revision 1.2
diff -u -r1.2 ResourceBuildInfo.java
--- build/org/eclipse/cdt/internal/core/build/managed/ResourceBuildInfo.java	29 May 2003 14:00:58 -0000	1.2
+++ build/org/eclipse/cdt/internal/core/build/managed/ResourceBuildInfo.java	6 Jun 2003 20:05:17 -0000
@@ -14,58 +14,263 @@
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
+import java.util.ListIterator;
 import java.util.Map;
 
+import org.eclipse.cdt.core.build.managed.BuildException;
+import org.eclipse.cdt.core.build.managed.IConfiguration;
+import org.eclipse.cdt.core.build.managed.IResourceBuildInfo;
+import org.eclipse.cdt.core.build.managed.ITarget;
+import org.eclipse.cdt.core.build.managed.ITool;
 import org.eclipse.core.resources.IResource;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 import org.w3c.dom.Node;
 
-public class ResourceBuildInfo {
+public class ResourceBuildInfo implements IResourceBuildInfo {
 
 	private IResource owner;
 	private Map targetMap;
 	private List targets;
-
+	private Map defaultConfigurations;
+	private ITarget defaultTarget;
+	
 	public ResourceBuildInfo() {
 		targetMap = new HashMap();
 		targets = new ArrayList();
+		defaultConfigurations = new HashMap();
 	}
 	
 	public ResourceBuildInfo(IResource owner, Element element) {
 		this();
-		
+		// The id of the default configuration
+		String defaultTargetId = null;
+		List configIds = new ArrayList();
 		Node child = element.getFirstChild();
 		while (child != null) {
 			if (child.getNodeName().equals("target")) {
 				new Target(this, (Element)child);
+			} else if (child.getNodeName().equals("defaultConfig")) {
+				// We may not have read the config in yet, so just cache it
+				configIds.add(((Element)child).getAttribute("id"));
+			} else if (child.getNodeName().equals("defaultTarget")) {
+				defaultTargetId = ((Element)child).getAttribute("id");
 			}
 			child = child.getNextSibling();
 		}
+		// All the available targets have been read in
+		defaultTarget = (ITarget) targetMap.get(defaultTargetId);
+		// Now we have a misserable O(N^2) operation (oh well, the data sets are small)
+		ListIterator stringIter = configIds.listIterator();
+		while (stringIter.hasNext()){
+			String confId = (String) stringIter.next();
+			ListIterator targIter = targets.listIterator();
+			while (targIter.hasNext()) {
+				Target targ = (Target) targIter.next();
+				IConfiguration conf = targ.getConfiguration(confId);
+				if (conf != null) {
+					defaultConfigurations.put(targ.getId(), conf);
+					break;
+				}				
+			}
+		}
+	}
+
+	/* (non-Javadoc)
+	 * @see org.eclipse.cdt.core.build.managed.IResourceBuildInfo#addTarget(org.eclipse.cdt.core.build.managed.ITarget)
+	 */
+	public void addTarget(ITarget target) {
+		targetMap.put(target.getId(), target);
+		targets.add(target);
+	}
+
+	/* (non-Javadoc)
+	 * @see org.eclipse.cdt.core.build.managed.IResourceBuildInfo#getBuildArtifactName()
+	 */
+	public String getBuildArtifactName() {
+		// Get the default target and use its value
+		String name = getDefaultTarget().getArtifactName();
+		return name == null ? new String() : name;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.eclipse.cdt.core.build.managed.IResourceBuildInfo#getDefaultConfiguration()
+	 */
+	public IConfiguration getDefaultConfiguration(ITarget target) {
+		// Get the default config associated with the defalt target
+		IConfiguration config = (IConfiguration) defaultConfigurations.get(target.getId());
+
+		// If null, look up the first configuration associated with the target
+		if (config == null) {
+			IConfiguration[] configs = getDefaultTarget().getConfigurations();
+			if (configs.length > 0) {
+				config = configs[0];
+			}
+		}
+		return config;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.eclipse.cdt.core.build.managed.IResourceBuildInfo#getDefaultTarget()
+	 */
+	public ITarget getDefaultTarget() {
+		if (defaultTarget == null) {
+			defaultTarget = (ITarget) targets.get(0);
+		}
+		return defaultTarget;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.eclipse.cdt.core.build.managed.IResourceBuildInfo#getFlagsForSource(java.lang.String)
+	 */
+	public String getFlagsForSource(String extension) {
+		// Get all the tools for the current config
+		IConfiguration config = getDefaultConfiguration(getDefaultTarget());
+		ITool[] tools = config.getTools();
+		for (int index = 0; index < tools.length; index++) {
+			ITool tool = tools[index];
+			if (tool.buildsFileType(extension)) {
+				String flags = new String();
+				try {
+					flags = tool.getToolFlags();
+				} catch (BuildException e) {
+					// Give it your best shot with the next tool
+					continue;
+				}
+				return flags;
+			}
+		}
+		return null;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.eclipse.cdt.core.build.managed.IResourceBuildInfo#getToolFlags(java.lang.String)
+	 */
+	public String getFlagsForTarget(String extension) {
+		// Get all the tools for the current config
+		IConfiguration config = getDefaultConfiguration(getDefaultTarget());
+		ITool[] tools = config.getTools();
+		for (int index = 0; index < tools.length; index++) {
+			ITool tool = tools[index];
+			if (tool.producesFileType(extension)) {
+				String flags = new String();
+				try {
+					flags = tool.getToolFlags();
+				} catch (BuildException e) {
+					// TODO: handle exception
+				}
+				return flags;
+			}
+		}
+		return null;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.eclipse.cdt.core.build.managed.IResourceBuildInfo#getOutputExtension(java.lang.String)
+	 */
+	public String getOutputExtension(String resourceExtension) {
+		// Get all the tools for the current config
+		IConfiguration config = getDefaultConfiguration(getDefaultTarget());
+		ITool[] tools = config.getTools();
+		for (int index = 0; index < tools.length; index++) {
+			ITool tool = tools[index];
+			String output = tool.getOutputExtension(resourceExtension);
+			if (output != null) {
+				return output;
+			}
+		}
+		return null;
 	}
 
 	public IResource getOwner() {
 		return owner;
 	}
-	
-	public Target getTarget(String id) {
-		return (Target)targetMap.get(id);
+	/* (non-Javadoc)
+	 * @see org.eclipse.cdt.core.build.managed.IResourceBuildInfo#getTarget(org.eclipse.cdt.core.build.managed.IConfiguration)
+	 */
+	public ITarget getTarget(String id) {
+		return (ITarget) targetMap.get(id);
 	}
 
+	/* (non-Javadoc)
+	 * @see org.eclipse.cdt.core.build.managed.IResourceBuildInfo#getTargets(org.eclipse.cdt.core.build.managed.IConfiguration)
+	 */
 	public List getTargets() {
 		return targets;	
 	}
 	
-	public void addTarget(Target target) {
-		targetMap.put(target.getId(), target);
-		targets.add(target);
+	/* (non-Javadoc)
+	 * @see org.eclipse.cdt.core.build.managed.IResourceBuildInfo#getToolForSource(java.lang.String)
+	 */
+	public String getToolForSource(String extension) {
+		// Get all the tools for the current config
+		IConfiguration config = getDefaultConfiguration(getDefaultTarget());
+		ITool[] tools = config.getTools();
+		for (int index = 0; index < tools.length; index++) {
+			ITool tool = tools[index];
+			if (tool.buildsFileType(extension)) {
+				return tool.getToolCommand();
+			}
+		}
+		return null;
 	}
-	
+
+	/* (non-Javadoc)
+	 * @see org.eclipse.cdt.core.build.managed.IResourceBuildInfo#getToolInvocation(java.lang.String)
+	 */
+	public String getToolForTarget(String extension) {
+		// Get all the tools for the current config
+		IConfiguration config = getDefaultConfiguration(getDefaultTarget());
+		ITool[] tools = config.getTools();
+		for (int index = 0; index < tools.length; index++) {
+			ITool tool = tools[index];
+			if (tool.producesFileType(extension)) {
+				return tool.getToolCommand();
+			}
+		}
+		return null;
+	}
+
 	public void serialize(Document doc, Element element) {
+		// Write out each target and their default config
 		for (int i = 0; i < targets.size(); ++i) {
 			Element targetElement = doc.createElement("target");
 			element.appendChild(targetElement);
 			((Target)targets.get(i)).serialize(doc, targetElement);
+			IConfiguration config = getDefaultConfiguration((ITarget)targets.get(i));
+			if (config != null) {
+				Element configEl = doc.createElement("defaultConfig");
+				element.appendChild(configEl);
+				configEl.setAttribute("id", config.getId());
+			}
+		}
+		// Persist the default target
+		if (getDefaultTarget() != null){
+			Element targEl = doc.createElement("defaultTarget");
+			element.appendChild(targEl);
+			targEl.setAttribute("id", getDefaultTarget().getId());
 		}
 	}
+
+	/* (non-Javadoc)
+	 * @see org.eclipse.cdt.core.build.managed.IResourceBuildInfo#setDefaultConfiguration(org.eclipse.cdt.core.build.managed.IConfiguration)
+	 */
+	public void setDefaultConfiguration(IConfiguration configuration) {
+		// Get the target associated with the argument
+		ITarget target = configuration.getTarget();
+		// Make sure it is the default
+		setDefaultTarget(target);
+		defaultConfigurations.put(target.getId(), configuration);
+	}
+
+	/* (non-Javadoc)
+	 * @see org.eclipse.cdt.core.build.managed.IResourceBuildInfo#setDefaultTarget(org.eclipse.cdt.core.build.managed.ITarget)
+	 */
+	public void setDefaultTarget(ITarget target) {
+		if (defaultTarget != null && defaultTarget.getId().equals(target.getId())) {
+			return;
+		}
+		defaultTarget = target;		
+	}
+
 }
Index: build/org/eclipse/cdt/internal/core/build/managed/Target.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/Target.java,v
retrieving revision 1.8
diff -u -r1.8 Target.java
--- build/org/eclipse/cdt/internal/core/build/managed/Target.java	29 May 2003 14:00:58 -0000	1.8
+++ build/org/eclipse/cdt/internal/core/build/managed/Target.java	6 Jun 2003 20:05:17 -0000
@@ -16,6 +16,7 @@
 import java.util.Map;
 
 import org.eclipse.cdt.core.build.managed.IConfiguration;
+import org.eclipse.cdt.core.build.managed.IResourceBuildInfo;
 import org.eclipse.cdt.core.build.managed.ITarget;
 import org.eclipse.cdt.core.build.managed.ITool;
 import org.eclipse.cdt.core.build.managed.ManagedBuildManager;
@@ -37,8 +38,12 @@
 	private List configurations;
 	private Map configMap;
 	private boolean isAbstract = false;
+	private boolean isTest = false;
+	private String artifactName;
+	private String defaultExtension;
 
 	private static final IConfiguration[] emptyConfigs = new IConfiguration[0];
+	private static final String EMPTY_STRING = new String();
 	
 	public Target(IResource owner) {
 		this.owner = owner;
@@ -58,9 +63,12 @@
 		this.parent = parent;
 		setId(parent.getId() + ".1");		
 		setName(parent.getName());
+		this.artifactName = parent.getArtifactName();
+		this.defaultExtension = parent.getDefaultExtension();
+		this.isTest = parent.isTestTarget();
 
 		// Hook me up
-		ResourceBuildInfo buildInfo = ManagedBuildManager.getBuildInfo(owner, true);
+		IResourceBuildInfo buildInfo = ManagedBuildManager.getBuildInfo(owner, true);
 		buildInfo.addTarget(this);
 	}
 
@@ -76,9 +84,16 @@
 		// hook me up
 		ManagedBuildManager.addExtensionTarget(this);
 		
-		// name
+		// Get the target name
 		setName(element.getAttribute("name"));
 
+		// Get the name of the build artifact associated with target (usually 
+		// in the plugin specification).
+		artifactName = element.getAttribute("artifactName");
+		
+		// Get the default extension
+		defaultExtension = element.getAttribute("defaultExtension");
+
 		// parent
 		String parentId = element.getAttribute("parent");
 		if (parentId != null) {
@@ -93,6 +108,9 @@
 		if ("true".equals(element.getAttribute("isAbstract")))
 			isAbstract = true;
 
+		// Is this a test target
+		isTest = ("true".equals(element.getAttribute("isTest")));
+
 		IConfigurationElement[] targetElements = element.getChildren();
 		for (int k = 0; k < targetElements.length; ++k) {
 			IConfigurationElement targetElement = targetElements[k];
@@ -123,6 +141,13 @@
 		// name
 		setName(element.getAttribute("name"));
 
+		// Get the name of the build artifact associated with target (should
+		// contain what the user entered in the UI).
+		artifactName = element.getAttribute("artifactName");
+
+		// Get the default extension
+		defaultExtension = element.getAttribute("defaultExtension");
+
 		// parent
 		String parentId = element.getAttribute("parent");
 		if (parentId != null)
@@ -131,6 +156,9 @@
 		// isAbstract
 		if ("true".equals(element.getAttribute("isAbstract")))
 			isAbstract = true;
+			
+		// Is this a test target
+		isTest = ("true".equals(element.getAttribute("isTest")));
 	
 		Node child = element.getFirstChild();
 		while (child != null) {
@@ -139,8 +167,6 @@
 			}
 			child = child.getNextSibling();
 		}
-
-
 	}
 	
 	/**
@@ -155,7 +181,10 @@
 		if (parent != null)
 			element.setAttribute("parent", parent.getId());
 		element.setAttribute("isAbstract", isAbstract ? "true" : "false");
-		
+		element.setAttribute("artifactName", getArtifactName());
+		element.setAttribute("defaultExtension", getDefaultExtension());
+		element.setAttribute("isTest", isTest ? "true" : "false");
+				
 		if (configurations != null)
 			for (int i = 0; i < configurations.size(); ++i) {
 				Configuration config = (Configuration)configurations.get(i);
@@ -231,6 +260,24 @@
 			return emptyConfigs;
 	}
 
+	/* (non-Javadoc)
+	 * @see org.eclipse.cdt.core.build.managed.ITarget#getDefaultExtension()
+	 */
+	public String getDefaultExtension() {
+		return defaultExtension == null ? EMPTY_STRING : defaultExtension;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.eclipse.cdt.core.build.managed.ITarget#getArtifactName()
+	 */
+	public String getArtifactName() {
+		// Return name or an empty string
+		return artifactName == null ? EMPTY_STRING : artifactName;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.eclipse.cdt.core.build.managed.ITarget#getConfiguration()
+	 */
 	public IConfiguration getConfiguration(String id) {
 		return (IConfiguration)configMap.get(id);
 	}
@@ -252,6 +299,13 @@
 	}
 
 	/* (non-Javadoc)
+	 * @see org.eclipse.cdt.core.build.managed.ITarget#isTestTarget()
+	 */
+	public boolean isTestTarget() {
+		return isTest;
+	}
+
+	/* (non-Javadoc)
 	 * @see org.eclipse.cdt.core.build.managed.ITarget#createConfiguration()
 	 */
 	public IConfiguration createConfiguration(String id) {
@@ -265,4 +319,10 @@
 		return new Configuration(this, parent, id);
 	}
 
+	/* (non-Javadoc)
+	 * @see org.eclipse.cdt.core.build.managed.ITarget#setBuildArtifact(java.lang.String)
+	 */
+	public void setBuildArtifact(String name) {
+		artifactName = name;		
+	}
 }
Index: build/org/eclipse/cdt/internal/core/build/managed/Tool.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/Tool.java,v
retrieving revision 1.5
diff -u -r1.5 Tool.java
--- build/org/eclipse/cdt/internal/core/build/managed/Tool.java	21 Apr 2003 19:37:46 -0000	1.5
+++ build/org/eclipse/cdt/internal/core/build/managed/Tool.java	6 Jun 2003 20:05:17 -0000
@@ -13,8 +13,11 @@
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
+import java.util.ListIterator;
 import java.util.Map;
+import java.util.StringTokenizer;
 
+import org.eclipse.cdt.core.build.managed.BuildException;
 import org.eclipse.cdt.core.build.managed.IConfiguration;
 import org.eclipse.cdt.core.build.managed.IOption;
 import org.eclipse.cdt.core.build.managed.IOptionCategory;
@@ -29,19 +32,30 @@
  */
 public class Tool extends BuildObject implements ITool, IOptionCategory {
 
+	private static final String DEFAULT_SEPARATOR = ",";
+	private static final IOptionCategory[] EMPTY_CATEGORIES = new IOptionCategory[0];
+	private static final IOption[] EMPTY_OPTIONS = new IOption[0];
+
 	private ITarget target;
 	private List options;
 	private Map optionMap;
 	private List childOptionCategories;
 	private Map categoryMap;
-	
-	private static IOption[] emptyOptions = new IOption[0];
-	private static IOptionCategory[] emptyCategories = new IOptionCategory[0];
+	private String command;
+	private List inputExtensions;
+	private String outputExtension;
 	
 	public Tool(Target target) {
 		this.target = target;
 	}
 	
+	/**
+	 * Constructor to create a new tool in the build model based on the information
+	 * defined in the plugin.xml manifest. 
+	 * 
+	 * @param target The target the receiver will belong to.
+	 * @param element The element containing the information.
+	 */
 	public Tool(Target target, IConfigurationElement element) {
 		this(target);
 
@@ -53,6 +67,25 @@
 
 		// name
 		setName(element.getAttribute("name"));
+		
+		// Get the supported input file extension
+		String inputs = element.getAttribute("sources") == null ? 
+			new String() : 
+			element.getAttribute("sources");
+		StringTokenizer tokenizer = new StringTokenizer(inputs, DEFAULT_SEPARATOR);
+		while (tokenizer.hasMoreElements()) {
+			getInputExtensions().add(tokenizer.nextElement());
+		}
+				
+		// Get the output extension
+		outputExtension = element.getAttribute("outputs") == null ? 
+			new String() : 
+			element.getAttribute("outputs");
+			
+		// Get the tool invocation
+		command = element.getAttribute("command") == null ? 
+			new String() : 
+			element.getAttribute("command");
 
 		// set up the category map
 		categoryMap = new HashMap();
@@ -70,10 +103,6 @@
 		}
 	}
 	
-	public ITarget getTarget() {
-		return target;	
-	}
-	
 	public IOptionCategory getOptionCategory(String id) {
 		return (IOptionCategory)categoryMap.get(id);
 	}
@@ -82,6 +111,13 @@
 		categoryMap.put(category.getId(), category);
 	}
 	
+	/* (non-Javadoc)
+	 * @see org.eclipse.cdt.core.build.managed.ITool#handlesFileType(java.lang.String)
+	 */
+	public boolean buildsFileType(String extension) {
+		return getInputExtensions().contains(extension);
+	}
+
 	void addChildCategory(IOptionCategory category) {
 		if (childOptionCategories == null)
 			childOptionCategories = new ArrayList();
@@ -92,7 +128,7 @@
 		if (options != null)
 			return (IOption[])options.toArray(new IOption[options.size()]);
 		else
-			return emptyOptions;
+			return EMPTY_OPTIONS;
 	}
 
 	public void addOption(Option option) {
@@ -115,7 +151,17 @@
 		if (childOptionCategories != null)
 			return (IOptionCategory[])childOptionCategories.toArray(new IOptionCategory[childOptionCategories.size()]);
 		else
-			return emptyCategories;
+			return EMPTY_CATEGORIES;
+	}
+
+	/* (non-Javadoc)
+	 * @return
+	 */
+	private List getInputExtensions() {
+		if (inputExtensions == null) {
+			inputExtensions = new ArrayList();
+		}
+		return inputExtensions;
 	}
 
 	/* (non-Javadoc)
@@ -138,6 +184,10 @@
 		return null;
 	}
 
+	public ITarget getTarget() {
+		return target;	
+	}
+	
 	/* (non-Javadoc)
 	 * @see org.eclipse.cdt.core.build.managed.IOptionCategory#getTool()
 	 */
@@ -146,6 +196,61 @@
 	}
 
 	/* (non-Javadoc)
+	 * @see org.eclipse.cdt.core.build.managed.ITool#getToolCommand()
+	 */
+	public String getToolCommand() {
+		return command;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.eclipse.cdt.core.build.managed.ITool#getToolFlags()
+	 */
+	public String getToolFlags() throws BuildException {
+		// Get all of the options
+		StringBuffer buf = new StringBuffer();
+		IOption[] opts = getOptions();
+		for (int index = 0; index < opts.length; index++) {
+			IOption option = opts[index];
+			switch (option.getValueType()) {
+				case IOption.BOOLEAN :
+					if (option.getBooleanValue()) {
+						buf.append(option.getCommand() + WHITE_SPACE);
+					}
+					break;
+				
+				case IOption.ENUMERATED :
+					String enum = option.getEnumCommand(option.getSelectedEnum());
+					if (enum.length() > 0) {
+						buf.append(enum + WHITE_SPACE);
+					}
+					break;
+				
+				case IOption.STRING :
+					String val = option.getStringValue();
+					if (val.length() > 0) { 
+						buf.append(val + WHITE_SPACE);
+					}
+					break;
+					
+				case IOption.STRING_LIST :
+					String cmd = option.getCommand();
+					String[] list = option.getStringListValue();
+					for (int j = 0; j < list.length; j++) {
+						String temp = list[j];
+						buf.append(cmd + temp + WHITE_SPACE);
+					}
+					break;
+					
+				default :
+					break;
+			}
+
+		}
+
+		return buf.toString();
+	}
+
+	/* (non-Javadoc)
 	 * @see org.eclipse.cdt.core.build.managed.IOptionCategory#getOptions(org.eclipse.cdt.core.build.managed.ITool)
 	 */
 	public IOption[] getOptions(IConfiguration configuration) {
@@ -181,6 +286,27 @@
 	 */
 	public IOption getOption(String id) {
 		return (IOption)optionMap.get(id);
+	}
+
+	/* (non-Javadoc)
+	 * @see org.eclipse.cdt.core.build.managed.ITool#getOutput(java.lang.String)
+	 */
+	public String getOutputExtension(String inputExtension) {
+		// Examine the list of input extensions
+		ListIterator iter = getInputExtensions().listIterator();
+		while (iter.hasNext()) {
+			if (((String)iter.next()).equals(inputExtension)) {
+				return outputExtension;
+			}
+		}
+		return null;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.eclipse.cdt.core.build.managed.ITool#producesFileType(java.lang.String)
+	 */
+	public boolean producesFileType(String outputExtension) {
+		return outputExtension.equals(this.outputExtension);
 	}
 
 }
Index: build/org/eclipse/cdt/internal/core/build/managed/ToolReference.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/build/org/eclipse/cdt/internal/core/build/managed/ToolReference.java,v
retrieving revision 1.5
diff -u -r1.5 ToolReference.java
--- build/org/eclipse/cdt/internal/core/build/managed/ToolReference.java	29 May 2003 14:00:58 -0000	1.5
+++ build/org/eclipse/cdt/internal/core/build/managed/ToolReference.java	6 Jun 2003 20:05:17 -0000
@@ -14,6 +14,7 @@
 import java.util.List;
 import java.util.Map;
 
+import org.eclipse.cdt.core.build.managed.BuildException;
 import org.eclipse.cdt.core.build.managed.IConfiguration;
 import org.eclipse.cdt.core.build.managed.IOption;
 import org.eclipse.cdt.core.build.managed.IOptionCategory;
@@ -122,6 +123,61 @@
 	}
 	
 	/* (non-Javadoc)
+	 * @see org.eclipse.cdt.core.build.managed.ITool#getToolCommand()
+	 */
+	public String getToolCommand() {
+		return parent.getToolCommand();
+	}
+
+	/* (non-Javadoc)
+	 * @see org.eclipse.cdt.core.build.managed.ITool#getToolFlags()
+	 */
+	public String getToolFlags() throws BuildException {
+		// Get all of the options
+		StringBuffer buf = new StringBuffer();
+		IOption[] opts = getOptions();
+		for (int index = 0; index < opts.length; index++) {
+			IOption option = opts[index];
+			switch (option.getValueType()) {
+				case IOption.BOOLEAN :
+					if (option.getBooleanValue()) {
+						buf.append(option.getCommand() + WHITE_SPACE);
+					}
+					break;
+				
+				case IOption.ENUMERATED :
+					String enum = option.getEnumCommand(option.getSelectedEnum());
+					if (enum.length() > 0) {
+						buf.append(enum + WHITE_SPACE);
+					}
+					break;
+				
+				case IOption.STRING :
+					String val = option.getStringValue();
+					if (val.length() > 0) { 
+						buf.append(val + WHITE_SPACE);
+					}
+					break;
+					
+				case IOption.STRING_LIST :
+					String cmd = option.getCommand();
+					String[] list = option.getStringListValue();
+					for (int j = 0; j < list.length; j++) {
+						String temp = list[j];
+						buf.append(cmd + temp + WHITE_SPACE);
+					}
+					break;
+					
+				default :
+					break;
+			}
+
+		}
+
+		return buf.toString().trim();
+	}
+
+	/* (non-Javadoc)
 	 * @see org.eclipse.cdt.core.build.managed.ITool#createOption()
 	 */
 	public IOption createOption() {
@@ -160,6 +216,13 @@
 	}
 
 	/* (non-Javadoc)
+	 * @see org.eclipse.cdt.core.build.managed.ITool#producesFileType(java.lang.String)
+	 */
+	public boolean producesFileType(String outputExtension) {
+		return parent.producesFileType(outputExtension);
+	}
+
+	/* (non-Javadoc)
 	 * @see org.eclipse.cdt.core.build.managed.IBuildObject#getId()
 	 */
 	public String getId() {
@@ -220,11 +283,26 @@
 	}
 	
 	/* (non-Javadoc)
+	 * @see org.eclipse.cdt.core.build.managed.ITool#handlesFileType(java.lang.String)
+	 */
+	public boolean buildsFileType(String extension) {
+		return parent.buildsFileType(extension);
+	}
+
+	/* (non-Javadoc)
 	 * @see org.eclipse.cdt.core.build.managed.ITool#getOption(java.lang.String)
 	 */
 	public IOption getOption(String id) {
 		// TODO Auto-generated method stub
 		return null;
 	}
+
+	/* (non-Javadoc)
+	 * @see org.eclipse.cdt.core.build.managed.ITool#getOutput(java.lang.String)
+	 */
+	public String getOutputExtension(String inputExtension) {
+		return parent.getOutputExtension(inputExtension);
+	}
+
 
 }
Index: schema/ManagedBuildTools.exsd
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/schema/ManagedBuildTools.exsd,v
retrieving revision 1.5
diff -u -r1.5 ManagedBuildTools.exsd
--- schema/ManagedBuildTools.exsd	21 May 2003 16:29:58 -0000	1.5
+++ schema/ManagedBuildTools.exsd	6 Jun 2003 20:05:18 -0000
@@ -50,41 +50,48 @@
          <attribute name="id" type="string" use="required">
             <annotation>
                <documentation>
-                  
+                  A unique identifier for the tool that will be used by the build model.
                </documentation>
             </annotation>
          </attribute>
          <attribute name="name" type="string" use="required">
             <annotation>
                <documentation>
-                  
+                  Human-readable name for the tool to be used in the UI.
                </documentation>
             </annotation>
          </attribute>
          <attribute name="sources" type="string">
             <annotation>
                <documentation>
-                  
+                  A comma-separated list of file extensions that the tool will produce output for.
                </documentation>
             </annotation>
          </attribute>
          <attribute name="outputs" type="string">
             <annotation>
                <documentation>
-                  
+                  The extension that the tool will produce from a given input.
                </documentation>
             </annotation>
          </attribute>
          <attribute name="dependencyCalculator" type="string">
             <annotation>
                <documentation>
-                  
+                  A reference to the class that will calculate the dependencies for a given file. For example, a compiler might require a dependency calculator for source files that discovers the dependenncies on header files.
                </documentation>
                <appInfo>
                   <meta.attribute kind="java"/>
                </appInfo>
             </annotation>
          </attribute>
+         <attribute name="command" type="string">
+            <annotation>
+               <documentation>
+                  The command that invokes the tool. For example, gcc for the Gnu C compiler, or g++ for the Gnu C++ compiler.
+               </documentation>
+            </annotation>
+         </attribute>
       </complexType>
    </element>
 
@@ -234,6 +241,11 @@
    </element>
 
    <element name="optionRef">
+      <annotation>
+         <documentation>
+            Option references hold onto information the user has changed through the UI. Not all fields will be populated, depending on the option type the reference overrides. For example, the &apos;name&apos; field is used by enumerated options only.
+         </documentation>
+      </annotation>
       <complexType>
          <attribute name="id" type="string" use="required">
             <annotation>
@@ -273,14 +285,14 @@
          <attribute name="id" type="string" use="required">
             <annotation>
                <documentation>
-                  
+                  Used by the build model to uniquely identify the target.
                </documentation>
             </annotation>
          </attribute>
          <attribute name="name" type="string" use="required">
             <annotation>
                <documentation>
-                  
+                  A human-readable target name, such as &apos;Linux Executable&apos;. This will be the name the user sees displayed in the UI.
                </documentation>
             </annotation>
          </attribute>
@@ -298,6 +310,27 @@
                </documentation>
             </annotation>
          </attribute>
+         <attribute name="artifactName" type="string">
+            <annotation>
+               <documentation>
+                  This is the name of the final build artifact associated with the target. The user will specify this is the UI, so there is no need to supply a default value.
+               </documentation>
+            </annotation>
+         </attribute>
+         <attribute name="defaultExtension" type="string">
+            <annotation>
+               <documentation>
+                  This is the extensionthat will be applied to any build artifact created by the target.
+               </documentation>
+            </annotation>
+         </attribute>
+         <attribute name="isTest" type="boolean">
+            <annotation>
+               <documentation>
+                  A an optional field that flags a target as a test-only target. If true, the target will not appear in the UI.
+               </documentation>
+            </annotation>
+         </attribute>
       </complexType>
    </element>
 
@@ -394,4 +427,4 @@
       </documentation>
    </annotation>
 
-</schema>
\ No newline at end of file
+</schema>
Index: src/org/eclipse/cdt/internal/core/GeneratedMakefileBuilder.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/GeneratedMakefileBuilder.java,v
retrieving revision 1.1
diff -u -r1.1 GeneratedMakefileBuilder.java
--- src/org/eclipse/cdt/internal/core/GeneratedMakefileBuilder.java	29 May 2003 14:00:58 -0000	1.1
+++ src/org/eclipse/cdt/internal/core/GeneratedMakefileBuilder.java	6 Jun 2003 20:05:18 -0000
@@ -14,10 +14,10 @@
 import java.io.ByteArrayInputStream;
 import java.util.Map;
 import org.eclipse.cdt.core.CCorePlugin;
+import org.eclipse.cdt.core.build.managed.IResourceBuildInfo;
 import org.eclipse.cdt.core.build.managed.ManagedBuildManager;
 import org.eclipse.cdt.core.resources.ACBuilder;
 import org.eclipse.cdt.core.resources.MakeUtil;
-import org.eclipse.cdt.internal.core.build.managed.ResourceBuildInfo;
 import org.eclipse.cdt.internal.core.model.Util;
 import org.eclipse.core.resources.IFile;
 import org.eclipse.core.resources.IProject;
@@ -41,6 +41,7 @@
 	private static final String INCREMENTAL = MESSAGE + ".incremental";	//$NON-NLS-1$
 	private static final String FILENAME = "makefile";	//$NON-NLS-1$
 	private static final String NEWLINE = System.getProperty("line.separator", "\n");	//$NON-NLS-1$
+	private static final String COLON = ":";
 	private static final String TAB = "\t";	//$NON-NLS-1$
 	
 	public class MyResourceDeltaVisitor implements IResourceDeltaVisitor {
@@ -67,34 +68,88 @@
 	}
 
 	/**
+	 * Add whatever macros we can figure out to the makefile.
+	 * 
 	 * @param buffer
 	 */
-	private void addMacros(StringBuffer buffer, ResourceBuildInfo info) {
+	private void addMacros(StringBuffer buffer, IResourceBuildInfo info) {
 		// TODO this should come from the build model
-		buffer.append("CC = " + NEWLINE);
-		buffer.append("CFLAGS = " + NEWLINE);
-		buffer.append("LD = " + NEWLINE);
-		buffer.append("LDFLAGS = " + NEWLINE);
 		buffer.append("RM = rm -f" + NEWLINE);
 		buffer.append("MAKE = make" + NEWLINE);
+		buffer.append(NEWLINE);
+	}
+
+	private void addRule(StringBuffer buffer, IPath sourcePath, String outputName, IResourceBuildInfo info) {
+		// Add the rule to the makefile
+		buffer.append(outputName + COLON + " " + sourcePath.toString());
+		// Add all of the dependencies on the source file
 		
 		buffer.append(NEWLINE);
+		String ext = sourcePath.getFileExtension();
+		String cmd = info.getToolForSource(ext);
+		String flags = info.getFlagsForSource(ext);
+		buffer.append(TAB + cmd + " " + flags + " " + "$?" + NEWLINE + NEWLINE);
+	}
+	
+	/**
+	 * Creates a list of dependencies on project resources.
+	 *  
+	 * @param buffer
+	 */
+	private void addSources(StringBuffer buffer, IResourceBuildInfo info) throws CoreException {
+		// Add the list of project files to be built
+		buffer.append("OBJS = \\" + NEWLINE);
+		
+		//Get a list of files from the project
+		IResource[] members = getProject().members();
+		for (int i = 0; i < members.length; i++) {
+			IResource resource = members[i];
+			IPath sourcePath = resource.getProjectRelativePath().removeFileExtension(); 
+			String srcExt = resource.getFileExtension();
+			String outExt = info.getOutputExtension(srcExt);
+			if (outExt != null) {
+				// Add the extension back to path
+				IPath outputPath = sourcePath.addFileExtension(outExt);
+				// Add the file to the list of dependencies for the base target
+				buffer.append(outputPath.toString() + " \\" + NEWLINE);
+			} 			
+		}
+		buffer.append(NEWLINE);
+
+		// Add a rule for building each resource to the makefile
+		for (int j = 0; j < members.length; j++) {
+			IResource resource = members[j];
+			IPath sourcePath = resource.getProjectRelativePath().removeFileExtension(); 
+			String srcExt = resource.getFileExtension();
+			String outExt = info.getOutputExtension(srcExt);
+			if (outExt != null) {
+				// Add the extension back to path
+				IPath outputPath = sourcePath.addFileExtension(outExt);
+				addRule(buffer, resource.getProjectRelativePath(), outputPath.toString(), info);
+			}
+		}
 	}
 
 	/**
 	 * @param buffer
 	 */
-	private void addTargets(StringBuffer buffer) {
-		// TODO Targets should come from build model
+	private void addTargets(StringBuffer buffer, IResourceBuildInfo info) {
+		// Generate a rule per source
 
-		// TODO Generate 'all' for now
-		buffer.append("all:" + NEWLINE);
+		// This is the top build rule
+		String flags = info.getFlagsForTarget("exe") + " ";
+		String cmd = info.getToolForTarget("exe") + " ";
+		buffer.append(info.getBuildArtifactName() + COLON + " ${OBJS}" + NEWLINE);
+		buffer.append(TAB + cmd + flags + "$@ ${OBJS}" + NEWLINE);
+		buffer.append(NEWLINE);
+
+		// TODO Generate 'all' for now but determine the real rules from UI
+		buffer.append("all: " + info.getBuildArtifactName() + NEWLINE);
 		buffer.append(NEWLINE);
-		
 		
 		// Always add a clean target
 		buffer.append("clean:" + NEWLINE);
-		buffer.append(TAB + "$(RM) *.o" + NEWLINE);
+		buffer.append(TAB + "$(RM) *.o " + info.getBuildArtifactName() + NEWLINE);
 		buffer.append(NEWLINE);
 	}
 
@@ -234,13 +289,16 @@
 	private void populateMakefile(IFile fileHandle, IProgressMonitor monitor) throws CoreException {
 		// Write out the contents of the build model
 		StringBuffer buffer = new StringBuffer();
-		ResourceBuildInfo info = ManagedBuildManager.getBuildInfo(getProject());
+		IResourceBuildInfo info = ManagedBuildManager.getBuildInfo(getProject());
 		
 		// Add the macro definitions
 		addMacros(buffer, info);
 
+		// Add a list of source files
+		addSources(buffer, info);
+		
 		// Add targets
-		addTargets(buffer);
+		addTargets(buffer, info);
 
 		// Save the file
 		Util.save(buffer, fileHandle);
Index: ChangeLog
===================================================================
RCS file: /home/tools/org.eclipse.cdt.ui/ChangeLog,v
retrieving revision 1.101
diff -u -r1.101 ChangeLog
--- ChangeLog	6 Jun 2003 01:16:17 -0000	1.101
+++ ChangeLog	6 Jun 2003 20:05:34 -0000
@@ -1,3 +1,46 @@
+<<<<<<< ChangeLog
+2003-06-06
+	I have added toolchain definitions for Cygnus and Linux to the plugin.xml file
+	for the new build model. There are two new wizards for adding a C and C++ project
+	for use with managed build systems. The files to implement that are:
+	
+	* build/org/eclipse/cdt/build/ui/wizards/ConfigurationBlock.java
+	* build/org/eclipse/cdt/build/ui/wizards/ConfigurationContentProvider.java
+	* build/org/eclipse/cdt/build/ui/wizards/ConfigurationLabelProvider.java
+	* build/org/eclipse/cdt/build/ui/wizards/CProjectPlatformPage.java
+	* build/org/eclipse/cdt/build/ui/wizards/ManagedCCWizard.java
+	* build/org/eclipse/cdt/build/ui/wizards/ManagedCWizard.java
+	* build/org/eclipse/cdt/build/ui/wizards/ManagedProjectWizard.java
+	
+	There is a new property page specifically for projects with this managed nature.
+	The code to implement it has been added to:
+	
+	* build/org/eclipse/cdt/build/ui/properties/BrowseEntryDialog.java
+	* build/org/eclipse/cdt/build/ui/properties/BuildOptionComboFieldEditor.java
+	* build/org/eclipse/cdt/build/ui/properties/BuildOptionListFieldEditor.java
+	* build/org/eclipse/cdt/build/ui/properties/BuildPropertyPage.java
+	* build/org/eclipse/cdt/build/ui/properties/BuildToolSettingsPage.java
+	* build/org/eclipse/cdt/build/ui/properties/BuildToolsSettingsStore.java
+	* build/org/eclipse/cdt/build/ui/properties/ManageConfigDialog.java
+	* build/org/eclipse/cdt/build/ui/properties/NewConfigurationDialog.java
+	* build/org/eclipse/cdt/build/ui/properties/SummaryFieldEditor.java
+	* build/org/eclipse/cdt/build/ui/properties/ToolListContentProvider.java
+	* build/org/eclipse/cdt/build/ui/properties/ToolListLabelProvider.java
+	
+	New string resources have been added to the plugin.properties file and to the 
+	src/org/eclipse/cdt/internal/ui/CPluginResources.properties file.
+	
+	New icons have been added:
+	* icons/full/build16/config-command.gif
+	* icons/full/build16/config-librarian.gif
+	* icons/full/build16/config-tool.gif
+	* icons/full/ctool16/newmngc_app.gif
+	* icons/full/ctool16/newmngcc_app.gif
+	
+	and the path src/org/eclipse/cdt/internal/ui/CPluginImages.java class
+	has been modified to manage them.
+	
+=======
 2003-06-05 Alain Magloire
 
 	Patch from Christophe Juniet, this patch adds #ifdef guards
@@ -11,6 +54,7 @@
 	* src/org/eclipse/cdt/ui/wizards/NewClassWizardPage.java
 	* src/org/eclipse/cdt/internal/ui/wizards/NewWizardMessages.properties.
 
+>>>>>>> 1.101
 2003-05-23 Alain Magloire
 
 	Patch from Victor Mozgin to deal with PR 38405
Index: plugin.properties
===================================================================
RCS file: /home/tools/org.eclipse.cdt.ui/plugin.properties,v
retrieving revision 1.18
diff -u -r1.18 plugin.properties
--- plugin.properties	27 May 2003 21:33:02 -0000	1.18
+++ plugin.properties	6 Jun 2003 20:05:34 -0000
@@ -13,16 +13,20 @@
 CView.name=C/C++ Projects
 MakeView.name=Make Targets
 
-# The Wizard
+# The Wizards
 # C
 newCWizardsCategory.name=C
 StdCWizard.name=Standard Make C Project
-StdCWizard.description=Create a new C project
+StdCWizard.description=Create a new C project and let me create and manage the makefile
+MngCWizard.name=Managed Make C Project
+MngCWizard.description=Create a new C project and let Eclipse create and manage the makefile
 
 # C++
 newCCWizardsCategory.name=C++
 StdCCWizard.name=Standard Make C++ Project
-StdCCWizard.description=Create a new C++ project
+StdCCWizard.description=Create a new C++ project and let me create and manage the makefile
+MngCCWizard.name=Managed Make C++ Project
+MngCCWizard.description=Create a new C++ project and let Eclipse create and manage the makefile
 
 #Project Conversion
 ConversionWizard.name=Convert a project's nature
@@ -64,3 +68,10 @@
 
 # Task Action
 DeleteTaskAction.label=Delete C/C++ Markers
+
+# Build Model Names
+ToolName.preprocessor = Preprocessor
+ToolName.compiler = Compiler
+ToolName.archiver = Archiver
+ToolName.linker = Linker
+ToolName.command = Command Line
Index: plugin.xml
===================================================================
RCS file: /home/tools/org.eclipse.cdt.ui/plugin.xml,v
retrieving revision 1.26
diff -u -r1.26 plugin.xml
--- plugin.xml	27 May 2003 21:33:02 -0000	1.26
+++ plugin.xml	6 Jun 2003 20:05:34 -0000
@@ -227,6 +227,31 @@
                class="org.eclipse.core.resources.IResource">
          </selection>
       </wizard>
+<!-- Managed Make Builder Projects -->
+      <wizard
+            name="%MngCCWizard.name"
+            icon="icons/full/ctool16/newmngcc_app.gif"
+            category="org.eclipse.cdt.ui.newCCWizards"
+            class="org.eclipse.cdt.build.ui.wizards.ManagedCCWizard"
+            project="true"
+            finalPerspective="org.eclipse.cdt.ui.CPerspective"
+            id="org.eclipse.cdt.ui.wizards.StdCCWizard">
+         <description>
+            %MngCCWizard.description
+         </description>
+      </wizard>
+      <wizard
+            name="%MngCWizard.name"
+            icon="icons/full/ctool16/newmngcc_app.gif"
+            category="org.eclipse.cdt.ui.newCWizards"
+            class="org.eclipse.cdt.build.ui.wizards.ManagedCWizard"
+            project="true"
+            finalPerspective="org.eclipse.cdt.ui.CPerspective"
+            id="org.eclipse.cdt.ui.wizards.StdCWizard">
+         <description>
+            %MngCWizard.description
+         </description>
+      </wizard>
       <wizard
             name="%NewWizards.class"
             icon="icons/full/ctool16/newclass_wiz.gif"
@@ -305,6 +330,16 @@
                value="org.eclipse.cdt.core.cnature">
          </filter>
       </page>
+      <page
+            objectClass="org.eclipse.core.resources.IProject"
+            name="C/C++ Build"
+            class="org.eclipse.cdt.build.ui.properties.BuildPropertyPage"
+            id="org.eclipse.cdt.build.ui.properties">
+         <filter
+               name="nature"
+               value="org.eclipse.cdt.core.managedBuildNature">
+         </filter>
+      </page>
    </extension>
    <extension
          point="org.eclipse.ui.editorActions">
@@ -440,6 +475,7 @@
             class="org.eclipse.cdt.internal.ui.BuildConsole">
       </CBuildConsole>
    </extension>
+<!--
    <extension
          point="org.eclipse.ui.views">
       <view
@@ -524,6 +560,333 @@
             toolId="org.eclipse.cdt.gnu.tools.ld"
             id="org.eclipse.cdt.gnu.tools.tabGroupLD">
       </toolTabGroup>
+   </extension>
+ -->
+   <extension
+         id="cdt.managed.build.info"
+         name="Managed Build Tools Description"
+         point="org.eclipse.cdt.core.ManagedBuildInfo">
+      <target
+            isTest="false"
+            name="Cygwin"
+            isAbstract="true"
+            id="cygwin">
+         <tool
+               sources="c,cc,cpp,cxx,C"
+               name="%ToolName.compiler"
+               outputs="o"
+               command="g++"
+               id="org.eclipse.cdt.build.tool.cygwin.compiler">
+            <optionCategory
+                  owner="org.eclipse.cdt.build.tool.cygwin.compiler"
+                  name="Preprocessor"
+                  id="cygwin.compiler.category.preprocessor">
+            </optionCategory>
+            <option
+                  name="Defined Symbols"
+                  category="cygwin.compiler.category.preprocessor"
+                  command="-D"
+                  valueType="stringList"
+                  id="cygwin.preprocessor.def.symbols">
+            </option>
+            <option
+                  name="Undefined Symbols"
+                  category="cygwin.compiler.category.preprocessor"
+                  command="-U"
+                  valueType="stringList"
+                  id="cygwin.preprocessor.undef.symbol">
+            </option>
+            <optionCategory
+                  owner="org.eclipse.cdt.build.tool.cygwin.compiler"
+                  name="General"
+                  id="cygwin.compiler.category.general">
+            </optionCategory>
+            <option
+                  defaultValue="-c"
+                  name="Compiler Flags"
+                  category="cygwin.compiler.category.general"
+                  valueType="string"
+                  id="cygwin.compiler.general.ccflags">
+            </option>
+            <option
+                  name="Optimization Level"
+                  category="cygwin.compiler.category.general"
+                  valueType="enumerated"
+                  id="cygwin.compiler.general.optimization.level">
+               <optionEnum
+                     name="None (-O0)"
+                     command="-O0"
+                     id="cygwin.optimization.level.none">
+               </optionEnum>
+               <optionEnum
+                     name="Optimize (-O1)"
+                     command="-O1"
+                     id="cygwin.optimization.level.optimize">
+               </optionEnum>
+               <optionEnum
+                     name="Optimize more (-O2)"
+                     isDefault="true"
+                     command="-O2"
+                     id="cygwin.optimization.level.more">
+               </optionEnum>
+               <optionEnum
+                     name="Optimize most (-O3)"
+                     command="-O3"
+                     id="cygwin.optimization.level.most">
+               </optionEnum>
+            </option>
+            <option
+                  name="Debug Level"
+                  category="cygwin.compiler.category.general"
+                  valueType="enumerated"
+                  id="cygwin.compiler.debugging.level">
+               <optionEnum
+                     name="None"
+                     isDefault="false"
+                     id="cygwin.debugging.level.none">
+               </optionEnum>
+               <optionEnum
+                     name="Minimal (-g1)"
+                     command="-g1"
+                     id="cygwin.debugging.level.minimal">
+               </optionEnum>
+               <optionEnum
+                     name="Default (-g)"
+                     isDefault="true"
+                     command="-g"
+                     id="cygwin.debugging.level.default">
+               </optionEnum>
+               <optionEnum
+                     name="Maximum (-g3)"
+                     isDefault="false"
+                     command="-g3"
+                     id="cygwin.debugging.level.max">
+               </optionEnum>
+            </option>
+            <option
+                  name="Include Paths"
+                  category="cygwin.compiler.category.general"
+                  command="-I"
+                  valueType="stringList"
+                  id="cygwin.compiler.general.include.paths">
+            </option>
+            <option
+                  defaultValue="false"
+                  name="Verbose"
+                  category="cygwin.compiler.category.general"
+                  command="-v"
+                  valueType="boolean"
+                  id="cygwin.compiler.general.verbose">
+            </option>
+            <optionCategory
+                  owner="org.eclipse.cdt.build.tool.cygwin.compiler"
+                  name="Command Line"
+                  id="cygwin.compiler.category.commandline">
+            </optionCategory>
+            <option
+                  name="Compiler Command Line"
+                  category="cygwin.compiler.category.commandline"
+                  id="cygwin.compiler.commandline.args">
+            </option>
+         </tool>
+      </target>
+      <target
+            isTest="false"
+            name="Cygwin Executable"
+            parent="cygwin"
+            defaultExtension="exe"
+            isAbstract="false"
+            id="cygwin.exec">
+         <configuration
+               name="Release"
+               id="cygwin.exec.release">
+         </configuration>
+         <configuration
+               name="Debug"
+               id="cygwin.exec.debug">
+         </configuration>
+         <tool
+               name="%ToolName.linker"
+               outputs="exe"
+               command="g++"
+               id="org.eclipse.cdt.build.tool.cygwin.link">
+            <optionCategory
+                  owner="org.eclipse.cdt.build.tool.cygwin.link"
+                  name="General"
+                  id="cygwin.linker.category.general">
+            </optionCategory>
+            <option
+                  defaultValue="-o"
+                  name="Linker Flags"
+                  category="cygwin.linker.category.general"
+                  valueType="string"
+                  id="cygwin.link.ld.flags">
+            </option>
+            <option
+                  name="Library Paths"
+                  category="cygwin.linker.category.general"
+                  command="-L"
+                  valueType="stringList"
+                  id="cygwin.link.ld.paths">
+            </option>
+            <option
+                  name="Libraries"
+                  category="cygwin.linker.category.general"
+                  command="-l"
+                  valueType="stringList"
+                  id="cygwin.link.libs">
+            </option>
+            <optionCategory
+                  owner="org.eclipse.cdt.build.tool.cygwin.link"
+                  name="Command Line"
+                  id="cygwin.linker.category.commandline">
+            </optionCategory>
+            <option
+                  name="Linker Command Line"
+                  category="cygwin.linker.category.commandline"
+                  id="cygwin.linker.commandline.args">
+            </option>
+         </tool>
+      </target>
+      <target
+            isTest="true"
+            name="Cygwin Shared Library"
+            parent="cygwin"
+            defaultExtension="dll.a"
+            isAbstract="false"
+            id="cygwin.so">
+         <configuration
+               name="Release"
+               id="cygwin.so.release">
+         </configuration>
+         <configuration
+               name="Debug"
+               id="cygwin.so.debug">
+         </configuration>
+         <tool
+               name="%ToolName.linker"
+               outputs="dll.a"
+               id="org.eclipse.cdt.build.tool.cygwin.solink">
+            <optionCategory
+                  owner="org.eclipse.cdt.build.tool.cygwin.solink"
+                  name="General"
+                  id="cygwin.solink.category.general">
+            </optionCategory>
+            <option
+                  defaultValue="-shared"
+                  name="Linker Flags"
+                  category="cygwin.solink.category.general"
+                  valueType="string"
+                  id="cygwin.solink.ld.flags">
+            </option>
+            <option
+                  name="Library Paths"
+                  category="cygwin.solink.category.general"
+                  command="-L"
+                  valueType="stringList"
+                  id="cygwin.solink.ld.paths">
+            </option>
+            <option
+                  name="Libraries"
+                  category="cygwin.solink.category.general"
+                  command="-l"
+                  valueType="stringList"
+                  id="cygwin.solink.libs">
+            </option>
+         </tool>
+      </target>
+      <target
+            isTest="false"
+            name="Cygwin Static Library"
+            parent="cygwin"
+            defaultExtension="a"
+            isAbstract="false"
+            id="cygwin.lib">
+         <configuration
+               name="Release"
+               id="cygwin.lib.release">
+         </configuration>
+         <configuration
+               name="Debug"
+               id="cygwin.lib.debug">
+         </configuration>
+         <tool
+               name="%ToolName.archiver"
+               outputs="a"
+               command="ar"
+               id="org.eclipse.cdt.build.tool.cygwin.ar">
+         </tool>
+      </target>
+      <target
+            isTest="true"
+            name="Linux"
+            isAbstract="true"
+            id="linux">
+         <tool
+               name="Compiler"
+               id="linux.compiler">
+            <optionCategory
+                  owner="linux.compiler"
+                  name="Optimization Options"
+                  id="linux.compiler.optimization">
+            </optionCategory>
+            <option
+                  name="Compiler Flags"
+                  valueType="string"
+                  id="linux.compiler.flags">
+            </option>
+            <option
+                  name="Optimization Flags"
+                  category="linux.compiler.optimization"
+                  value="-O"
+                  valueType="string"
+                  id="linux.compiler.optimizationFlags">
+            </option>
+         </tool>
+      </target>
+      <target
+            isTest="true"
+            name="Linux Executable"
+            parent="linux"
+            isAbstract="false"
+            id="linux.exec">
+         <tool
+               name="Linker"
+               id="org.eclipse.cdt.ui.tests.tool.linux.link">
+         </tool>
+         <configuration
+               name="Release"
+               id="linux.exec.release">
+         </configuration>
+         <configuration
+               name="Debug"
+               id="linux.exec.debug">
+         </configuration>
+      </target>
+      <target
+            isTest="true"
+            name="Linux Shared Library"
+            parent="linux"
+            defaultExtension=".so"
+            isAbstract="false"
+            id="linux.so">
+         <tool
+               name="Linker"
+               id="org.eclipse.cdt.ui.tests.tool.linux.solink">
+         </tool>
+      </target>
+      <target
+            isTest="true"
+            name="Linux Static Library"
+            parent="linux"
+            defaultExtension=".a"
+            isAbstract="false"
+            id="linux.lib">
+         <tool
+               name="Archiver"
+               id="org.eclipse.cdt.ui.tests.tool.linux.ar">
+         </tool>
+      </target>
    </extension>
 
 </plugin>
Index: icons/full/build16/config-command.gif
===================================================================
RCS file: icons/full/build16/config-command.gif
diff -N icons/full/build16/config-command.gif
Binary files /dev/null and config-command.gif differ
Index: icons/full/build16/config-librarian.gif
===================================================================
RCS file: icons/full/build16/config-librarian.gif
diff -N icons/full/build16/config-librarian.gif
Binary files /dev/null and config-librarian.gif differ
Index: icons/full/build16/config-tool.gif
===================================================================
RCS file: icons/full/build16/config-tool.gif
diff -N icons/full/build16/config-tool.gif
Binary files /dev/null and config-tool.gif differ
Index: icons/full/ctool16/newmngc_app.gif
===================================================================
RCS file: icons/full/ctool16/newmngc_app.gif
diff -N icons/full/ctool16/newmngc_app.gif
Binary files /dev/null and newmngc_app.gif differ
Index: icons/full/ctool16/newmngcc_app.gif
===================================================================
RCS file: icons/full/ctool16/newmngcc_app.gif
diff -N icons/full/ctool16/newmngcc_app.gif
Binary files /dev/null and newmngcc_app.gif differ
Index: src/org/eclipse/cdt/internal/ui/CPluginImages.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/CPluginImages.java,v
retrieving revision 1.16
diff -u -r1.16 CPluginImages.java
--- src/org/eclipse/cdt/internal/ui/CPluginImages.java	27 May 2003 21:33:02 -0000	1.16
+++ src/org/eclipse/cdt/internal/ui/CPluginImages.java	6 Jun 2003 20:05:35 -0000
@@ -35,6 +35,7 @@
 	private static final int NAME_PREFIX_LENGTH= NAME_PREFIX.length();
 	private static final String T= "full/";
 
+	public static final String T_BUILD= T + "build16/";
 	public static final String T_OBJ= T + "obj16/";
 	public static final String T_WIZBAN= T + "wizban/";
 	public static final String T_LCL=  "lcl16/";
@@ -147,6 +148,22 @@
 	public static final String IMG_OBJS_BUILD= NAME_PREFIX + "build_menu.gif";
 	public static final ImageDescriptor DESC_BUILD_MENU = createManaged(T_OBJ, IMG_OBJS_BUILD);
 	
+	// For the managed build images
+	public static final String IMG_BUILD_CONFIG = NAME_PREFIX + "build_configs.gif";
+	public static final ImageDescriptor DESC_BUILD_CONFIG = createManaged(T_BUILD, IMG_BUILD_CONFIG);
+	public static final String IMG_BUILD_COMPILER = NAME_PREFIX + "config-compiler.gif";
+	public static final ImageDescriptor DESC_BUILD_COMPILER = createManaged(T_BUILD, IMG_BUILD_COMPILER);
+	public static final String IMG_BUILD_LINKER = NAME_PREFIX + "config-linker.gif";
+	public static final ImageDescriptor DESC_BUILD_LINKER = createManaged(T_BUILD, IMG_BUILD_LINKER);
+	public static final String IMG_BUILD_LIBRARIAN = NAME_PREFIX + "config-librarian.gif";
+	public static final ImageDescriptor DESC_BUILD_LIBRARIAN = createManaged(T_BUILD, IMG_BUILD_LIBRARIAN);
+	public static final String IMG_BUILD_COMMAND = NAME_PREFIX + "config-command.gif";
+	public static final ImageDescriptor DESC_BUILD_COMMAND = createManaged(T_BUILD, IMG_BUILD_COMMAND);
+	public static final String IMG_BUILD_PREPROCESSOR = NAME_PREFIX + "config-preprocessor.gif";
+	public static final ImageDescriptor DESC_BUILD_PREPROCESSOR = createManaged(T_BUILD, IMG_BUILD_PREPROCESSOR);
+	public static final String IMG_BUILD_TOOL = NAME_PREFIX + "config-tool.gif";
+	public static final ImageDescriptor DESC_BUILD_TOOL = createManaged(T_BUILD, IMG_BUILD_TOOL);
+
 	public static void initialize() {
 		//createManaged(registry, T_OBJ, IMG_OBJS_TUNIT);
 		//createManaged(registry, T_OBJ, IMG_OBJS_FIELD);
Index: src/org/eclipse/cdt/internal/ui/CPluginResources.properties
===================================================================
RCS file: /home/tools/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/CPluginResources.properties,v
retrieving revision 1.12
diff -u -r1.12 CPluginResources.properties
--- src/org/eclipse/cdt/internal/ui/CPluginResources.properties	27 May 2003 21:33:02 -0000	1.12
+++ src/org/eclipse/cdt/internal/ui/CPluginResources.properties	6 Jun 2003 20:05:35 -0000
@@ -64,6 +64,21 @@
 SettingsBlock.makeOption.use_default=Use Default
 SettingsBlock.makeOption.build_cmd=Build Command:
 
+#Strings for the platform selection tab
+PlatformBlock.label.platform=Platform:
+PlatformBlock.tip.platform=Select the platform you wish to deploy on
+PlatformBlock.label.configs=Configurations:
+
+# String constants for the build configuration tab
+ConfigurationBlock.label=Build Information
+ConfigurationBlock.type=Project Type
+ConfigurationBlock.type.app=Application
+ConfigurationBlock.type.shared=Shared Library/DLL
+ConfigurationBlock.type.static=Static Library
+ConfigurationBlock.build.label=Build Settings
+ConfigurationBlock.build.continue=Continue On Error
+ConfigurationBlock.build.stop=Stop On Error
+
 StdMakeProjectWizard.op_error=Standard Make Error
 StdMakeProjectWizard.title=Standard Make Project
 StdMakeProjectWizard.description=Create a new Standard Make project.
@@ -80,6 +95,22 @@
 StdCCWizardSettings.title=Standard Make C++ Settings
 StdCCWizardSettings.description=Define the Standard Make C++ build settings.
 
+MngMakeProjectWizard.op_error=Managed Make Error
+MngMakeProjectWizard.title=Managed Make Project
+MngMakeProjectWizard.description=Create a new Managed Make project.
+MngMakeProjectWizardSettings.title=Managed Make Settings
+MngMakeProjectWizardSettings.description=Define the Managed Make build settings.
+
+MngCWizard.title=Managed Make C Project
+MngCWizard.description=Create a new Managed Make C project.
+MngCWizardSettings.title=Managed Make C Settings
+MngCWizardSettings.description=Define the Managed Make C build settings.
+
+MngCCWizard.title=Managed Make C++ Project
+MngCCWizard.description=Create a new Managed Make C++ Project.
+MngCCWizardSettings.title=Managed Make C++ Settings
+MngCCWizardSettings.description=Define the Managed Make C++ build settings.
+
 NewClassWizard.title=New Class
 NewClassWizard.description=Create a new C++ Class.
 NewClassWizard.page.title=Class
@@ -262,4 +293,36 @@
 CreateFolderAction.text = F&older
 
 # ------- Drag and Drop Message Text -----------
-CViewDragNDrop.txt = already exists. Would you like to overwrite it?
\ No newline at end of file
+CViewDragNDrop.txt = already exists. Would you like to overwrite it?
+
+# ----------- Build Property Page -----------
+BuildPropertyPage.label.Platform=Platform:
+BuildPropertyPage.label.Configuration=Configuration:
+BuildPropertyPage.label.Active=Active configuration
+BuildPropertyPage.label.Settings=Configuration settings
+BuildPropertyPage.label.AddConfButton=Manage...
+BuildPropertyPage.label.ToolTree=Tools
+BuildPropertyPage.label.ToolOptions=Options
+BuildPropertyPage.tip.platform=Select a platform for the project
+BuildPropertyPage.tip.config=Select the configuration to edit
+BuildPropertyPage.tip.addconf=Add configurations for the platform
+BuildPropertyPage.tip.remconf=Remove configurations for the platform
+BuildPropertyPage.manage.title=Manage Configurations
+
+# ----------- Build Property Common -----------
+BuildPropertyCommon.label.title=Enter Value
+BuildPropertyCommon.label.new=New...
+BuildPropertyCommon.label.remove=Remove
+BuildPropertyCommon.label.up=Move Up
+BuildPropertyCommon.label.down=Move Down
+BuildPropertyCommon.label.editVar=Edit
+BuildPropertyCommon.label.addVar=Add
+BuildPropertyCommon.label.message=Value:
+BuildPropertyCommon.label.browse=Browse...
+BuildPropertyCommon.label.configs=Defined configurations:
+
+# ----------- New Configuration -----------
+NewConfiguration.label.name=Configuration name:
+NewConfiguration.label.copy=Copy settings from:
+NewConfiguration.error.title=Error
+NewConfiguration.error.duplicateName=A configuration named "{0}" already exists.
Index: cdt.ui.tests.patch.txt
===================================================================
RCS file: cdt.ui.tests.patch.txt
diff -N cdt.ui.tests.patch.txt
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ cdt.ui.tests.patch.txt	6 Jun 2003 20:05:53 -0000
@@ -0,0 +1,150 @@
+Index: plugin.xml
+===================================================================
+RCS file: /home/tools/org.eclipse.cdt.ui.tests/plugin.xml,v
+retrieving revision 1.6
+diff -u -r1.6 plugin.xml
+--- plugin.xml	9 Apr 2003 15:14:56 -0000	1.6
++++ plugin.xml	9 Apr 2003 20:51:47 -0000
+@@ -36,6 +36,7 @@
+                name="Compiler"
+                id="linux.compiler">
+             <optionCategory
++                  owner="linux.compiler"
+                   name="Optimization Options"
+                   id="linux.compiler.optimization">
+             </optionCategory>
+@@ -94,6 +95,41 @@
+       <target
+             name="Test Root"
+             id="test.root">
++         <configuration
++               name="Root Config"
++               id="root.config">
++         </configuration>
++         <tool
++               name="Root Tool"
++               id="root.tool">
++            <optionCategory
++                  owner="root.tool"
++                  name="Category"
++                  id="category">
++            </optionCategory>
++            <option
++                  name="Option in Top"
++                  id="topOption">
++            </option>
++            <option
++                  name="Option in Category"
++                  category="category"
++                  id="childOption">
++            </option>
++         </tool>
++      </target>
++      <target
++            name="Test Sub"
++            parent="test.root"
++            id="test.sub">
++         <configuration
++               name="Sub Config"
++               id="sub.config">
++         </configuration>
++         <tool
++               name="Sub Tool"
++               id="tool.sub">
++         </tool>
+       </target>
+    </extension>
+ 
+Index: build/org/eclipse/cdt/core/build/managed/tests/AllBuildTests.java
+===================================================================
+RCS file: /home/tools/org.eclipse.cdt.ui.tests/build/org/eclipse/cdt/core/build/managed/tests/AllBuildTests.java,v
+retrieving revision 1.3
+diff -u -r1.3 AllBuildTests.java
+--- build/org/eclipse/cdt/core/build/managed/tests/AllBuildTests.java	9 Apr 2003 15:14:56 -0000	1.3
++++ build/org/eclipse/cdt/core/build/managed/tests/AllBuildTests.java	9 Apr 2003 20:51:47 -0000
+@@ -14,7 +14,11 @@
+ import junit.framework.TestCase;
+ import junit.framework.TestSuite;
+ 
++import org.eclipse.cdt.core.build.managed.IConfiguration;
++import org.eclipse.cdt.core.build.managed.IOption;
++import org.eclipse.cdt.core.build.managed.IOptionCategory;
+ import org.eclipse.cdt.core.build.managed.ITarget;
++import org.eclipse.cdt.core.build.managed.ITool;
+ import org.eclipse.cdt.core.build.managed.ManagedBuildManager;
+ 
+ /**
+@@ -43,7 +47,8 @@
+ 	 * defined in this plugin
+ 	 */
+ 	public void testExtensions() {
+-		boolean testRootFound = false;
++		ITarget testRoot = null;
++		ITarget testSub = null;
+ 		
+ 		// Note secret null parameter which means just extensions
+ 		ITarget[] targets = ManagedBuildManager.getDefinedTargets(null);
+@@ -52,10 +57,61 @@
+ 			ITarget target = targets[i];
+ 			
+ 			if (target.getName().equals("Test Root")) {
+-				testRootFound = true;
++				testRoot = target;
++				
++				// Tools
++				ITool[] tools = testRoot.getTools();
++				// Root Tool
++				ITool rootTool = tools[0];
++				assertEquals("Root Tool", rootTool.getName());
++				// Options
++				IOption[] options = rootTool.getOptions();
++				assertEquals(2, options.length);
++				assertEquals("Option in Top", options[0].getName());
++				assertEquals("Option in Category", options[1].getName());
++				// Option Categories
++				IOptionCategory topCategory = rootTool.getTopOptionCategory();
++				assertEquals("Root Tool", topCategory.getName());
++				options = topCategory.getOptions(rootTool);
++				assertEquals(1, options.length);
++				assertEquals("Option in Top", options[0].getName());
++				IOptionCategory[] categories = topCategory.getChildCategories();
++				assertEquals(1, categories.length);
++				assertEquals("Category", categories[0].getName());
++				options = categories[0].getOptions(rootTool);
++				assertEquals(1, options.length);
++				assertEquals("Option in Category", options[0].getName());
++				
++				// Configs
++				IConfiguration[] configs = testRoot.getConfigurations();
++				// Root Config
++				IConfiguration rootConfig = configs[0];
++				assertEquals("Root Config", rootConfig.getName());
++				
++			} else if (target.getName().equals("Test Sub")) {
++				testSub = target;
++				
++				// Tools
++				ITool[] tools = testSub.getTools();
++				// Root Tool
++				ITool rootTool = tools[0];
++				assertEquals("Root Tool", rootTool.getName());
++				// Sub Tool
++				ITool subTool = tools[1];
++				assertEquals("Sub Tool", subTool.getName());
++
++				// Configs
++				IConfiguration[] configs = testSub.getConfigurations();
++				// Root Config
++				IConfiguration rootConfig = configs[0];
++				assertEquals("Root Config", rootConfig.getName());
++				// Sub Config
++				IConfiguration subConfig = configs[1];
++				assertEquals("Sub Config", subConfig.getName());
+ 			}
+ 		}
+ 		
+-		assertTrue(testRootFound);
++		assertNotNull(testRoot);
++		assertNotNull(testSub);
+ 	}
+ }
Index: plugin.xml
===================================================================
RCS file: /home/tools/org.eclipse.cdt.ui.tests/plugin.xml,v
retrieving revision 1.12
diff -u -r1.12 plugin.xml
--- plugin.xml	29 May 2003 14:01:04 -0000	1.12
+++ plugin.xml	6 Jun 2003 20:05:53 -0000
@@ -29,75 +29,16 @@
          name="Tools for Build Test"
          point="org.eclipse.cdt.core.ManagedBuildInfo">
       <target
-            name="Linux"
-            isAbstract="true"
-            id="linux">
-         <tool
-               name="Compiler"
-               id="linux.compiler">
-            <optionCategory
-                  owner="linux.compiler"
-                  name="Optimization Options"
-                  id="linux.compiler.optimization">
-            </optionCategory>
-            <option
-                  name="Compiler Flags"
-                  valueType="string"
-                  id="linux.compiler.flags">
-            </option>
-            <option
-                  name="Optimization Flags"
-                  category="linux.compiler.optimization"
-                  value="-O"
-                  valueType="string"
-                  id="linux.compiler.optimizationFlags">
-            </option>
-         </tool>
-      </target>
-      <target
-            name="Linux Executable"
-            parent="linux"
-            isAbstract="false"
-            id="linux.exec">
-         <tool
-               name="Linker"
-               id="org.eclipse.cdt.ui.tests.tool.linux.link">
-         </tool>
-         <configuration
-               name="Release"
-               id="linux.exec.release">
-         </configuration>
-         <configuration
-               name="Debug"
-               id="linux.exec.debug">
-         </configuration>
-      </target>
-      <target
-            name="Linux Shared Library"
-            parent="linux"
-            isAbstract="false"
-            id="linux.so">
-         <tool
-               name="Linker"
-               id="org.eclipse.cdt.ui.tests.tool.linux.solink">
-         </tool>
-      </target>
-      <target
-            name="Linux Static Library"
-            parent="linux"
-            isAbstract="false"
-            id="linux.lib">
-         <tool
-               name="Archiver"
-               id="org.eclipse.cdt.ui.tests.tool.linux.ar">
-         </tool>
-      </target>
-      <target
+            isTest="true"
             name="Test Root"
+            defaultExtension="toor"
             isAbstract="false"
             id="test.root">
          <tool
+               sources="foo,bar"
                name="Root Tool"
+               outputs="toor"
+               command="doIt"
                id="root.tool">
             <optionCategory
                   owner="root.tool"
@@ -137,14 +78,12 @@
                   id="enumerated.option">
                <optionEnum
                      name="Default Enum"
-                     value="s"
                      isDefault="true"
                      command="-e1"
                      id="default.enum.option">
                </optionEnum>
                <optionEnum
                      name="Another Enum"
-                     value="t"
                      command="-e2"
                      id="another.enum.option">
                </optionEnum>
@@ -161,7 +100,6 @@
                   id="root.tool">
                <optionRef
                      defaultValue="y"
-                     value="y"
                      id="string.option">
                </optionRef>
                <optionRef
@@ -172,8 +110,10 @@
          </configuration>
       </target>
       <target
+            isTest="true"
             name="Test Sub"
             parent="test.root"
+            defaultExtension="bus"
             isAbstract="false"
             id="test.sub">
          <configuration
Index: build/org/eclipse/cdt/core/build/managed/tests/AllBuildTests.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.ui.tests/build/org/eclipse/cdt/core/build/managed/tests/AllBuildTests.java,v
retrieving revision 1.9
diff -u -r1.9 AllBuildTests.java
--- build/org/eclipse/cdt/core/build/managed/tests/AllBuildTests.java	29 May 2003 14:01:04 -0000	1.9
+++ build/org/eclipse/cdt/core/build/managed/tests/AllBuildTests.java	6 Jun 2003 20:05:53 -0000
@@ -11,6 +11,7 @@
 package org.eclipse.cdt.core.build.managed.tests;
 
 import java.util.Arrays;
+import java.util.List;
 
 import junit.framework.Test;
 import junit.framework.TestCase;
@@ -20,6 +21,7 @@
 import org.eclipse.cdt.core.build.managed.IConfiguration;
 import org.eclipse.cdt.core.build.managed.IOption;
 import org.eclipse.cdt.core.build.managed.IOptionCategory;
+import org.eclipse.cdt.core.build.managed.IResourceBuildInfo;
 import org.eclipse.cdt.core.build.managed.ITarget;
 import org.eclipse.cdt.core.build.managed.ITool;
 import org.eclipse.cdt.core.build.managed.ManagedBuildManager;
@@ -35,11 +37,13 @@
  */
 public class AllBuildTests extends TestCase {
 	private static final boolean boolVal = true;
-	private static final String newConfigName = "test.config.override";
+	private static final String testConfigName = "test.config.override";
 	private static final String enumVal = "Another Enum";
 	private static final String[] listVal = {"_DEBUG", "/usr/include", "libglade.a"};
 	private static final String projectName = "BuildTest";
-	private static final String stringVal = "-c -wall";
+	private static final String rootExt = "toor";
+	private static final String stringVal = "-c -Wall";
+	private static final String subExt = "bus";
 
 	public AllBuildTests(String name) {
 		super(name);
@@ -51,14 +55,12 @@
 		suite.addTest(new AllBuildTests("testExtensions"));
 		suite.addTest(new AllBuildTests("testProject"));
 		suite.addTest(new AllBuildTests("testConfigurations"));
+		suite.addTest(new AllBuildTests("testTargetArtifacts"));
+		suite.addTest(new AllBuildTests("cleanup"));
 		
 		return suite;
 	}
 
-	public void testThatAlwaysFails() {
-		assertTrue(false);
-	}
-	
 	/**
 	 * Navigates through the build info as defined in the extensions
 	 * defined in this plugin
@@ -75,30 +77,11 @@
 			
 			if (target.getName().equals("Test Root")) {
 				testRoot = target;
-				
 				checkRootTarget(testRoot, "x");
 				
 			} else if (target.getName().equals("Test Sub")) {
 				testSub = target;
-				
-				// Tools
-				ITool[] tools = testSub.getTools();
-				// Root Tool
-				ITool rootTool = tools[0];
-				assertEquals("Root Tool", rootTool.getName());
-				// Sub Tool
-				ITool subTool = tools[1];
-				assertEquals("Sub Tool", subTool.getName());
-
-				// Configs
-				IConfiguration[] configs = testSub.getConfigurations();
-				// Root Config
-				IConfiguration rootConfig = configs[0];
-				assertEquals("Root Config", rootConfig.getName());
-				assertEquals("Root Override Config", configs[1].getName());
-				// Sub Config
-				IConfiguration subConfig = configs[2];
-				assertEquals("Sub Config", subConfig.getName());
+				checkSubTarget(testSub);
 			}
 		}
 		
@@ -106,6 +89,16 @@
 		assertNotNull(testSub);
 	}
 
+	/**
+	 * Create a new configuration based on one defined in the plugin file.
+	 * Overrides all of the configuration settings. Saves, closes, and reopens 
+	 * the project. Then calls a method to check the overridden options.
+	 * 
+	 * Tests creating a new configuration.
+	 * Tests setting options.
+	 * Tests persisting overridden options between project sessions.
+	 * 
+	 */
 	public void testConfigurations() throws CoreException, BuildException {
 		// Open the test project
 		IProject project = createProject(projectName);
@@ -119,7 +112,7 @@
 		IConfiguration baseConfig = definedConfigs[0];
 		
 		// Create a new configuration
-		IConfiguration newConfig = rootTarget.createConfiguration(baseConfig, newConfigName);
+		IConfiguration newConfig = rootTarget.createConfiguration(baseConfig, testConfigName);
 		assertEquals(3, rootTarget.getConfigurations().length);
 
 		// There is only one tool
@@ -155,29 +148,38 @@
 	public void testProject() throws CoreException, BuildException {
 		// Create new project
 		IProject project = createProject(projectName);
-		
+		// There should not be any targets defined for this project yet
 		assertEquals(0, ManagedBuildManager.getTargets(project).length);
 		
 		// Find the base target definition
 		ITarget targetDef = ManagedBuildManager.getTarget(project, "test.root");
 		assertNotNull(targetDef);
 		
-		// Create the target for our project
+		// Create the target for our project that builds a dummy executable
 		ITarget newTarget = ManagedBuildManager.createTarget(project, targetDef);
 		assertEquals(newTarget.getName(), targetDef.getName());
 		assertFalse(newTarget.equals(targetDef));
+		String buildArtifactName = projectName + "." + newTarget.getDefaultExtension();
+		newTarget.setBuildArtifact(buildArtifactName);
 		
 		ITarget[] targets = ManagedBuildManager.getTargets(project);
 		assertEquals(1, targets.length);
 		ITarget target = targets[0];
 		assertEquals(target, newTarget);
 		assertFalse(target.equals(targetDef));
-		
+
 		// Copy over the configs
+		IConfiguration defaultConfig = null;
 		IConfiguration[] configs = targetDef.getConfigurations();
-		for (int i = 0; i < configs.length; ++i)
-			target.createConfiguration(configs[i], target.getId() + "." + i);
-		
+		for (int i = 0; i < configs.length; ++i) {
+			// Make the first configuration the default 
+			if (i == 0) {
+				defaultConfig = target.createConfiguration(configs[i], target.getId() + "." + i);
+			} else {
+				target.createConfiguration(configs[i], target.getId() + "." + i);
+			}
+		}
+		ManagedBuildManager.setDefaultConfiguration(project, defaultConfig);		
 		checkRootTarget(target, "x");
 		
 		// Override the "String Option in Category" option value
@@ -198,29 +200,86 @@
 		ManagedBuildManager.removeBuildInfo(project);
 		project.open(null);
 		
+		// Test that the default config was remembered
+		IResourceBuildInfo info = ManagedBuildManager.getBuildInfo(project);
+		assertEquals(defaultConfig.getId(), info.getDefaultConfiguration(target).getId());
+
+		// Get the targets
 		targets = ManagedBuildManager.getTargets(project);
 		assertEquals(1, targets.length);
+		// See if the artifact name is remembered
+		assertEquals(targets[0].getArtifactName(), buildArtifactName);
+		// Check the rest of the default information
 		checkRootTarget(targets[0], "z");
+		
+		// Now test the information the makefile builder needs
+		checkBuildSettings(project);
 	}
 	
-	IProject createProject(String name) throws CoreException {
-		IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
-		IProject project = root.getProject(name);
-		if (!project.exists()) {
-			project.create(null);
-		} else {
-			project.refreshLocal(IResource.DEPTH_INFINITE, null);
-		}
-        
-		if (!project.isOpen()) {
-			project.open(null);
-		}
+	/**
+	 * Tests the tool settings through the interface the makefile generator
+	 * uses.
+	 * 
+	 * @param project
+	 */
+	private void checkBuildSettings(IProject project) {
+		String ext1 = "foo";
+		String ext2 = "bar";
+		String badExt = "cpp";
+		String expectedOutput = "toor";
+		String expectedCmd = "doIt";
+		
+		// Get that interface, Rover. Go get it. That's a good doggie! Good boy.
+		IResourceBuildInfo info = ManagedBuildManager.getBuildInfo(project);
+		assertNotNull(info);
+		assertEquals(info.getBuildArtifactName(), "BuildTest.toor");
+		
+		// There should be a default configuration defined for the project
+		ITarget buildTarget = info.getDefaultTarget();
+		assertNotNull(buildTarget);
+		assertEquals(buildTarget.getId(), "test.root.1");
+		IConfiguration buildConfig = info.getDefaultConfiguration(buildTarget);
+		assertNotNull(buildConfig);
+		assertEquals(buildConfig.getId(), "test.root.1.0");
+				
+		// The default target should be the same as the one-and-only target in the project
+		List targets = info.getTargets();
+		assertEquals(targets.size(), 1);
+		ITarget target = (ITarget) targets.get(0);
+		assertEquals(target, buildTarget);
+		
+		// Check that tool handles resources with extensions foo and bar by building a baz
+		assertEquals(info.getOutputExtension(ext1), expectedOutput);
+		assertEquals(info.getOutputExtension(ext2), expectedOutput);
+		
+		// Check that it ignores others based on filename extensions
+		assertNull(info.getOutputExtension(badExt));
+		
+		// Now see what the tool command line invocation is for foo and bar
+		assertEquals(info.getToolForSource(ext1), expectedCmd);
+		assertEquals(info.getToolForSource(ext2), expectedCmd);
+		// Make sure that there is no tool to build files of type foo and bar
+		assertNull(info.getToolForTarget(ext1));
+		assertNull(info.getToolForTarget(ext2));
+		
+		// There is no target that builds toor
+		assertNull(info.getToolForSource(expectedOutput));
+		// but there is one that produces it
+		assertEquals(info.getToolForTarget(expectedOutput), expectedCmd);
+		
+		// Now check the build flags
+		assertEquals(info.getFlagsForSource(ext1), "-La -Lb z -e1");
+		assertEquals(info.getFlagsForSource(ext1), info.getFlagsForSource(ext2));
 		
-		//CCorePlugin.getDefault().convertProjectToC(project, null, CCorePlugin.PLUGIN_ID + ".make", true);
-
-		return project;	
 	}
 	
+	/**
+	 * Tests that overridden options are properly read into build model.
+	 * Test that option values that are not overridden remain the same.
+	 * 
+	 * @param project The project to get build model information for.
+	 * @throws BuildException
+	 */
 	private void checkOptionReferences(IProject project) throws BuildException {
 		// Get the targets out of the project
 		ITarget[] definedTargets = ManagedBuildManager.getTargets(project);
@@ -230,7 +289,7 @@
 		// Now get the configs
 		IConfiguration[] definedConfigs = rootTarget.getConfigurations(); 		
 		assertEquals(3, definedConfigs.length);
-		IConfiguration newConfig = rootTarget.getConfiguration(newConfigName);
+		IConfiguration newConfig = rootTarget.getConfiguration(testConfigName);
 		assertNotNull(newConfig);
 
 		// Now get the tool options and make sure the values are correct		
@@ -273,6 +332,10 @@
 	
 	
 	private void checkRootTarget(ITarget target, String oicValue) throws BuildException {
+		// Target stuff
+		assertTrue(target.isTestTarget());
+		assertEquals(target.getDefaultExtension(), rootExt);
+		
 		// Tools
 		ITool[] tools = target.getTools();
 		// Root Tool
@@ -376,4 +439,115 @@
 		assertEquals("-e2", options[1].getEnumCommand(valueList[1]));
 	}
 
+	private void checkSubTarget(ITarget target) {
+		// Make sure this is a test target
+		assertTrue(target.isTestTarget());
+		// Make sure the build artifact extension is there
+		assertEquals(target.getDefaultExtension(), subExt);
+				
+		// Tools
+		ITool[] tools = target.getTools();
+		// Root Tool
+		ITool rootTool = tools[0];
+		assertEquals("Root Tool", rootTool.getName());
+		// Sub Tool
+		ITool subTool = tools[1];
+		assertEquals("Sub Tool", subTool.getName());
+
+		// Configs
+		IConfiguration[] configs = target.getConfigurations();
+		// Root Config
+		IConfiguration rootConfig = configs[0];
+		assertEquals("Root Config", rootConfig.getName());
+		assertEquals("Root Override Config", configs[1].getName());
+		// Sub Config
+		IConfiguration subConfig = configs[2];
+		assertEquals("Sub Config", subConfig.getName());
+	}
+
+	/**
+	 * Remove all the project information associated with the project used during test.
+	 */
+	public void cleanup() {
+		removeProject(projectName);
+	}
+	
+	/**
+	 * Create a new project named <code>name</code> or return the project in 
+	 * the workspace of the same name if it exists.
+	 * 
+	 * @param name The name of the project to create or retrieve.
+	 * @return 
+	 * @throws CoreException
+	 */
+	private IProject createProject(String name) throws CoreException {
+		IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
+		IProject project = root.getProject(name);
+		if (!project.exists()) {
+			project.create(null);
+		} else {
+			project.refreshLocal(IResource.DEPTH_INFINITE, null);
+		}
+        
+		if (!project.isOpen()) {
+			project.open(null);
+		}
+		
+		//CCorePlugin.getDefault().convertProjectToC(project, null, CCorePlugin.PLUGIN_ID + ".make", true);
+
+		return project;	
+	}
+	
+	/**
+	 * Remove the <code>IProject</code> with the name specified in the argument from the 
+	 * receiver's workspace.
+	 *  
+	 * @param name
+	 */
+	private void removeProject(String name) {
+		IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
+		IProject project = root.getProject(name);
+		if (project.exists()) {
+			try {
+				project.delete(true, false, null);
+			} catch (CoreException e) {
+				assertTrue(false);
+			}
+		}
+	}
+	
+	/**
+	 * Test that the build artifact of a <code>ITarget</code> can be modified
+	 * programmatically.
+	 */
+	public void testTargetArtifacts () throws CoreException {
+		// Open the test project
+		IProject project = createProject(projectName);
+		
+		// Make sure there is one and only one target
+		ITarget[] definedTargets = ManagedBuildManager.getTargets(project);
+		assertEquals(1, definedTargets.length);
+		ITarget rootTarget = definedTargets[0];
+		
+		// Set the build artifact of the target
+		String ext = rootTarget.getDefaultExtension();
+		String name = project.getName() + "." + ext;
+		rootTarget.setBuildArtifact(name);
+		
+		// Save, close, reopen and test again
+		ManagedBuildManager.saveBuildInfo(project);
+		project.close(null);
+		ManagedBuildManager.removeBuildInfo(project);
+		project.open(null);
+
+		// Make sure there is one and only one target
+		definedTargets = ManagedBuildManager.getTargets(project);
+		assertEquals(1, definedTargets.length);
+		rootTarget = definedTargets[0];
+		assertEquals(name, rootTarget.getArtifactName());
+	}
+
+	public void testThatAlwaysFails() {
+		assertTrue(false);
+	}
 }

Back to the top