[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
[cdt-patch] MBS Patch for 2.1
|
Attached are patch files for the MBS packages. The
patches contain:
- 4 bug fixes for the new MBS
code.
- Change to the handling of all
of the Java class attributes (commandLineGenerator, buildfileGenerator,
dependencyGenerator) to be like the scannerInfoCollector attribute is now
handled.
- Some new test for the new
model. Note that the old ManagedBuildCoreTests.java was renamed to
ManagedBuildCoreTests20.java, and the new tests are in
ManagedBuildCoreTests.java.
Regards,
Leo
|
Index: src/org/eclipse/cdt/managedbuilder/internal/ui/PluginResources.properties
===================================================================
RCS file: /home/tools/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/internal/ui/PluginResources.properties,v
retrieving revision 1.20
diff -u -r1.20 PluginResources.properties
--- src/org/eclipse/cdt/managedbuilder/internal/ui/PluginResources.properties 28 Oct 2004 17:16:33 -0000 1.20
+++ src/org/eclipse/cdt/managedbuilder/internal/ui/PluginResources.properties 1 Nov 2004 19:31:13 -0000
@@ -86,6 +86,7 @@
ResourceBuildPropertyPage.selection.configuration.all=All configurations
ResourceBuildPropertyPage.label.ToolTree=Tools
ResourceBuildPropertyPage.label.ToolOptions=Options
+ResourceBuildPropertyPage.label.NotMBSFile=The project is closed or the file is not contained within a Managed Make project.
# ----------- Entry Dialog -----------
BrowseEntryDialog.error.Folder_name_invalid = Folder name invalid
Index: src/org/eclipse/cdt/managedbuilder/internal/ui/ToolsSettingsBlock.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/internal/ui/ToolsSettingsBlock.java,v
retrieving revision 1.1
diff -u -r1.1 ToolsSettingsBlock.java
--- src/org/eclipse/cdt/managedbuilder/internal/ui/ToolsSettingsBlock.java 28 Oct 2004 17:16:33 -0000 1.1
+++ src/org/eclipse/cdt/managedbuilder/internal/ui/ToolsSettingsBlock.java 1 Nov 2004 19:31:14 -0000
@@ -189,8 +189,8 @@
}
/* (non-Javadoc)
- * Method displayOptionsForTool.
- * @param toolReference
+ * Method displayOptionsForCategory
+ * @param category
*/
private void displayOptionsForCategory(IOptionCategory category) {
// Do nothing if the selected category is is unchanged
@@ -264,6 +264,7 @@
}
/* (non-Javadoc)
+ * Method displayOptionsForTool
* @param tool
*/
private void displayOptionsForTool(ITool tool) {
@@ -315,9 +316,7 @@
// Make the current page visible
currentSettingsPage.setVisible(true);
- // save the last page build options.
- // If the last page is tool page then parse all the options
- // and put it in the appropriate preference store.
+ // Save the last page build options.
if (oldPage != null){
if(oldPage instanceof BuildOptionSettingsPage) {
((BuildOptionSettingsPage)oldPage).storeSettings();
@@ -327,7 +326,7 @@
//((BuildToolSettingsPage)oldPage).parseAllOptions();
}
}
- //update the field editor that displays all the build options
+ // Update the field editor that displays all the build options
if(currentSettingsPage instanceof BuildToolSettingsPage)
((BuildToolSettingsPage)currentSettingsPage).updateAllOptionField();
Index: src/org/eclipse/cdt/managedbuilder/ui/properties/ResourceBuildPropertyPage.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.managedbuilder.ui/src/org/eclipse/cdt/managedbuilder/ui/properties/ResourceBuildPropertyPage.java,v
retrieving revision 1.1
diff -u -r1.1 ResourceBuildPropertyPage.java
--- src/org/eclipse/cdt/managedbuilder/ui/properties/ResourceBuildPropertyPage.java 28 Oct 2004 17:16:33 -0000 1.1
+++ src/org/eclipse/cdt/managedbuilder/ui/properties/ResourceBuildPropertyPage.java 1 Nov 2004 19:31:15 -0000
@@ -15,6 +15,7 @@
import org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo;
import org.eclipse.cdt.managedbuilder.core.IResourceConfiguration;
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
+import org.eclipse.cdt.managedbuilder.core.ManagedCProjectNature;
import org.eclipse.cdt.managedbuilder.internal.ui.ManagedBuildOptionBlock;
import org.eclipse.cdt.managedbuilder.internal.ui.ManagedBuilderHelpContextIds;
import org.eclipse.cdt.managedbuilder.internal.ui.ManagedBuilderUIMessages;
@@ -23,6 +24,7 @@
import org.eclipse.cdt.utils.ui.controls.ControlFactory;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.Preferences;
import org.eclipse.jface.dialogs.MessageDialog;
@@ -66,6 +68,7 @@
private static final String RESOURCE_SETTINGS_LABEL = LABEL + ".ResourceSettings"; //$NON-NLS-1$
private static final String TREE_LABEL = LABEL + ".ToolTree"; //$NON-NLS-1$
private static final String OPTIONS_LABEL = LABEL + ".ToolOptions"; //$NON-NLS-1$
+ private static final String NOTMBSFILE_LABEL = LABEL + ".NotMBSFile"; //$NON-NLS-1$
private static final String EXCLUDE_CHECKBOX = LABEL + ".ExcludeCheckBox"; //$NON-NLS-1$
private static final String TIP = PREFIX + ".tip"; //$NON-NLS-1$
private static final String RESOURCE_PLAT_TIP = TIP + ".ResourcePlatform"; //$NON-NLS-1$
@@ -83,11 +86,12 @@
// private Point lastShellSize;
private Button excludedCheckBox;
- private boolean isExcluded = false;
/*
* Bookeeping variables
*/
+ private boolean isExcluded = false;
+ private boolean noContentOnPage = false;
private IConfiguration[] configurations;
@@ -111,9 +115,7 @@
}
protected Control createContents(Composite parent) {
- GridData gd;
-
-// Create the container we return to the property page editor
+ // Create the container we return to the property page editor
Composite composite = new Composite(parent, SWT.NULL);
composite.setFont(parent.getFont());
GridLayout compositeLayout = new GridLayout();
@@ -121,8 +123,28 @@
compositeLayout.marginHeight = 0;
compositeLayout.marginWidth = 0;
composite.setLayout( compositeLayout );
+
+ // Check to see if we are dealing with a managed build project
+ boolean openMBSProject;
+ try {
+ openMBSProject = (getProject().hasNature(ManagedCProjectNature.MNG_NATURE_ID));
+ } catch (CoreException e) {
+ openMBSProject = false;
+ }
-// Initialize the key data
+ if (openMBSProject) {
+ contentForMBSFile(composite);
+ } else {
+ noContent(composite);
+ }
+
+ return composite;
+ }
+
+ protected void contentForMBSFile(Composite composite) {
+ GridData gd;
+
+ // Initialize the key data
IManagedBuildInfo info = ManagedBuildManager.getBuildInfo(getProject());
if (info.getVersion() == null) {
// Display a message page instead of the properties control
@@ -130,7 +152,6 @@
invalidInfo.setFont(composite.getFont());
invalidInfo.setText(ManagedBuilderUIMessages.getResourceString("ResourceBuildPropertyPage.error.version_low")); //$NON-NLS-1$
invalidInfo.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING,GridData.VERTICAL_ALIGN_CENTER, true, true));
- return composite;
}
// Add a config selection area
@@ -179,16 +200,24 @@
fd.right = new FormAttachment(80, -20);
configSelector.setLayoutData(fd);
-// Create the Tools Settings, Build Settings, ... Tabbed pane
+ // Create the Tools Settings, Build Settings, ... Tabbed pane
Group tabGroup = ControlFactory.createGroup(composite, ManagedBuilderUIMessages.getResourceString(RESOURCE_SETTINGS_LABEL), 1);
gd = new GridData(GridData.FILL_BOTH);
tabGroup.setLayoutData(gd);
fOptionBlock.createContents(tabGroup, getElement());
-// Update the contents of the configuration widget
+ // Update the contents of the configuration widget
populateConfigurations();
WorkbenchHelp.setHelp(composite,ManagedBuilderHelpContextIds.MAN_PROJ_BUILD_PROP);
- return composite;
+ }
+
+ protected void noContent(Composite composite) {
+ Label label = new Label(composite, SWT.LEFT);
+ label.setText(ManagedBuilderUIMessages.getResourceString(NOTMBSFILE_LABEL));
+ label.setFont(composite.getFont());
+
+ noContentOnPage = true;
+ noDefaultAndApplyButton();
}
private void handleIsExcluded() {
@@ -310,8 +339,12 @@
*/
public boolean performOk() {
+ // If there is no content on the page, then there is nothing to do
+ if (noContentOnPage) return true;
+
// If the user did not visit this page, then there is nothing to do.
if (!displayedConfig) return true;
+
IRunnableWithProgress runnable = new IRunnableWithProgress() {
public void run(IProgressMonitor monitor) {
fOptionBlock.performApply(monitor);
@@ -484,4 +517,4 @@
public void setExcluded(boolean isExcluded) {
this.isExcluded = isExcluded;
}
-}
+}
\ No newline at end of file
Index: schema/buildDefinitions.exsd
===================================================================
RCS file: /home/tools/org.eclipse.cdt.managedbuilder.core/schema/buildDefinitions.exsd,v
retrieving revision 1.1
diff -u -r1.1 buildDefinitions.exsd
--- schema/buildDefinitions.exsd 28 Oct 2004 17:16:53 -0000 1.1
+++ schema/buildDefinitions.exsd 1 Nov 2004 19:28:59 -0000
@@ -409,6 +409,9 @@
<documentation>
Specifies the name of the class that implements IManagedCommandLineGenerator (TBS).
</documentation>
+ <appInfo>
+ <meta.attribute kind="java"/>
+ </appInfo>
</annotation>
</attribute>
<attribute name="dependencyCalculator" type="string">
@@ -903,7 +906,7 @@
id="buildExample"
name="Definitions for Build Example"
point="org.eclipse.cdt.managedbuilder.core.buildDefinitions">
- etc...
+ etc...
</pre>
</documentation>
</annotation>
Index: src/org/eclipse/cdt/managedbuilder/core/IBuilder.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/IBuilder.java,v
retrieving revision 1.1
diff -u -r1.1 IBuilder.java
--- src/org/eclipse/cdt/managedbuilder/core/IBuilder.java 28 Oct 2004 17:16:53 -0000 1.1
+++ src/org/eclipse/cdt/managedbuilder/core/IBuilder.java 1 Nov 2004 19:29:00 -0000
@@ -26,6 +26,7 @@
public interface IBuilder extends IBuildObject {
public static final String ARGUMENTS = "arguments"; //$NON-NLS-1$
public static final String BUILDER_ELEMENT_NAME = "builder"; //$NON-NLS-1$
+ public static final String BUILDFILEGEN_ID ="buildfileGenerator"; //$NON-NLS-1$
public static final String COMMAND = "command"; //$NON-NLS-1$
/**
Index: src/org/eclipse/cdt/managedbuilder/core/ITarget.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/ITarget.java,v
retrieving revision 1.13
diff -u -r1.13 ITarget.java
--- src/org/eclipse/cdt/managedbuilder/core/ITarget.java 28 Oct 2004 17:16:53 -0000 1.13
+++ src/org/eclipse/cdt/managedbuilder/core/ITarget.java 1 Nov 2004 19:29:00 -0000
@@ -11,7 +11,6 @@
package org.eclipse.cdt.managedbuilder.core;
import org.eclipse.cdt.managedbuilder.internal.core.ProjectType;
-import org.eclipse.cdt.managedbuilder.makegen.IManagedDependencyGenerator;
import org.eclipse.core.resources.IResource;
/**
@@ -121,18 +120,6 @@
*/
public String getDefaultExtension();
- /**
- * Answers a class instance that implements an interface to generate
- * source-level dependencies for the tool specified in the argument.
- * This method may return <code>null</code> in which case, the receiver
- * should assume that the tool does not require dependency information
- * when the project is built.
- *
- * @param toolId
- * @return
- */
- public IManagedDependencyGenerator getDependencyGenerator(String toolId);
-
/**
* Answers the command line arguments to pass to the make utility used
* by the receiver to build a project.
Index: src/org/eclipse/cdt/managedbuilder/core/ITool.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/ITool.java,v
retrieving revision 1.10
diff -u -r1.10 ITool.java
--- src/org/eclipse/cdt/managedbuilder/core/ITool.java 28 Oct 2004 17:16:53 -0000 1.10
+++ src/org/eclipse/cdt/managedbuilder/core/ITool.java 1 Nov 2004 19:29:00 -0000
@@ -12,6 +12,10 @@
import java.util.List;
+import org.eclipse.core.runtime.IConfigurationElement;
+
+import org.eclipse.cdt.managedbuilder.makegen.IManagedDependencyGenerator;
+
/**
* This class represents a utility of some sort that is used in the build process.
* A tool will generally process one or more resources to produce output resources.
@@ -22,6 +26,7 @@
public static final String COMMAND = "command"; //$NON-NLS-1$
public static final String COMMAND_LINE_PATTERN = "commandLinePattern"; //$NON-NLS-1$
public static final String COMMAND_LINE_GENERATOR = "commandLineGenerator"; //$NON-NLS-1$
+ public static final String DEP_CALC_ID ="dependencyCalculator"; //$NON-NLS-1$
public static final String INTERFACE_EXTS = "headerExtensions"; //$NON-NLS-1$
public static final String NATURE = "natureFilter"; //$NON-NLS-1$
public static final String OPTION = "option"; //$NON-NLS-1$
@@ -268,10 +273,49 @@
public void setCommandLinePattern(String pattern);
/**
- * Returns command line generator specified for this tool
+ * Returns the plugin.xml element of the commandLineGenerator extension or <code>null</code> if none.
+ *
+ * @return IConfigurationElement
+ */
+ public IConfigurationElement getCommandLineGeneratorElement();
+
+ /**
+ * Sets the CommandLineGenerator plugin.xml element
+ *
+ * @param element
+ */
+ public void setCommandLineGeneratorElement(IConfigurationElement element);
+
+ /**
+ * Returns the command line generator specified for this tool
* @return IManagedCommandLineGenerator
*/
public IManagedCommandLineGenerator getCommandLineGenerator();
+
+ /**
+ * Returns the plugin.xml element of the dependencyGenerator extension or <code>null</code> if none.
+ *
+ * @return IConfigurationElement
+ */
+ public IConfigurationElement getDependencyGeneratorElement();
+
+ /**
+ * Sets the DependencyGenerator plugin.xml element
+ *
+ * @param element
+ */
+ public void setDependencyGeneratorElement(IConfigurationElement element);
+
+ /**
+ * Returns a class instance that implements an interface to generate
+ * source-level dependencies for the tool specified in the argument.
+ * This method may return <code>null</code> in which case, the receiver
+ * should assume that the tool does not require dependency information
+ * when the project is built.
+ *
+ * @return IManagedDependencyGenerator
+ */
+ public IManagedDependencyGenerator getDependencyGenerator();
/**
* Returns an array of command line arguments that have been specified for
Index: src/org/eclipse/cdt/managedbuilder/core/ManagedBuildManager.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/ManagedBuildManager.java,v
retrieving revision 1.29
diff -u -r1.29 ManagedBuildManager.java
--- src/org/eclipse/cdt/managedbuilder/core/ManagedBuildManager.java 28 Oct 2004 17:16:53 -0000 1.29
+++ src/org/eclipse/cdt/managedbuilder/core/ManagedBuildManager.java 1 Nov 2004 19:29:03 -0000
@@ -58,7 +58,6 @@
import org.eclipse.cdt.managedbuilder.internal.core.Tool;
import org.eclipse.cdt.managedbuilder.internal.core.ToolChain;
import org.eclipse.cdt.managedbuilder.makegen.IManagedBuilderMakefileGenerator;
-import org.eclipse.cdt.managedbuilder.makegen.IManagedDependencyGenerator;
import org.eclipse.cdt.managedbuilder.makegen.gnu.GnuMakefileGenerator;
import org.eclipse.cdt.managedbuilder.projectconverter.UpdateManagedProjectManager;
import org.eclipse.cdt.managedbuilder.scannerconfig.IManagedScannerInfoCollector;
@@ -72,7 +71,6 @@
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IExtension;
import org.eclipse.core.runtime.IExtensionPoint;
-import org.eclipse.core.runtime.IExtensionRegistry;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Platform;
@@ -211,68 +209,6 @@
return (IProjectType)getExtensionProjectTypeMap().get(id);
}
- /**
- * Answers an instance of a class that implements the
- * <code>IManagedDependencyGenerator</code> interface to generate
- * the source-level dependencies that make utilities rely on to
- * properly rebuild projects
- *
- * @param toolId the unique <code>ID</code> of the tool to look for
- * @return the dependency generator for the tool specified in the argument or <code>null</code>
- */
- public static IManagedDependencyGenerator getDependencyGenerator(String toolId) {
- return (IManagedDependencyGenerator) getExtensionDepCalcMap().get(toolId);
- }
-
- /**
- * @param toolId
- * @return
- */
- public static IManagedDependencyGenerator createDependencyGenerator(String toolId) {
- try {
- IExtensionRegistry registry = Platform.getExtensionRegistry();
- IExtensionPoint extension = registry.getExtensionPoint(EXTENSION_POINT_ID);
- if (extension != null) {
- // There could be many of these
- IExtension[] extensions = extension.getExtensions();
- // Get the "configuraton elements" defined in the plugin.xml file.
- // Note that these "configuration elements" are not related to the
- // managed build system "configurations".
- // From the PDE Guide:
- // A configuration element, with its attributes and children, directly
- // reflects the content and structure of the extension section within the
- // declaring plug-in's manifest (plugin.xml) file.
- for (int i = 0; i < extensions.length; i++) {
- IConfigurationElement[] configElements = extensions[i].getConfigurationElements();
- for (int j = 0; j < configElements.length; j++) {
- IConfigurationElement element = configElements[j];
- if (element.getName().equals(ITool.TOOL_ELEMENT_NAME)) {
- if (element.getAttribute(ITool.ID).equals(toolId)) {
- if (element.getAttribute(ManagedBuilderCorePlugin.DEP_CALC_ID) != null) {
- return (IManagedDependencyGenerator) element.createExecutableExtension(ManagedBuilderCorePlugin.DEP_CALC_ID);
- }
- }
- } else if (element.getName().equals(ITarget.TARGET_ELEMENT_NAME)) {
- IConfigurationElement[] children = element.getChildren(ITool.TOOL_ELEMENT_NAME);
- for (int k = 0; k < children.length; ++k) {
- IConfigurationElement child = children[k];
- if (child.getAttribute(ITool.ID).equals(toolId)) {
- if (child.getAttribute(ManagedBuilderCorePlugin.DEP_CALC_ID) != null) {
- return (IManagedDependencyGenerator) child.createExecutableExtension(ManagedBuilderCorePlugin.DEP_CALC_ID);
- }
- }
- }
- }
- }
- }
- }
- }
- catch (CoreException e) {
- // Probably not defined
- }
- return null;
- }
-
protected static Map getExtensionDepCalcMap() {
if (depCalculatorsMap == null) {
depCalculatorsMap = new HashMap();
@@ -591,8 +527,8 @@
return (IManagedBuilderMakefileGenerator) element.createExecutableExtension(ManagedBuilderCorePlugin.MAKEGEN_ID);
}
} else {
- if (element.getAttribute(ManagedBuilderCorePlugin.BUILDFILEGEN_ID) != null) {
- return (IManagedBuilderMakefileGenerator) element.createExecutableExtension(ManagedBuilderCorePlugin.BUILDFILEGEN_ID);
+ if (element.getAttribute(IBuilder.BUILDFILEGEN_ID) != null) {
+ return (IManagedBuilderMakefileGenerator) element.createExecutableExtension(IBuilder.BUILDFILEGEN_ID);
}
}
}
@@ -609,29 +545,10 @@
* @param toolId - id selected id
* @return IManagedCommandLineGenerator
*/
- public static IManagedCommandLineGenerator getCommandLineGenerator( String toolId ) {
- try {
- IExtensionRegistry registry = Platform.getExtensionRegistry();
- IExtensionPoint extension = registry.getExtensionPoint(EXTENSION_POINT_ID);
- if (extension != null) {
- // There could be many of these
- IExtension[] extensions = extension.getExtensions();
- for (int i = 0; i < extensions.length; i++) {
- IConfigurationElement[] configElements = extensions[i].getConfigurationElements();
- for (int j = 0; j < configElements.length; j++) {
- IConfigurationElement element = configElements[j];
- if (element.getName().equals(ITool.COMMAND_LINE_GENERATOR)) {
- if (element.getAttribute(ITool.ID).equals(toolId)) {
- if (element.getAttribute(ManagedBuilderCorePlugin.COMMANDLINEGEN_ID) != null) {
- return (IManagedCommandLineGenerator) element.createExecutableExtension(ManagedBuilderCorePlugin.COMMANDLINEGEN_ID);
- }
- }
- }
- }
- }
- }
- } catch( CoreException ex ) {
-
+ public static IManagedCommandLineGenerator getCommandLineGenerator(IConfiguration config, String toolId) {
+ ITool tool = config.getTool(toolId);
+ if (tool != null) {
+ return tool.getCommandLineGenerator();
}
return ManagedCommandLineGenerator.getCommandLineGenerator();
}
@@ -1034,7 +951,6 @@
*/
public static void addExtensionTool(Tool tool) {
getExtensionToolMap().put(tool.getId(), tool);
- getExtensionDepCalcMap().put(tool.getId(), createDependencyGenerator(tool.getId()));
}
/**
Index: src/org/eclipse/cdt/managedbuilder/core/ManagedBuilderCorePlugin.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/ManagedBuilderCorePlugin.java,v
retrieving revision 1.9
diff -u -r1.9 ManagedBuilderCorePlugin.java
--- src/org/eclipse/cdt/managedbuilder/core/ManagedBuilderCorePlugin.java 28 Oct 2004 17:16:53 -0000 1.9
+++ src/org/eclipse/cdt/managedbuilder/core/ManagedBuilderCorePlugin.java 1 Nov 2004 19:29:03 -0000
@@ -20,13 +20,10 @@
public class ManagedBuilderCorePlugin extends Plugin {
private static final String PLUGIN_ID = "org.eclipse.cdt.managedbuilder.core"; //$NON-NLS-1$
- // The attribute name for the dependency calculator
- public static final String DEP_CALC_ID ="dependencyCalculator"; //$NON-NLS-1$
// The shared instance
private static ManagedBuilderCorePlugin plugin;
// The attribute name for the makefile generator
public static final String MAKEGEN_ID ="makefileGenerator"; //$NON-NLS-1$
- public static final String BUILDFILEGEN_ID ="buildfileGenerator"; //$NON-NLS-1$
public static final String COMMANDLINEGEN_ID = "commandlineGenerator"; //$NON-NLS-1$
// The unique id for all managed make projects
public static final String MANAGED_MAKE_PROJECT_ID = ManagedBuilderCorePlugin.getUniqueIdentifier() + ".managedMake"; //$NON-NLS-1$
Index: src/org/eclipse/cdt/managedbuilder/internal/core/Builder.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Builder.java,v
retrieving revision 1.1
diff -u -r1.1 Builder.java
--- src/org/eclipse/cdt/managedbuilder/internal/core/Builder.java 28 Oct 2004 17:16:53 -0000 1.1
+++ src/org/eclipse/cdt/managedbuilder/internal/core/Builder.java 1 Nov 2004 19:29:04 -0000
@@ -19,7 +19,6 @@
import org.eclipse.cdt.managedbuilder.core.IToolChain;
import org.eclipse.cdt.managedbuilder.core.IBuilder;
import org.eclipse.cdt.managedbuilder.core.IManagedConfigElement;
-import org.eclipse.cdt.managedbuilder.core.ManagedBuilderCorePlugin;
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
import org.eclipse.core.runtime.IConfigurationElement;
import org.w3c.dom.Document;
@@ -193,9 +192,11 @@
// Get the semicolon separated list of IDs of the error parsers
errorParserIds = element.getAttribute(IToolChain.ERROR_PARSERS);
- // build file generator
- if (element instanceof DefaultManagedConfigElement)
- buildFileGeneratorElement = ((DefaultManagedConfigElement)element).getConfigurationElement();
+ // Store the configuration element IFF there is a build file generator defined
+ String buildfileGenerator = element.getAttribute(BUILDFILEGEN_ID);
+ if (buildfileGenerator != null && element instanceof DefaultManagedConfigElement) {
+ buildFileGeneratorElement = ((DefaultManagedConfigElement)element).getConfigurationElement();
+ }
}
/* (non-Javadoc)
@@ -253,7 +254,7 @@
// Note: build file generator cannot be specified in a project file because
// an IConfigurationElement is needed to load it!
- if (element.hasAttribute(ManagedBuilderCorePlugin.BUILDFILEGEN_ID)) {
+ if (element.hasAttribute(IBuilder.BUILDFILEGEN_ID)) {
// TODO: Issue warning?
}
}
@@ -466,18 +467,23 @@
}
/* (non-Javadoc)
- * @see org.eclipse.cdt.managedbuilder.core.IBuilder#setBuildFileGeneratorElement(String)
+ * @see org.eclipse.cdt.managedbuilder.core.IBuilder#getBuildFileGeneratorElement()
*/
- public void setBuildFileGeneratorElement(IConfigurationElement element) {
- buildFileGeneratorElement = element;
- setDirty(true);
+ public IConfigurationElement getBuildFileGeneratorElement() {
+ if (buildFileGeneratorElement == null) {
+ if (superClass != null) {
+ return superClass.getBuildFileGeneratorElement();
+ }
+ }
+ return buildFileGeneratorElement;
}
/* (non-Javadoc)
- * @see org.eclipse.cdt.managedbuilder.core.IBuilder#getBuildFileGeneratorElement()
+ * @see org.eclipse.cdt.managedbuilder.core.IBuilder#setBuildFileGeneratorElement(String)
*/
- public IConfigurationElement getBuildFileGeneratorElement() {
- return buildFileGeneratorElement;
+ public void setBuildFileGeneratorElement(IConfigurationElement element) {
+ buildFileGeneratorElement = element;
+ setDirty(true);
}
/*
Index: src/org/eclipse/cdt/managedbuilder/internal/core/GeneratedMakefileBuilder.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/GeneratedMakefileBuilder.java,v
retrieving revision 1.29
diff -u -r1.29 GeneratedMakefileBuilder.java
--- src/org/eclipse/cdt/managedbuilder/internal/core/GeneratedMakefileBuilder.java 28 Oct 2004 17:16:53 -0000 1.29
+++ src/org/eclipse/cdt/managedbuilder/internal/core/GeneratedMakefileBuilder.java 1 Nov 2004 19:29:05 -0000
@@ -30,11 +30,8 @@
import org.eclipse.cdt.core.resources.ACBuilder;
import org.eclipse.cdt.core.resources.IConsole;
import org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo;
-import org.eclipse.cdt.managedbuilder.core.ITool;
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
-import org.eclipse.cdt.managedbuilder.core.ManagedBuilderCorePlugin;
import org.eclipse.cdt.managedbuilder.makegen.IManagedBuilderMakefileGenerator;
-import org.eclipse.cdt.managedbuilder.makegen.IManagedDependencyGenerator;
import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IFolder;
@@ -46,9 +43,6 @@
import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.resources.IWorkspaceRoot;
import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.IExtension;
-import org.eclipse.core.runtime.IExtensionPoint;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
@@ -56,7 +50,6 @@
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.OperationCanceledException;
import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.SubProgressMonitor;
/**
@@ -394,44 +387,6 @@
// Say bye bye
statusMsg = ManagedMakeMessages.getFormattedString(BUILD_FINISHED, getProject().getName()); //$NON-NLS-1$
monitor.subTask(statusMsg);
- }
-
- /**
- * @param toolId
- * @return
- */
- public IManagedDependencyGenerator getDependencyCalculator(String toolId) {
- try {
- IExtensionPoint extension = Platform.getExtensionRegistry().getExtensionPoint(ManagedBuilderCorePlugin.getUniqueIdentifier(), ManagedBuilderCorePlugin.DEP_CALC_ID);
- if (extension != null) {
- // There could be many of these
- IExtension[] extensions = extension.getExtensions();
- // Get the "configuraton elements" defined in the plugin.xml file.
- // Note that these "configuration elements" are not related to the
- // managed build system "configurations".
- // From the PDE Guide:
- // A configuration element, with its attributes and children, directly
- // reflects the content and structure of the extension section within the
- // declaring plug-in's manifest (plugin.xml) file.
- for (int i = 0; i < extensions.length; i++) {
- IConfigurationElement[] configElements = extensions[i].getConfigurationElements();
- for (int j = 0; j < configElements.length; j++) {
- IConfigurationElement element = configElements[j];
- if (element.getName().equals(ITool.TOOL_ELEMENT_NAME)) {
- if (element.getAttribute(ITool.ID).equals(toolId)) {
- if (element.getAttribute(ManagedBuilderCorePlugin.DEP_CALC_ID) != null) {
- return (IManagedDependencyGenerator) element.createExecutableExtension(ManagedBuilderCorePlugin.DEP_CALC_ID);
- }
- }
- }
- }
- }
- }
- }
- catch (CoreException e) {
- // Probably not defined
- }
- return null;
}
/* (non-Javadoc)
Index: src/org/eclipse/cdt/managedbuilder/internal/core/ManagedBuildInfo.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/ManagedBuildInfo.java,v
retrieving revision 1.25
diff -u -r1.25 ManagedBuildInfo.java
--- src/org/eclipse/cdt/managedbuilder/internal/core/ManagedBuildInfo.java 28 Oct 2004 17:16:53 -0000 1.25
+++ src/org/eclipse/cdt/managedbuilder/internal/core/ManagedBuildInfo.java 1 Nov 2004 19:29:06 -0000
@@ -30,7 +30,6 @@
import org.eclipse.cdt.core.model.IPathEntryContainer;
import org.eclipse.cdt.core.parser.IScannerInfo;
import org.eclipse.cdt.managedbuilder.core.BuildException;
-import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
import org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo;
import org.eclipse.cdt.managedbuilder.core.IManagedCommandLineGenerator;
import org.eclipse.cdt.managedbuilder.core.IManagedCommandLineInfo;
@@ -290,7 +289,7 @@
ITool[] tools = getDefaultConfiguration().getFilteredTools();
for (int index = 0; index < tools.length; ++index) {
if(tools[index].buildsFileType(sourceExtension)) {
- return ManagedBuildManager.getDependencyGenerator(tools[index].getId());
+ return tools[index].getDependencyGenerator();
}
}
}
Index: src/org/eclipse/cdt/managedbuilder/internal/core/Option.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Option.java,v
retrieving revision 1.13
diff -u -r1.13 Option.java
--- src/org/eclipse/cdt/managedbuilder/internal/core/Option.java 28 Oct 2004 17:16:53 -0000 1.13
+++ src/org/eclipse/cdt/managedbuilder/internal/core/Option.java 1 Nov 2004 19:29:08 -0000
@@ -1275,7 +1275,7 @@
if (superClass != null &&
unusedChildren == null &&
browseType == null &&
- builtIns == null &&
+ (builtIns == null || builtIns.size() == 0) &&
category == null &&
categoryId == null &&
command == null &&
Index: src/org/eclipse/cdt/managedbuilder/internal/core/Target.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Target.java,v
retrieving revision 1.28
diff -u -r1.28 Target.java
--- src/org/eclipse/cdt/managedbuilder/internal/core/Target.java 28 Oct 2004 17:16:53 -0000 1.28
+++ src/org/eclipse/cdt/managedbuilder/internal/core/Target.java 1 Nov 2004 19:29:09 -0000
@@ -31,7 +31,6 @@
import org.eclipse.cdt.managedbuilder.core.IBuilder;
import org.eclipse.cdt.managedbuilder.core.IOption;
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
-import org.eclipse.cdt.managedbuilder.makegen.IManagedDependencyGenerator;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.Platform;
import org.w3c.dom.Document;
@@ -272,7 +271,6 @@
public void addTool(ITool tool) {
getToolList().add(tool);
getToolMap().put(tool.getId(), tool);
- getDepCalcMap().put(tool.getId(), ManagedBuildManager.createDependencyGenerator(tool.getId()));
}
/**
@@ -444,26 +442,6 @@
depCalculatorsMap = new HashMap();
}
return depCalculatorsMap;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.managedbuilder.core.ITarget#getDependencyCalculator(java.lang.String)
- */
- public IManagedDependencyGenerator getDependencyGenerator(String toolId) {
- // If I have this tool defined locally, answer its dependency calculator
- IManagedDependencyGenerator answer = (IManagedDependencyGenerator) getDepCalcMap().get(toolId);
-
- // I do not have a local tool definition
- if (answer == null && parent != null) {
- answer = parent.getDependencyGenerator(toolId);
- }
-
- // Perhaps this is a reference, in which case the build manager is cacheing its generator
- if (answer == null && parent == null) {
- answer = ManagedBuildManager.getDependencyGenerator(toolId);
- }
-
- return answer;
}
/* (non-Javadoc)
Index: src/org/eclipse/cdt/managedbuilder/internal/core/Tool.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/Tool.java,v
retrieving revision 1.19
diff -u -r1.19 Tool.java
--- src/org/eclipse/cdt/managedbuilder/internal/core/Tool.java 28 Oct 2004 17:16:53 -0000 1.19
+++ src/org/eclipse/cdt/managedbuilder/internal/core/Tool.java 1 Nov 2004 19:29:10 -0000
@@ -31,6 +31,9 @@
import org.eclipse.cdt.managedbuilder.core.IToolChain;
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
import org.eclipse.cdt.managedbuilder.core.IManagedCommandLineGenerator;
+import org.eclipse.cdt.managedbuilder.makegen.IManagedDependencyGenerator;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.CoreException;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
@@ -72,11 +75,14 @@
private String outputPrefix;
private String errorParserIds;
private String commandLinePattern;
+ private IConfigurationElement commandLineGeneratorElement = null;
+ private IManagedCommandLineGenerator commandLineGenerator = null;
+ private IConfigurationElement dependencyGeneratorElement = null;
+ private IManagedDependencyGenerator dependencyGenerator = null;
// Miscellaneous
private boolean isExtensionTool = false;
private boolean isDirty = false;
private boolean resolved = true;
- private IManagedCommandLineGenerator commandLineGenerator = null;
/*
* C O N S T R U C T O R S
@@ -267,6 +273,11 @@
outputPrefix = new String(tool.outputPrefix);
}
+ commandLineGeneratorElement = tool.commandLineGeneratorElement;
+ commandLineGenerator = tool.commandLineGenerator;
+ dependencyGeneratorElement = tool.dependencyGeneratorElement;
+ dependencyGenerator = tool.dependencyGenerator;
+
// Clone the children
// Note: This constructor ignores OptionCategories since they should not be
// found on an non-extension tool
@@ -372,6 +383,18 @@
// Get command line pattern
commandLinePattern = element.getAttribute( ITool.COMMAND_LINE_PATTERN );
+
+ // Store the configuration element IFF there is a command line generator defined
+ String commandLineGenerator = element.getAttribute(COMMAND_LINE_GENERATOR);
+ if (commandLineGenerator != null && element instanceof DefaultManagedConfigElement) {
+ commandLineGeneratorElement = ((DefaultManagedConfigElement)element).getConfigurationElement();
+ }
+
+ // Store the configuration element IFF there is a dependency generator defined
+ String depGenerator = element.getAttribute(DEP_CALC_ID);
+ if (depGenerator != null && element instanceof DefaultManagedConfigElement) {
+ dependencyGeneratorElement = ((DefaultManagedConfigElement)element).getConfigurationElement();
+ }
}
/* (non-Javadoc)
@@ -602,6 +625,18 @@
element.appendChild(optionElement);
option.serialize(doc, optionElement);
}
+
+ // Note: command line generator cannot be specified in a project file because
+ // an IConfigurationElement is needed to load it!
+ if (commandLineGeneratorElement != null) {
+ // TODO: issue warning?
+ }
+
+ // Note: dependency generator cannot be specified in a project file because
+ // an IConfigurationElement is needed to load it!
+ if (dependencyGeneratorElement != null) {
+ // TODO: issue warning?
+ }
// I am clean now
isDirty = false;
@@ -1075,6 +1110,84 @@
return new String(DEFAULT_PATTERN); // Default pattern
}
}
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.managedbuilder.core.ITool#getCommandLineGeneratorElement()
+ */
+ public IConfigurationElement getCommandLineGeneratorElement() {
+ if (commandLineGeneratorElement == null) {
+ if (superClass != null) {
+ return superClass.getCommandLineGeneratorElement();
+ }
+ }
+ return commandLineGeneratorElement;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.managedbuilder.core.ITool#setCommandLineGeneratorElement(String)
+ */
+ public void setCommandLineGeneratorElement(IConfigurationElement element) {
+ commandLineGeneratorElement = element;
+ setDirty(true);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.managedbuilder.core.ITool#getCommandLineGenerator()
+ */
+ public IManagedCommandLineGenerator getCommandLineGenerator() {
+ if (commandLineGenerator != null) {
+ return commandLineGenerator;
+ }
+ IConfigurationElement element = getCommandLineGeneratorElement();
+ if (element != null) {
+ try {
+ if (element.getAttribute(COMMAND_LINE_GENERATOR) != null) {
+ commandLineGenerator = (IManagedCommandLineGenerator) element.createExecutableExtension(COMMAND_LINE_GENERATOR);
+ return commandLineGenerator;
+ }
+ } catch (CoreException e) {}
+ }
+ return ManagedCommandLineGenerator.getCommandLineGenerator();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.managedbuilder.core.ITool#getDependencyGeneratorElement()
+ */
+ public IConfigurationElement getDependencyGeneratorElement() {
+ if (dependencyGeneratorElement == null) {
+ if (superClass != null) {
+ return superClass.getDependencyGeneratorElement();
+ }
+ }
+ return dependencyGeneratorElement;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.managedbuilder.core.ITool#setDependencyGeneratorElement(String)
+ */
+ public void setDependencyGeneratorElement(IConfigurationElement element) {
+ dependencyGeneratorElement = element;
+ setDirty(true);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.managedbuilder.core.ITool#getDependencyGenerator()
+ */
+ public IManagedDependencyGenerator getDependencyGenerator() {
+ if (dependencyGenerator != null) {
+ return dependencyGenerator;
+ }
+ IConfigurationElement element = getDependencyGeneratorElement();
+ if (element != null) {
+ try {
+ if (element.getAttribute(DEP_CALC_ID) != null) {
+ dependencyGenerator = (IManagedDependencyGenerator) element.createExecutableExtension(DEP_CALC_ID);
+ return dependencyGenerator;
+ }
+ } catch (CoreException e) {}
+ }
+ return null;
+ }
/* (non-Javadoc)
* @see org.eclipse.cdt.managedbuilder.core.ITool#getNatureFilter()
@@ -1164,14 +1277,6 @@
commandLinePattern = pattern;
isDirty = true;
}
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.managedbuilder.core.ITool#getCommandLineGenerator()
- */
- public IManagedCommandLineGenerator getCommandLineGenerator() {
- if( commandLineGenerator == null ) commandLineGenerator = ManagedBuildManager.getCommandLineGenerator( this.getId() );
- return commandLineGenerator;
}
/* (non-Javadoc)
Index: src/org/eclipse/cdt/managedbuilder/internal/core/ToolChain.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/ToolChain.java,v
retrieving revision 1.1
diff -u -r1.1 ToolChain.java
--- src/org/eclipse/cdt/managedbuilder/internal/core/ToolChain.java 28 Oct 2004 17:16:53 -0000 1.1
+++ src/org/eclipse/cdt/managedbuilder/internal/core/ToolChain.java 1 Nov 2004 19:29:12 -0000
@@ -106,7 +106,7 @@
IManagedConfigElement[] tools = element.getChildren(ITool.TOOL_ELEMENT_NAME);
for (int n = 0; n < tools.length; ++n) {
Tool toolChild = new Tool(this, tools[n]);
- getToolList().add(toolChild);
+ addTool(toolChild);
}
}
Index: src/org/eclipse/cdt/managedbuilder/internal/core/ToolReference.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/internal/core/ToolReference.java,v
retrieving revision 1.24
diff -u -r1.24 ToolReference.java
--- src/org/eclipse/cdt/managedbuilder/internal/core/ToolReference.java 28 Oct 2004 17:16:53 -0000 1.24
+++ src/org/eclipse/cdt/managedbuilder/internal/core/ToolReference.java 1 Nov 2004 19:29:13 -0000
@@ -25,6 +25,8 @@
import org.eclipse.cdt.managedbuilder.core.IToolReference;
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
import org.eclipse.cdt.managedbuilder.core.IManagedCommandLineGenerator;
+import org.eclipse.cdt.managedbuilder.makegen.IManagedDependencyGenerator;
+import org.eclipse.core.runtime.IConfigurationElement;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
@@ -922,6 +924,40 @@
public IManagedCommandLineGenerator getCommandLineGenerator() {
if( parent == null ) return null;
return parent.getCommandLineGenerator();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.build.managed.ITool#getCommandLineGenerator()
+ */
+ public IConfigurationElement getCommandLineGeneratorElement() {
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.build.managed.ITool#setCommandLineGenerator(IConfigurationElement)
+ */
+ public void setCommandLineGeneratorElement(IConfigurationElement element) {
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.build.managed.ITool#getDependencyGenerator()
+ */
+ public IManagedDependencyGenerator getDependencyGenerator() {
+ if( parent == null ) return null;
+ return parent.getDependencyGenerator();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.build.managed.ITool#getCommandLineGenerator()
+ */
+ public IConfigurationElement getDependencyGeneratorElement() {
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.core.build.managed.ITool#setCommandLineGenerator(IConfigurationElement)
+ */
+ public void setDependencyGeneratorElement(IConfigurationElement element) {
}
/* (non-Javadoc)
Index: src/org/eclipse/cdt/managedbuilder/makegen/gnu/GnuMakefileGenerator.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/makegen/gnu/GnuMakefileGenerator.java,v
retrieving revision 1.23
diff -u -r1.23 GnuMakefileGenerator.java
--- src/org/eclipse/cdt/managedbuilder/makegen/gnu/GnuMakefileGenerator.java 28 Oct 2004 17:16:53 -0000 1.23
+++ src/org/eclipse/cdt/managedbuilder/makegen/gnu/GnuMakefileGenerator.java 1 Nov 2004 19:29:15 -0000
@@ -369,7 +369,7 @@
buildRule = relativePath + WILDCARD + OptDotExt + COLON + WHITESPACE + ROOT + SEPARATOR + resourcePath + WILDCARD + DOT + inputExtension;
} // end fix for PR 70491
- IConfiguration config = info.getSelectedConfiguration();
+ IConfiguration config = info.getDefaultConfiguration();
// For testing only
/* if( config.getResourceConfigurations().length > 0) {
@@ -517,10 +517,8 @@
// Visit the resources in this folder
IResource[] resources = module.members();
- IConfiguration config = info.getSelectedConfiguration();
- if (config == null) {
- config = info.getDefaultConfiguration();
- }
+ IConfiguration config = info.getDefaultConfiguration();
+
IResourceConfiguration resConfig;
for (int i = 0; i < resources.length; i++) {
Index: plugin.xml
===================================================================
RCS file: /home/tools/org.eclipse.cdt.managedbuilder.core.tests/plugin.xml,v
retrieving revision 1.9
diff -u -r1.9 plugin.xml
--- plugin.xml 28 Oct 2004 17:16:26 -0000 1.9
+++ plugin.xml 1 Nov 2004 19:29:47 -0000
@@ -18,6 +18,7 @@
<import plugin="org.eclipse.ui.ide"/>
</requires>
+<!-- Managed Make Builder Tool Specifications - CDT 2.0 format -->
<extension
id="buildTest"
@@ -394,6 +395,1295 @@
name="EP Config"
id="ep.config"/>
</target>
+ </extension>
+
+<!-- Managed Make Builder Tool Specifications - CDT 2.1 format -->
+ <extension
+ id="build.test.2.1"
+ name="Managed Build Tools Test Description"
+ point="org.eclipse.cdt.managedbuilder.core.buildDefinitions">
+ <managedBuildRevision
+ fileVersion="2.1.0">
+ </managedBuildRevision>
+ <tool
+ natureFilter="cnature"
+ sources="o"
+ outputs=""
+ name="linker.gnu.c"
+ outputFlag="-o"
+ command="gcc"
+ dependencyCalculator="org.eclipse.cdt.managedbuilder.makegen.internal.DefaultNoDependencyCalculator"
+ id="cdt.managedbuild.tool.testgnu.c.linker">
+ <optionCategory
+ owner="cdt.managedbuild.tool.testgnu.c.linker"
+ name="General"
+ id="testgnu.c.link.category.general">
+ </optionCategory>
+ <option
+ defaultValue="false"
+ name="Posix.Linker.NoStartFiles"
+ category="testgnu.c.link.category.general"
+ command="-nostartfiles"
+ id="testgnu.c.link.option.nostart"
+ valueType="boolean">
+ </option>
+ <option
+ defaultValue="false"
+ name="Posix.Linker.NoDefLibs"
+ category="testgnu.c.link.category.general"
+ command="-nodefaultlibs"
+ id="testgnu.c.link.option.nodeflibs"
+ valueType="boolean">
+ </option>
+ <option
+ defaultValue="false"
+ name="Posix.Linker.NoStdLibs"
+ category="testgnu.c.link.category.general"
+ command="-nostdlib"
+ id="testgnu.c.link.option.nostdlibs"
+ valueType="boolean">
+ </option>
+ <option
+ defaultValue="false"
+ name="Posix.Linker.Strip"
+ category="testgnu.c.link.category.general"
+ command="--strip-all"
+ id="testgnu.c.link.option.strip"
+ valueType="boolean">
+ </option>
+ <option
+ defaultValue="false"
+ name="Posix.Linker.Static"
+ category="testgnu.c.link.category.general"
+ command="-static"
+ id="testgnu.c.link.option.noshared"
+ valueType="boolean">
+ </option>
+ <optionCategory
+ owner="cdt.managedbuild.tool.testgnu.c.linker"
+ name="Libs"
+ id="testgnu.c.link.category.libs">
+ </optionCategory>
+ <option
+ name="Posix.Libs"
+ category="testgnu.c.link.category.libs"
+ command="-l"
+ id="testgnu.c.link.option.libs"
+ browseType="file"
+ valueType="libs">
+ </option>
+ <option
+ name="Posix.Libsearch"
+ category="testgnu.c.link.category.libs"
+ command="-L"
+ id="testgnu.c.link.option.paths"
+ browseType="directory"
+ valueType="stringList">
+ </option>
+ <optionCategory
+ owner="cdt.managedbuild.tool.testgnu.c.linker"
+ name="Misc"
+ id="testgnu.c.link.category.other">
+ </optionCategory>
+ <option
+ name="Posix.Linker.Flags"
+ category="testgnu.c.link.category.other"
+ valueType="string"
+ id="testgnu.c.link.option.ldflags">
+ </option>
+ <option
+ name="Posix.Linker.XLinker"
+ category="testgnu.c.link.category.other"
+ command="-Xlinker,"
+ valueType="stringList"
+ id="testgnu.c.link.option.other">
+ </option>
+ <option
+ name="Posix.UserObjs"
+ category="testgnu.c.link.category.other"
+ browseType="file"
+ valueType="userObjs"
+ id="testgnu.c.link.option.userobjs">
+ </option>
+ <optionCategory
+ owner="cdt.managedbuild.tool.testgnu.c.linker"
+ name="Shared.Settings"
+ id="testgnu.c.link.category.shared">
+ </optionCategory>
+ <option
+ defaultValue="false"
+ name="Posix.Linker.Shared"
+ category="testgnu.c.link.category.shared"
+ command="-shared"
+ id="testgnu.c.link.option.shared"
+ valueType="boolean">
+ </option>
+ <option
+ name="Posix.Linker.SOName"
+ category="testgnu.c.link.category.shared"
+ command="-Wl,-soname="
+ id="testgnu.c.link.option.soname"
+ valueType="string">
+ </option>
+ <option
+ name="Posix.Linker.Implib"
+ category="testgnu.c.link.category.shared"
+ command="-Wl,--out-implib="
+ id="testgnu.c.link.option.implname"
+ valueType="string">
+ </option>
+ <option
+ name="Posix.Linker.Defname"
+ category="testgnu.c.link.category.shared"
+ command="-Wl,--output-def="
+ id="testgnu.c.link.option.defname"
+ valueType="string">
+ </option>
+ </tool>
+ <tool
+ natureFilter="ccnature"
+ sources="o"
+ outputs=""
+ name="linker.gnu.cpp"
+ outputFlag="-o"
+ command="g++"
+ dependencyCalculator="org.eclipse.cdt.managedbuilder.makegen.internal.DefaultNoDependencyCalculator"
+ id="cdt.managedbuild.tool.testgnu.cpp.linker">
+ <optionCategory
+ owner="cdt.managedbuild.tool.testgnu.cpp.linker"
+ name="General"
+ id="testgnu.cpp.link.category.options">
+ </optionCategory>
+ <option
+ defaultValue="false"
+ name="Posix.Linker.NoStartFiles"
+ category="testgnu.cpp.link.category.options"
+ command="-nostartfiles"
+ id="testgnu.cpp.link.option.nostart"
+ valueType="boolean">
+ </option>
+ <option
+ defaultValue="false"
+ name="Posix.Linker.NoDefLibs"
+ category="testgnu.cpp.link.category.options"
+ command="-nodefaultlibs"
+ id="testgnu.cpp.link.option.nodeflibs"
+ valueType="boolean">
+ </option>
+ <option
+ defaultValue="false"
+ name="Posix.Linker.NoStdLibs"
+ category="testgnu.cpp.link.category.options"
+ command="-nostdlib"
+ id="testgnu.cpp.link.option.nostdlibs"
+ valueType="boolean">
+ </option>
+ <option
+ defaultValue="false"
+ name="Posix.Linker.Strip"
+ category="testgnu.cpp.link.category.options"
+ command="--strip-all"
+ id="testgnu.cpp.link.option.strip"
+ valueType="boolean">
+ </option>
+ <optionCategory
+ owner="cdt.managedbuild.tool.testgnu.cpp.linker"
+ name="Libs"
+ id="testgnu.cpp.link.category.libs">
+ </optionCategory>
+ <option
+ name="Posix.Libs"
+ category="testgnu.cpp.link.category.libs"
+ command="-l"
+ id="testgnu.cpp.link.option.libs"
+ browseType="file"
+ valueType="libs">
+ </option>
+ <option
+ name="Posix.Libsearch"
+ category="testgnu.cpp.link.category.libs"
+ command="-L"
+ id="testgnu.cpp.link.option.paths"
+ browseType="directory"
+ valueType="stringList">
+ </option>
+ <optionCategory
+ owner="cdt.managedbuild.tool.testgnu.cpp.linker"
+ name="Misc"
+ id="testgnu.cpp.link.category.other">
+ </optionCategory>
+ <option
+ name="Posix.Linker.Flags"
+ category="testgnu.cpp.link.category.other"
+ valueType="string"
+ id="testgnu.cpp.link.option.flags">
+ </option>
+ <option
+ name="Posix.Linker.XLinker"
+ category="testgnu.cpp.link.category.other"
+ command="-Xlinker "
+ valueType="stringList"
+ id="testgnu.cpp.link.option.other">
+ </option>
+ <option
+ name="Posix.UserObjs"
+ category="testgnu.cpp.link.category.other"
+ browseType="file"
+ valueType="userObjs"
+ id="testgnu.cpp.link.option.userobjs">
+ </option>
+ <optionCategory
+ owner="cdt.managedbuild.tool.testgnu.cpp.linker"
+ name="Shared.Settings"
+ id="testgnu.cpp.link.category.shared">
+ </optionCategory>
+ <option
+ defaultValue="false"
+ name="Posix.Linker.Shared"
+ category="testgnu.cpp.link.category.shared"
+ command="-shared"
+ valueType="boolean"
+ id="testgnu.cpp.link.option.shared">
+ </option>
+ <option
+ name="Posix.Linker.SOName"
+ category="testgnu.cpp.link.category.shared"
+ command="-Wl,-soname="
+ valueType="string"
+ id="testgnu.cpp.link.option.soname">
+ </option>
+ <option
+ name="Posix.Linker.Implib"
+ category="testgnu.cpp.link.category.shared"
+ command="-Wl,--out-implib="
+ valueType="string"
+ id="testgnu.cpp.link.option.implname">
+ </option>
+ <option
+ name="Posix.Linker.Defname"
+ category="testgnu.cpp.link.category.shared"
+ command="-Wl,--output-def="
+ valueType="string"
+ id="testgnu.cpp.link.option.defname">
+ </option>
+ </tool>
+ <tool
+ natureFilter="both"
+ isAbstract="true"
+ sources="o"
+ name="archiver.gnu"
+ outputs="a"
+ command="ar"
+ outputPrefix="lib"
+ dependencyCalculator="org.eclipse.cdt.managedbuilder.makegen.internal.DefaultNoDependencyCalculator"
+ id="cdt.managedbuild.tool.testgnu.archiver">
+ <optionCategory
+ owner="cdt.managedbuild.tool.testgnu.archiver"
+ name="General"
+ id="testgnu.lib.category.general">
+ </optionCategory>
+ <option
+ defaultValue="-r"
+ name="Posix.Archiver.Flags"
+ category="testgnu.lib.category.general"
+ valueType="string"
+ id="testgnu.both.lib.option.flags">
+ </option>
+ </tool>
+ <tool
+ command="as"
+ sources="s,S"
+ outputs="o"
+ name="assembler.gnu"
+ outputFlag="-o"
+ id="cdt.managedbuild.tool.testgnu.assembler"
+ natureFilter="both">
+ <optionCategory
+ owner="cdt.managedbuild.tool.testgnu.assembler"
+ name="General"
+ id="testgnu.asm.category.general">
+ </optionCategory>
+ <option
+ name="Gnu.Assembler.Flags"
+ category="testgnu.asm.category.general"
+ valueType="string"
+ id="testgnu.both.asm.option.flags">
+ </option>
+ <option
+ command="-I"
+ valueType="includePath"
+ category="testgnu.asm.category.general"
+ browseType="directory"
+ name="Posix.InclPaths"
+ id="testgnu.both.asm.option.include.paths"/>
+ <option
+ command="-W"
+ defaultValue="false"
+ valueType="boolean"
+ category="testgnu.asm.category.general"
+ name="Gnu.Assembler.warn.suppress"
+ id="testgnu.both.asm.option.warnings.nowarn"/>
+ <option
+ command="-v"
+ defaultValue="false"
+ valueType="boolean"
+ category="testgnu.asm.category.general"
+ name="Gnu.Assembler.version"
+ id="testgnu.both.asm.option.version"/>
+ </tool>
+
+ <tool
+ name="compiler.gnu.c"
+ id="cdt.managedbuild.tool.testgnu.c.compiler"
+ isAbstract="true"
+ sources="c"
+ command="gcc"
+ dependencyCalculator="org.eclipse.cdt.managedbuilder.makegen.gnu.DefaultGCCDependencyCalculator"
+ headerExtensions="h"
+ natureFilter="cnature"
+ outputs="o"
+ outputFlag="-o">
+ <optionCategory
+ owner="cdt.managedbuild.tool.testgnu.c.compiler"
+ name="Preproc"
+ id="testgnu.c.compiler.category.preprocessor">
+ </optionCategory>
+ <option
+ defaultValue="false"
+ name="Posix.Nostdinc"
+ category="testgnu.c.compiler.category.preprocessor"
+ command="-nostdinc"
+ id="testgnu.c.compiler.option.preprocessor.nostdinc"
+ valueType="boolean">
+ </option>
+ <option
+ defaultValue="false"
+ name="Posix.PreprocOnly"
+ category="testgnu.c.compiler.category.preprocessor"
+ command="-E"
+ id="testgnu.c.compiler.option.preprocessor.preprocess"
+ valueType="boolean">
+ </option>
+ <optionCategory
+ owner="cdt.managedbuild.tool.testgnu.c.compiler"
+ name="Symbols"
+ id="testgnu.c.compiler.category.symbols">
+ </optionCategory>
+ <option
+ name="Posix.DefSym"
+ category="testgnu.c.compiler.category.symbols"
+ command="-D"
+ id="testgnu.c.compiler.option.preprocessor.def.symbols"
+ valueType="definedSymbols">
+ </option>
+ <option
+ name="Posix.UndefSym"
+ category="testgnu.c.compiler.category.symbols"
+ command="-U"
+ id="testgnu.c.compiler.option.preprocessor.undef.symbol"
+ valueType="stringList">
+ </option>
+ <optionCategory
+ owner="cdt.managedbuild.tool.testgnu.c.compiler"
+ name="Dirs"
+ id="testgnu.c.compiler.category.dirs">
+ </optionCategory>
+ <option
+ name="Posix.InclPaths"
+ category="testgnu.c.compiler.category.dirs"
+ command="-I"
+ id="testgnu.c.compiler.option.include.paths"
+ valueType="includePath"
+ browseType="directory">
+ </option>
+ <optionCategory
+ owner="cdt.managedbuild.tool.testgnu.c.compiler"
+ name="Optimize"
+ id="testgnu.c.compiler.category.optimization">
+ </optionCategory>
+ <option
+ name="Posix.OptLevel"
+ category="testgnu.c.compiler.category.optimization"
+ id="testgnu.c.compiler.option.optimization.level"
+ valueType="enumerated">
+ <enumeratedOptionValue
+ name="Posix.Optimize.None"
+ isDefault="false"
+ command="-O0"
+ id="testgnu.c.optimization.level.none">
+ </enumeratedOptionValue>
+ <enumeratedOptionValue
+ name="Posix.Optimize.Optimize"
+ command="-O1"
+ id="testgnu.c.optimization.level.optimize">
+ </enumeratedOptionValue>
+ <enumeratedOptionValue
+ name="Posix.Optimize.More"
+ isDefault="true"
+ command="-O2"
+ id="testgnu.c.optimization.level.more">
+ </enumeratedOptionValue>
+ <enumeratedOptionValue
+ name="Posix.Optimize.Most"
+ command="-O3"
+ id="testgnu.c.optimization.level.most">
+ </enumeratedOptionValue>
+ </option>
+ <option
+ name="Posix.Optimize.Flags"
+ category="testgnu.c.compiler.category.optimization"
+ id="testgnu.c.compiler.option.optimization.flags"
+ valueType="string">
+ </option>
+ <optionCategory
+ owner="cdt.managedbuild.tool.testgnu.c.compiler"
+ name="Debug"
+ id="testgnu.c.compiler.category.debug">
+ </optionCategory>
+ <option
+ name="Posix.DebugLevel"
+ category="testgnu.c.compiler.category.debug"
+ id="testgnu.c.compiler.option.debugging.level"
+ valueType="enumerated">
+ <enumeratedOptionValue
+ name="Posix.Debug.None"
+ isDefault="false"
+ id="testgnu.c.debugging.level.none">
+ </enumeratedOptionValue>
+ <enumeratedOptionValue
+ name="Posix.Debug.Min"
+ command="-g1"
+ id="testgnu.c.debugging.level.minimal">
+ </enumeratedOptionValue>
+ <enumeratedOptionValue
+ name="Posix.Debug.Def"
+ isDefault="true"
+ command="-g"
+ id="testgnu.c.debugging.level.default">
+ </enumeratedOptionValue>
+ <enumeratedOptionValue
+ name="Posix.Debug.Max"
+ isDefault="false"
+ command="-g3"
+ id="testgnu.c.debugging.level.max">
+ </enumeratedOptionValue>
+ </option>
+ <option
+ name="Posix.Debug.Other"
+ category="testgnu.c.compiler.category.debug"
+ id="testgnu.c.compiler.option.debugging.other"
+ valueType="string">
+ </option>
+ <option
+ defaultValue="false"
+ name="Posix.Debug.gprof"
+ category="testgnu.c.compiler.category.debug"
+ command="-pg"
+ id="testgnu.c.compiler.option.debugging.gprof"
+ valueType="boolean">
+ </option>
+ <option
+ defaultValue="false"
+ name="Posix.Debug.prof"
+ category="testgnu.c.compiler.category.debug"
+ command="-p"
+ id="testgnu.c.compiler.option.debugging.prof"
+ valueType="boolean">
+ </option>
+ <optionCategory
+ owner="cdt.managedbuild.tool.testgnu.c.compiler"
+ name="Warn"
+ id="testgnu.c.compiler.category.warnings">
+ </optionCategory>
+ <option
+ defaultValue="false"
+ name="Posix.Warn.Syntax"
+ category="testgnu.c.compiler.category.warnings"
+ command="-fsyntax-only"
+ id="testgnu.c.compiler.option.warnings.syntax"
+ valueType="boolean">
+ </option>
+ <option
+ defaultValue="false"
+ name="Posix.Warn.Pedandic"
+ category="testgnu.c.compiler.category.warnings"
+ command="-pedantic"
+ id="testgnu.c.compiler.option.warnings.pedantic"
+ valueType="boolean">
+ </option>
+ <option
+ defaultValue="false"
+ name="Posix.Warn.PedErrors"
+ category="testgnu.c.compiler.category.warnings"
+ command="-pedantic-errors"
+ id="testgnu.c.compiler.option.warnings.pedantic.error"
+ valueType="boolean">
+ </option>
+ <option
+ defaultValue="false"
+ name="Posix.Warn.nowarn"
+ category="testgnu.c.compiler.category.warnings"
+ command="-w"
+ id="testgnu.c.compiler.option.warnings.nowarn"
+ valueType="boolean">
+ </option>
+ <option
+ defaultValue="true"
+ name="Posix.Warn.allwarn"
+ category="testgnu.c.compiler.category.warnings"
+ command="-Wall"
+ id="testgnu.c.compiler.option.warnings.allwarn"
+ valueType="boolean">
+ </option>
+ <option
+ defaultValue="false"
+ name="Posix.Warn.toerrs"
+ category="testgnu.c.compiler.category.warnings"
+ command="-Werror"
+ id="testgnu.c.compiler.option.warnings.toerrors"
+ valueType="boolean">
+ </option>
+ <optionCategory
+ owner="cdt.managedbuild.tool.testgnu.c.compiler"
+ name="Misc"
+ id="testgnu.c.compiler.category.other">
+ </optionCategory>
+ <option
+ defaultValue="-c -fmessage-length=0"
+ name="OtherFlags"
+ category="testgnu.c.compiler.category.other"
+ id="testgnu.c.compiler.option.misc.other"
+ valueType="string">
+ </option>
+ <option
+ defaultValue="false"
+ name="Posix.Verbose"
+ category="testgnu.c.compiler.category.other"
+ command="-v"
+ id="testgnu.c.compiler.option.misc.verbose"
+ valueType="boolean">
+ </option>
+ <option
+ defaultValue="false"
+ name="Posix.Ansi"
+ category="testgnu.c.compiler.category.other"
+ command="-ansi"
+ id="testgnu.c.compiler.option.misc.ansi"
+ valueType="boolean">
+ </option>
+ </tool>
+ <tool
+ name="compiler.gnu.cpp"
+ id="cdt.managedbuild.tool.testgnu.cpp.compiler"
+ isAbstract="true"
+ sources="c,C,cc,cxx,cpp"
+ command="g++"
+ dependencyCalculator="org.eclipse.cdt.managedbuilder.makegen.gnu.DefaultGCCDependencyCalculator"
+ headerExtensions="h,H,hpp"
+ natureFilter="ccnature"
+ outputs="o"
+ outputFlag="-o">
+ <optionCategory
+ owner="cdt.managedbuild.tool.testgnu.cpp.compiler"
+ name="Preproc"
+ id="testgnu.cpp.compiler.category.preprocessor">
+ </optionCategory>
+ <option
+ defaultValue="false"
+ name="Posix.Nostdinc"
+ category="testgnu.cpp.compiler.category.preprocessor"
+ command="-nostdinc"
+ id="testgnu.cpp.compiler.option.preprocessor.nostdinc"
+ valueType="boolean">
+ </option>
+ <option
+ defaultValue="false"
+ name="Posix.PreprocOnly"
+ category="testgnu.cpp.compiler.category.preprocessor"
+ command="-E"
+ id="testgnu.cpp.compiler.option.preprocessor.preprocess"
+ valueType="boolean">
+ </option>
+ <option
+ name="Posix.DefSym"
+ category="testgnu.cpp.compiler.category.preprocessor"
+ command="-D"
+ id="testgnu.cpp.compiler.option.preprocessor.def"
+ valueType="definedSymbols">
+ </option>
+ <option
+ name="Posix.UndefSym"
+ category="testgnu.cpp.compiler.category.preprocessor"
+ command="-U"
+ id="testgnu.cpp.compiler.option.preprocessor.undef"
+ valueType="stringList">
+ </option>
+ <optionCategory
+ owner="cdt.managedbuild.tool.testgnu.cpp.compiler"
+ name="Dirs"
+ id="testgnu.cpp.compiler.category.dirs">
+ </optionCategory>
+ <option
+ name="Posix.InclPaths"
+ category="testgnu.cpp.compiler.category.dirs"
+ command="-I"
+ id="testgnu.cpp.compiler.option.include.paths"
+ valueType="includePath"
+ browseType="directory">
+ </option>
+ <optionCategory
+ owner="cdt.managedbuild.tool.testgnu.cpp.compiler"
+ name="Optimize"
+ id="testgnu.cpp.compiler.category.optimization">
+ </optionCategory>
+ <option
+ name="Posix.OptLevel"
+ category="testgnu.cpp.compiler.category.optimization"
+ id="testgnu.cpp.compiler.option.optimization.level"
+ valueType="enumerated">
+ <enumeratedOptionValue
+ name="Posix.Optimize.None"
+ command="-O0"
+ id="testgnu.cpp.compiler.optimization.level.none">
+ </enumeratedOptionValue>
+ <enumeratedOptionValue
+ name="Posix.Optimize.Optimize"
+ command="-O1"
+ id="testgnu.cpp.compiler.optimization.level.optimize">
+ </enumeratedOptionValue>
+ <enumeratedOptionValue
+ name="Posix.Optimize.More"
+ isDefault="true"
+ command="-O2"
+ id="testgnu.cpp.compiler.optimization.level.more">
+ </enumeratedOptionValue>
+ <enumeratedOptionValue
+ name="Posix.Optimize.Most"
+ command="-O3"
+ id="testgnu.cpp.compiler.optimization.level.most">
+ </enumeratedOptionValue>
+ </option>
+ <option
+ name="Posix.Optimize.Flags"
+ category="testgnu.cpp.compiler.category.optimization"
+ id="testgnu.cpp.compiler.option.optimization.flags"
+ valueType="string">
+ </option>
+ <optionCategory
+ owner="cdt.managedbuild.tool.testgnu.cpp.compiler"
+ name="Debug"
+ id="testgnu.cpp.compiler.category.debug">
+ </optionCategory>
+ <option
+ name="Posix.DebugLevel"
+ category="testgnu.cpp.compiler.category.debug"
+ id="testgnu.cpp.compiler.option.debugging.level"
+ valueType="enumerated">
+ <enumeratedOptionValue
+ name="Posix.Debug.None"
+ isDefault="false"
+ id="testgnu.cpp.compiler.debugging.level.none">
+ </enumeratedOptionValue>
+ <enumeratedOptionValue
+ name="Posix.Debug.Min"
+ command="-g1"
+ id="testgnu.cpp.compiler.debugging.level.minimal">
+ </enumeratedOptionValue>
+ <enumeratedOptionValue
+ name="Posix.Debug.Def"
+ isDefault="true"
+ command="-g"
+ id="testgnu.cpp.compiler.debugging.level.default">
+ </enumeratedOptionValue>
+ <enumeratedOptionValue
+ name="Posix.Debug.Max"
+ isDefault="false"
+ command="-g3"
+ id="testgnu.cpp.compiler.debugging.level.max">
+ </enumeratedOptionValue>
+ </option>
+ <option
+ name="Posix.Debug.Other"
+ category="testgnu.cpp.compiler.category.debug"
+ id="testgnu.cpp.compiler.option.debugging.other"
+ valueType="string">
+ </option>
+ <option
+ defaultValue="false"
+ name="Posix.Debug.prof"
+ category="testgnu.cpp.compiler.category.debug"
+ command="-p"
+ id="testgnu.cpp.compiler.option.debugging.prof"
+ valueType="boolean">
+ </option>
+ <option
+ defaultValue="false"
+ name="Posix.Debug.gprof"
+ category="testgnu.cpp.compiler.category.debug"
+ command="-pg"
+ id="testgnu.cpp.compiler.option.debugging.gprof"
+ valueType="boolean">
+ </option>
+ <optionCategory
+ owner="cdt.managedbuild.tool.testgnu.cpp.compiler"
+ name="Warn"
+ id="testgnu.cpp.compiler.category.warnings">
+ </optionCategory>
+ <option
+ defaultValue="false"
+ name="Posix.Warn.Syntax"
+ category="testgnu.cpp.compiler.category.warnings"
+ command="-fsyntax-only"
+ id="testgnu.cpp.compiler.option.warnings.syntax"
+ valueType="boolean">
+ </option>
+ <option
+ defaultValue="false"
+ name="Posix.Warn.Pedandic"
+ category="testgnu.cpp.compiler.category.warnings"
+ command="-pedantic"
+ id="testgnu.cpp.compiler.option.warnings.pedantic"
+ valueType="boolean">
+ </option>
+ <option
+ defaultValue="false"
+ name="Posix.Warn.PedErrors"
+ category="testgnu.cpp.compiler.category.warnings"
+ command="-pedantic-errors"
+ id="testgnu.cpp.compiler.option.warnings.pedantic.error"
+ valueType="boolean">
+ </option>
+ <option
+ defaultValue="false"
+ name="Posix.Warn.nowarn"
+ category="testgnu.cpp.compiler.category.warnings"
+ command="-w"
+ id="testgnu.cpp.compiler.option.warnings.nowarn"
+ valueType="boolean">
+ </option>
+ <option
+ defaultValue="true"
+ name="Posix.Warn.allwarn"
+ category="testgnu.cpp.compiler.category.warnings"
+ command="-Wall"
+ id="testgnu.cpp.compiler.option.warnings.allwarn"
+ valueType="boolean">
+ </option>
+ <option
+ defaultValue="false"
+ name="Posix.Warn.toerrs"
+ category="testgnu.cpp.compiler.category.warnings"
+ command="-Werror"
+ id="testgnu.cpp.compiler.option.warnings.toerrors"
+ valueType="boolean">
+ </option>
+ <optionCategory
+ owner="cdt.managedbuild.tool.testgnu.cpp.compiler"
+ name="Misc"
+ id="testgnu.cpp.compiler.category.other">
+ </optionCategory>
+ <option
+ defaultValue="-c -fmessage-length=0"
+ name="OtherFlags"
+ category="testgnu.cpp.compiler.category.other"
+ id="testgnu.cpp.compiler.option.other.other"
+ valueType="string">
+ </option>
+ <option
+ defaultValue="false"
+ name="Posix.Verbose"
+ category="testgnu.cpp.compiler.category.other"
+ command="-v"
+ id="testgnu.cpp.compiler.option.other.verbose"
+ valueType="boolean">
+ </option>
+ </tool>
+
+ <projectType
+ isAbstract="false"
+ isTest="true"
+ name="testgnu.exe"
+ id="cdt.managedbuild.target.testgnu.exe">
+ <configuration
+ name="Dbg"
+ id="cdt.managedbuild.config.testgnu.exe.debug"
+ cleanCommand="rm -rf"
+ errorParsers="org.eclipse.cdt.core.MakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.GASErrorParser">
+ <toolChain
+ id="cdt.managedbuild.toolchain.testgnu.exe.debug"
+ name="Dbg ToolChain"
+ scannerInfoCollector="org.eclipse.cdt.managedbuilder.internal.scannerconfig.DefaultGCCScannerInfoCollector"
+ osList="solaris,linux,hpux,aix,qnx"
+ archList="all">
+ <targetPlatform
+ id="cdt.managedbuild.target.testgnu.platform.exe.debug"
+ name="Dbg Platform"
+ binaryParser="org.eclipse.cdt.core.ELF"
+ osList="solaris,linux,hpux,aix,qnx"
+ archList="all">
+ </targetPlatform>
+ <builder
+ id="cdt.managedbuild.target.testgnu.builder.exe.debug"
+ name="Dbg Builder"
+ command="make"
+ arguments="-k"
+ buildfileGenerator="org.eclipse.cdt.managedbuilder.makegen.gnu.GnuMakefileGenerator">
+ </builder>
+ <tool
+ id="cdt.managedbuild.tool.testgnu.c.compiler.exe.debug"
+ superClass="cdt.managedbuild.tool.testgnu.c.compiler">
+ <option
+ id="testgnu.c.compiler.exe.debug.option.optimization.level"
+ defaultValue="testgnu.c.optimization.level.none"
+ superClass="testgnu.c.compiler.option.optimization.level">
+ </option>
+ <option
+ id="testgnu.c.compiler.exe.debug.option.debugging.level"
+ defaultValue="testgnu.c.debugging.level.max"
+ superClass="testgnu.c.compiler.option.debugging.level">
+ </option>
+ </tool>
+ <tool
+ id="cdt.managedbuild.tool.testgnu.cpp.compiler.exe.debug"
+ superClass="cdt.managedbuild.tool.testgnu.cpp.compiler">
+ <option
+ id="testgnu.cpp.compiler.exe.debug.option.optimization.level"
+ defaultValue="testgnu.cpp.compiler.optimization.level.none"
+ superClass="testgnu.cpp.compiler.option.optimization.level">
+ </option>
+ <option
+ id="testgnu.cpp.compiler.exe.debug.option.debugging.level"
+ defaultValue="testgnu.cpp.compiler.debugging.level.max"
+ superClass="testgnu.cpp.compiler.option.debugging.level">
+ </option>
+ </tool>
+ <tool
+ id="cdt.managedbuild.tool.testgnu.c.linker.exe.debug"
+ superClass="cdt.managedbuild.tool.testgnu.c.linker">
+ </tool>
+ <tool
+ id="cdt.managedbuild.tool.testgnu.cpp.linker.exe.debug"
+ superClass="cdt.managedbuild.tool.testgnu.cpp.linker">
+ </tool>
+ <tool
+ id="cdt.managedbuild.tool.testgnu.assembler.exe.debug"
+ superClass="cdt.managedbuild.tool.testgnu.assembler">
+ </tool>
+ </toolChain>
+ </configuration>
+ <configuration
+ name="Rel"
+ id="cdt.managedbuild.config.testgnu.exe.release"
+ cleanCommand="rm -rf"
+ errorParsers="org.eclipse.cdt.core.MakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.GASErrorParser">
+ <toolChain
+ id="cdt.managedbuild.toolchain.testgnu.exe.release"
+ name="Rel ToolChain"
+ scannerInfoCollector="org.eclipse.cdt.managedbuilder.internal.scannerconfig.DefaultGCCScannerInfoCollector"
+ osList="solaris,linux,hpux,aix,qnx"
+ archList="all">
+ <targetPlatform
+ id="cdt.managedbuild.target.testgnu.platform.exe.release"
+ name="Rel Platform"
+ binaryParser="org.eclipse.cdt.core.ELF"
+ osList="solaris,linux,hpux,aix,qnx"
+ archList="all">
+ </targetPlatform>
+ <builder
+ id="cdt.managedbuild.target.testgnu.builder.exe.release"
+ name="Rel Builder"
+ command="make"
+ arguments="-k">
+ </builder>
+ <tool
+ id="cdt.managedbuild.tool.testgnu.c.compiler.exe.release"
+ superClass="cdt.managedbuild.tool.testgnu.c.compiler">
+ <option
+ id="testgnu.c.compiler.exe.release.option.optimization.level"
+ defaultValue="testgnu.c.optimization.level.most"
+ superClass="testgnu.c.compiler.option.optimization.level">
+ </option>
+ <option
+ id="testgnu.c.compiler.exe.release.option.debugging.level"
+ defaultValue="testgnu.c.debugging.level.none"
+ superClass="testgnu.c.compiler.option.debugging.level">
+ </option>
+ </tool>
+ <tool
+ id="cdt.managedbuild.tool.testgnu.cpp.compiler.exe.release"
+ superClass="cdt.managedbuild.tool.testgnu.cpp.compiler">
+ <option
+ id="testgnu.cpp.compiler.exe.release.option.optimization.level"
+ defaultValue="testgnu.cpp.compiler.optimization.level.most"
+ superClass="testgnu.cpp.compiler.option.optimization.level">
+ </option>
+ <option
+ id="testgnu.cpp.compiler.exe.release.option.debugging.level"
+ defaultValue="testgnu.cpp.compiler.debugging.level.none"
+ superClass="testgnu.cpp.compiler.option.debugging.level">
+ </option>
+ </tool>
+ <tool
+ id="cdt.managedbuild.tool.testgnu.c.linker.exe.release"
+ superClass="cdt.managedbuild.tool.testgnu.c.linker">
+ </tool>
+ <tool
+ id="cdt.managedbuild.tool.testgnu.cpp.linker.exe.release"
+ superClass="cdt.managedbuild.tool.testgnu.cpp.linker">
+ </tool>
+ <tool
+ id="cdt.managedbuild.tool.testgnu.assembler.exe.release"
+ superClass="cdt.managedbuild.tool.testgnu.assembler">
+ </tool>
+ </toolChain>
+ </configuration>
+ </projectType>
+
+ <projectType
+ isAbstract="false"
+ isTest="true"
+ name="testgnu.so"
+ id="cdt.managedbuild.target.testgnu.so">
+ <configuration
+ name="Debug"
+ cleanCommand="rm -rf"
+ artifactExtension="so"
+ errorParsers="org.eclipse.cdt.core.MakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.GASErrorParser"
+ id="cdt.managedbuild.config.testgnu.so.debug">
+ <toolChain
+ id="cdt.managedbuild.toolchain.testgnu.so.debug"
+ name="so Debug ToolChain"
+ scannerInfoCollector="org.eclipse.cdt.managedbuilder.internal.scannerconfig.DefaultGCCScannerInfoCollector"
+ osList="solaris,linux,hpux,aix,qnx"
+ archList="all">
+ <targetPlatform
+ id="cdt.managedbuild.target.testgnu.platform.so.debug"
+ name="so Debug Platform"
+ binaryParser="org.eclipse.cdt.core.ELF"
+ osList="solaris,linux,hpux,aix,qnx"
+ archList="all">
+ </targetPlatform>
+ <builder
+ id="cdt.managedbuild.target.testgnu.builder.so.debug"
+ name="so Debug Builder"
+ command="make"
+ arguments="-k">
+ </builder>
+ <tool
+ id="cdt.managedbuild.tool.testgnu.c.compiler.so.debug"
+ superClass="cdt.managedbuild.tool.testgnu.c.compiler">
+ <option
+ id="testgnu.c.compiler.so.debug.option.optimization.level"
+ defaultValue="testgnu.c.optimization.level.none"
+ superClass="testgnu.c.compiler.option.optimization.level">
+ </option>
+ <option
+ id="testgnu.c.compiler.so.debug.option.debugging.level"
+ defaultValue="testgnu.c.debugging.level.max"
+ superClass="testgnu.c.compiler.option.debugging.level">
+ </option>
+ </tool>
+ <tool
+ id="cdt.managedbuild.tool.testgnu.cpp.compiler.so.debug"
+ superClass="cdt.managedbuild.tool.testgnu.cpp.compiler">
+ <option
+ id="testgnu.cpp.compiler.so.debug.option.optimization.level"
+ defaultValue="testgnu.cpp.compiler.optimization.level.none"
+ superClass="testgnu.cpp.compiler.option.optimization.level">
+ </option>
+ <option
+ id="testgnu.cpp.compiler.so.debug.option.debugging.level"
+ defaultValue="testgnu.cpp.compiler.debugging.level.max"
+ superClass="testgnu.cpp.compiler.option.debugging.level">
+ </option>
+ </tool>
+ <tool
+ id="cdt.managedbuild.tool.testgnu.c.linker.so.debug"
+ outputs="so"
+ outputPrefix="lib"
+ superClass="cdt.managedbuild.tool.testgnu.c.linker">
+ <option
+ id="testgnu.c.link.so.debug.option.shared"
+ defaultValue="true"
+ superClass="testgnu.c.link.option.shared">
+ </option>
+ </tool>
+ <tool
+ id="cdt.managedbuild.tool.testgnu.cpp.linker.so.debug"
+ outputs="so"
+ outputPrefix="lib"
+ superClass="cdt.managedbuild.tool.testgnu.cpp.linker">
+ <option
+ id="testgnu.cpp.link.so.debug.option.shared"
+ defaultValue="true"
+ superClass="testgnu.cpp.link.option.shared">
+ </option>
+ </tool>
+ <tool
+ id="cdt.managedbuild.tool.testgnu.assembler.so.debug"
+ superClass="cdt.managedbuild.tool.testgnu.assembler">
+ </tool>
+ </toolChain>
+ </configuration>
+ <configuration
+ name="Release"
+ cleanCommand="rm -rf"
+ artifactExtension="so"
+ errorParsers="org.eclipse.cdt.core.MakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.GASErrorParser"
+ id="cdt.managedbuild.config.testgnu.so.release">
+ <toolChain
+ id="cdt.managedbuild.toolchain.testgnu.so.release"
+ name="so Release ToolChain"
+ scannerInfoCollector="org.eclipse.cdt.managedbuilder.internal.scannerconfig.DefaultGCCScannerInfoCollector"
+ osList="solaris,linux,hpux,aix,qnx"
+ archList="all">
+ <targetPlatform
+ id="cdt.managedbuild.target.testgnu.platform.so.release"
+ name="so Release Platform"
+ binaryParser="org.eclipse.cdt.core.ELF"
+ osList="solaris,linux,hpux,aix,qnx"
+ archList="all">
+ </targetPlatform>
+ <builder
+ id="cdt.managedbuild.target.testgnu.builder.so.release"
+ name="so Release Builder"
+ command="make"
+ arguments="-k">
+ </builder>
+ <tool
+ id="cdt.managedbuild.tool.testgnu.c.compiler.so.release"
+ superClass="cdt.managedbuild.tool.testgnu.c.compiler">
+ <option
+ id="testgnu.c.compiler.so.release.option.optimization.level"
+ defaultValue="testgnu.c.optimization.level.most"
+ superClass="testgnu.c.compiler.option.optimization.level">
+ </option>
+ <option
+ id="testgnu.c.compiler.so.release.option.debugging.level"
+ defaultValue="testgnu.c.debugging.level.none"
+ superClass="testgnu.c.compiler.option.debugging.level">
+ </option>
+ </tool>
+ <tool
+ id="cdt.managedbuild.tool.testgnu.cpp.compiler.so.release"
+ superClass="cdt.managedbuild.tool.testgnu.cpp.compiler">
+ <option
+ id="testgnu.cpp.compiler.so.release.option.optimization.level"
+ defaultValue="testgnu.cpp.compiler.optimization.level.most"
+ superClass="testgnu.cpp.compiler.option.optimization.level">
+ </option>
+ <option
+ id="testgnu.cpp.compiler.so.release.option.debugging.level"
+ defaultValue="testgnu.cpp.compiler.debugging.level.none"
+ superClass="testgnu.cpp.compiler.option.debugging.level">
+ </option>
+ </tool>
+ <tool
+ id="cdt.managedbuild.tool.testgnu.c.linker.so.release"
+ outputs="so"
+ outputPrefix="lib"
+ superClass="cdt.managedbuild.tool.testgnu.c.linker">
+ <option
+ id="testgnu.c.link.so.release.option.shared"
+ defaultValue="true"
+ superClass="testgnu.c.link.option.shared">
+ </option>
+ </tool>
+ <tool
+ id="cdt.managedbuild.tool.testgnu.cpp.linker.so.release"
+ outputs="so"
+ outputPrefix="lib"
+ superClass="cdt.managedbuild.tool.testgnu.cpp.linker">
+ <option
+ id="testgnu.cpp.link.so.release.option.shared"
+ defaultValue="true"
+ superClass="testgnu.cpp.link.option.shared">
+ </option>
+ </tool>
+ <tool
+ id="cdt.managedbuild.tool.testgnu.assembler.so.release"
+ superClass="cdt.managedbuild.tool.testgnu.assembler">
+ </tool>
+ </toolChain>
+ </configuration>
+ </projectType>
+
+ <projectType
+ isTest="true"
+ name="testgnu.lib"
+ isAbstract="false"
+ id="cdt.managedbuild.target.testgnu.lib">
+ <configuration
+ name="Dbg"
+ artifactExtension="a"
+ cleanCommand="rm -rf"
+ errorParsers="org.eclipse.cdt.core.MakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.GASErrorParser"
+ id="cdt.managedbuild.config.testgnu.lib.debug">
+ <toolChain
+ id="cdt.managedbuild.toolchain.testgnu.lib.debug"
+ name="Dbg TC"
+ scannerInfoCollector="org.eclipse.cdt.managedbuilder.internal.scannerconfig.DefaultGCCScannerInfoCollector"
+ osList="solaris,linux,hpux,aix,qnx"
+ archList="all">
+ <targetPlatform
+ id="cdt.managedbuild.target.testgnu.platform.lib.debug"
+ name="Dbg P"
+ binaryParser="org.eclipse.cdt.core.ELF"
+ osList="solaris,linux,hpux,aix,qnx"
+ archList="all">
+ </targetPlatform>
+ <builder
+ id="cdt.managedbuild.target.testgnu.builder.lib.debug"
+ name="Dbg B"
+ command="make"
+ arguments="-k">
+ </builder>
+ <tool
+ id="cdt.managedbuild.tool.testgnu.c.compiler.lib.debug"
+ superClass="cdt.managedbuild.tool.testgnu.c.compiler">
+ <option
+ id="testgnu.c.compiler.lib.debug.option.optimization.level"
+ defaultValue="testgnu.c.optimization.level.none"
+ superClass="testgnu.c.compiler.option.optimization.level">
+ </option>
+ <option
+ id="testgnu.c.compiler.lib.debug.option.debugging.level"
+ defaultValue="testgnu.c.debugging.level.max"
+ superClass="testgnu.c.compiler.option.debugging.level">
+ </option>
+ </tool>
+ <tool
+ id="cdt.managedbuild.tool.testgnu.cpp.compiler.lib.debug"
+ superClass="cdt.managedbuild.tool.testgnu.cpp.compiler">
+ <option
+ id="testgnu.cpp.compiler.lib.debug.option.optimization.level"
+ defaultValue="testgnu.cpp.compiler.optimization.level.none"
+ superClass="testgnu.cpp.compiler.option.optimization.level">
+ </option>
+ <option
+ id="testgnu.cpp.compiler.lib.debug.option.debugging.level"
+ defaultValue="testgnu.cpp.compiler.debugging.level.max"
+ superClass="testgnu.cpp.compiler.option.debugging.level">
+ </option>
+ </tool>
+ <tool
+ id="cdt.managedbuild.tool.testgnu.archiver.lib.debug"
+ outputs="a"
+ outputPrefix="lib"
+ superClass="cdt.managedbuild.tool.testgnu.archiver">
+ </tool>
+ <tool
+ id="cdt.managedbuild.tool.testgnu.assembler.lib.debug"
+ superClass="cdt.managedbuild.tool.testgnu.assembler">
+ </tool>
+ </toolChain>
+ </configuration>
+ <configuration
+ name="Rel"
+ artifactExtension="a"
+ cleanCommand="rm -rf"
+ errorParsers="org.eclipse.cdt.core.MakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.GASErrorParser"
+ id="cdt.managedbuild.config.testgnu.lib.release">
+ <toolChain
+ id="cdt.managedbuild.toolchain.testgnu.lib.release"
+ name="Rel TC"
+ scannerInfoCollector="org.eclipse.cdt.managedbuilder.internal.scannerconfig.DefaultGCCScannerInfoCollector"
+ osList="solaris,linux,hpux,aix,qnx"
+ archList="all">
+ <targetPlatform
+ id="cdt.managedbuild.target.testgnu.platform.lib.release"
+ name="Rel P"
+ binaryParser="org.eclipse.cdt.core.ELF"
+ osList="solaris,linux,hpux,aix,qnx"
+ archList="all">
+ </targetPlatform>
+ <builder
+ id="cdt.managedbuild.target.testgnu.builder.lib.debug"
+ name="Rel B"
+ command="make"
+ arguments="-k">
+ </builder>
+ <tool
+ id="cdt.managedbuild.tool.testgnu.c.compiler.lib.release"
+ superClass="cdt.managedbuild.tool.testgnu.c.compiler">
+ <option
+ id="testgnu.c.compiler.lib.release.option.optimization.level"
+ defaultValue="testgnu.c.optimization.level.most"
+ superClass="testgnu.c.compiler.option.optimization.level">
+ </option>
+ <option
+ id="testgnu.c.compiler.lib.release.option.debugging.level"
+ defaultValue="testgnu.c.debugging.level.none"
+ superClass="testgnu.c.compiler.option.debugging.level">
+ </option>
+ </tool>
+ <tool
+ id="cdt.managedbuild.tool.testgnu.cpp.compiler.lib.release"
+ superClass="cdt.managedbuild.tool.testgnu.cpp.compiler">
+ <option
+ id="testgnu.cpp.compiler.lib.release.option.optimization.level"
+ defaultValue="testgnu.cpp.compiler.optimization.level.most"
+ superClass="testgnu.cpp.compiler.option.optimization.level">
+ </option>
+ <option
+ id="testgnu.cpp.compiler.lib.release.option.debugging.level"
+ defaultValue="testgnu.cpp.compiler.debugging.level.none"
+ superClass="testgnu.cpp.compiler.option.debugging.level">
+ </option>
+ </tool>
+ <tool
+ id="cdt.managedbuild.tool.testgnu.archiver.lib.release"
+ outputs="a"
+ outputPrefix="lib"
+ superClass="cdt.managedbuild.tool.testgnu.archiver">
+ </tool>
+ <tool
+ id="cdt.managedbuild.tool.testgnu.assembler.lib.release"
+ superClass="cdt.managedbuild.tool.testgnu.assembler">
+ </tool>
+ </toolChain>
+ </configuration>
+ </projectType>
+
+ <projectType
+ isTest="true"
+ name="Test Java Attributes"
+ isAbstract="false"
+ id="cdt.managedbuild.test.java.attrs">
+ <configuration
+ name="The One and Only"
+ artifactName="Testme"
+ artifactExtension="xyz"
+ id="cdt.managedbuild.test.java.attrs.config">
+ <toolChain
+ id="cdt.managedbuild.test.java.attrs.toolchain"
+ name="The Tool-Chain">
+ <tool
+ id="cdt.managedbuild.test.java.attrs.tool"
+ superClass="cdt.managedbuild.tool.testgnu.c.compiler"
+ commandLineGenerator="org.eclipse.cdt.managedbuild.core.tests.ManagedBuildCommandLineGenerator">
+ <option
+ id="testgnu.c.compiler.option.preprocessor.def.symbols.test"
+ superClass="testgnu.c.compiler.option.preprocessor.def.symbols">
+ <listOptionValue
+ value="foo">
+ </listOptionValue>
+ <listOptionValue
+ value="bar">
+ </listOptionValue>
+ </option>
+ </tool>
+ <builder
+ id="cdt.managedbuild.test.java.attrs.builder"
+ name="Test Builder"
+ command="makeMe"
+ arguments="-k"
+ buildfileGenerator="org.eclipse.cdt.managedbuild.core.tests.BuildFileGenerator">
+ </builder>
+ </toolChain>
+ </configuration>
+ </projectType>
+
</extension>
</plugin>
Index: suite/org/eclipse/cdt/managedbuilder/tests/suite/AllManagedBuildTests.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.managedbuilder.core.tests/suite/org/eclipse/cdt/managedbuilder/tests/suite/AllManagedBuildTests.java,v
retrieving revision 1.2
diff -u -r1.2 AllManagedBuildTests.java
--- suite/org/eclipse/cdt/managedbuilder/tests/suite/AllManagedBuildTests.java 28 Oct 2004 17:16:26 -0000 1.2
+++ suite/org/eclipse/cdt/managedbuilder/tests/suite/AllManagedBuildTests.java 1 Nov 2004 19:29:47 -0000
@@ -12,6 +12,7 @@
import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.managedbuild.core.tests.ManagedBuildCoreTests;
+import org.eclipse.cdt.managedbuild.core.tests.ManagedBuildCoreTests20;
import org.eclipse.cdt.managedbuild.core.tests.ManagedCommandLineGeneratorTest;
import org.eclipse.cdt.managedbuild.core.tests.ManagedProjectUpdateTests;
@@ -31,6 +32,7 @@
"Test for org.eclipse.cdt.managedbuild.core.tests");
//$JUnit-BEGIN$
// TODO uncoment this
+ suite.addTest(ManagedBuildCoreTests20.suite());
suite.addTest(ManagedBuildCoreTests.suite());
suite.addTest(ManagedProjectUpdateTests.suite());
suite.addTest( ManagedCommandLineGeneratorTest.suite() );
Index: tests/org/eclipse/cdt/managedbuild/core/tests/ManagedBuildCoreTests.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuild/core/tests/ManagedBuildCoreTests.java,v
retrieving revision 1.13
diff -u -r1.13 ManagedBuildCoreTests.java
--- tests/org/eclipse/cdt/managedbuild/core/tests/ManagedBuildCoreTests.java 28 Oct 2004 17:16:26 -0000 1.13
+++ tests/org/eclipse/cdt/managedbuild/core/tests/ManagedBuildCoreTests.java 1 Nov 2004 19:29:47 -0000
@@ -1,42 +1,18 @@
/**********************************************************************
- * Copyright (c) 2003 IBM Corporation and others.
+ * Copyright (c) 2004 Intel Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Common Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/cpl-v10.html
*
* Contributors:
- * IBM - Initial API and implementation
+ * Intel Corporation - Initial API and implementation
**********************************************************************/
package org.eclipse.cdt.managedbuild.core.tests;
-import java.io.ByteArrayInputStream;
-import java.util.Arrays;
-import java.util.Map;
-import java.util.Properties;
-
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-
-import org.eclipse.cdt.core.CCorePlugin;
-import org.eclipse.cdt.core.ICDescriptor;
-import org.eclipse.cdt.core.parser.CodeReader;
-import org.eclipse.cdt.core.parser.IParser;
-import org.eclipse.cdt.core.parser.IScanner;
-import org.eclipse.cdt.core.parser.IScannerInfo;
-import org.eclipse.cdt.core.parser.IScannerInfoChangeListener;
-import org.eclipse.cdt.core.parser.IScannerInfoProvider;
-import org.eclipse.cdt.core.parser.ISourceElementRequestor;
-import org.eclipse.cdt.core.parser.NullLogService;
-import org.eclipse.cdt.core.parser.NullSourceElementRequestor;
-import org.eclipse.cdt.core.parser.ParserFactory;
-import org.eclipse.cdt.core.parser.ParserLanguage;
-import org.eclipse.cdt.core.parser.ParserMode;
-import org.eclipse.cdt.make.core.MakeCorePlugin;
+import org.eclipse.cdt.managedbuilder.core.IProjectType;
import org.eclipse.cdt.managedbuilder.core.BuildException;
import org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo;
-import org.eclipse.cdt.managedbuilder.core.IProjectType;
import org.eclipse.cdt.managedbuilder.core.IManagedProject;
import org.eclipse.cdt.managedbuilder.core.IConfiguration;
import org.eclipse.cdt.managedbuilder.core.IToolChain;
@@ -45,39 +21,19 @@
import org.eclipse.cdt.managedbuilder.core.IOptionCategory;
import org.eclipse.cdt.managedbuilder.core.ITargetPlatform;
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
-import org.eclipse.cdt.managedbuilder.core.ManagedCProjectNature;
-import org.eclipse.cdt.managedbuilder.internal.core.Option;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IFolder;
+
+import junit.framework.Assert;
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IProjectDescription;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IWorkspace;
-import org.eclipse.core.resources.IWorkspaceDescription;
-import org.eclipse.core.resources.IWorkspaceRoot;
-import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IExtensionPoint;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.OperationCanceledException;
import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.Platform;
-
public class ManagedBuildCoreTests extends TestCase {
private static final boolean boolVal = true;
- private static final String testConfigId = "test.config.override";
- private static final String testConfigName = "Tester";
- private static final String enumVal = "Another Enum";
- private static final String[] listVal = {"_DEBUG", "/usr/include", "libglade.a"};
- private static final String newExt = "wen";
- private static final String projectName = "ManagedBuildTest";
- private static final String projectName2 = "ManagedBuildTest2";
- private static final String projectRename = "ManagedBuildRedux";
- private static final String rootExt = "toor";
- private static final String stringVal = "-c -Wall";
- private static final String anotherStringVal = "thevalue";
- private static final String subExt = "bus";
public ManagedBuildCoreTests(String name) {
super(name);
@@ -86,1832 +42,30 @@
public static Test suite() {
TestSuite suite = new TestSuite(ManagedBuildCoreTests.class.getName());
- suite.addTest(new ManagedBuildCoreTests("testExtensions"));
- suite.addTest(new ManagedBuildCoreTests("testProjectCreation"));
- suite.addTest(new ManagedBuildCoreTests("testConfigurations"));
- suite.addTest(new ManagedBuildCoreTests("testConfigurationReset"));
- suite.addTest(new ManagedBuildCoreTests("testConfigBuildArtifact"));
- suite.addTest(new ManagedBuildCoreTests("testMakeCommandManipulation"));
- suite.addTest(new ManagedBuildCoreTests("testScannerInfoInterface"));
- suite.addTest(new ManagedBuildCoreTests("testBug43450"));
- suite.addTest(new ManagedBuildCoreTests("testProjectRename"));
- suite.addTest(new ManagedBuildCoreTests("testErrorParsers"));
+ suite.addTest(new ManagedBuildCoreTests("testLoadManifest"));
suite.addTest(new ManagedBuildCoreTests("cleanup"));
return suite;
}
/**
- * Navigates through the build info as defined in the extensions
- * defined in this plugin
- */
- public void testExtensions() throws Exception {
- IProjectType testRoot = null;
- IProjectType testSub = null;
- IProjectType testSubSub = null;
- IProjectType testForwardChild = null;
- IProjectType testForwardParent = null;
- IProjectType testForwardGrandchild = null;
- int numTypes = 0;
-
- // Note secret null parameter which means just extensions
- IProjectType[] projTypes = ManagedBuildManager.getDefinedProjectTypes();
-
- for (int i = 0; i < projTypes.length; ++i) {
- IProjectType type = projTypes[i];
-
- if (type.getName().equals("Test Root")) {
- testRoot = type;
- checkRootProjectType(testRoot);
- } else if (type.getName().equals("Test Sub")) {
- testSub = type;
- checkSubProjectType(testSub);
- } else if (type.getName().equals("Test Sub Sub")) {
- testSubSub = type;
- checkSubSubProjectType(testSubSub);
- } else if (type.getName().equals("Forward Child")) {
- testForwardChild = type;
- } else if (type.getName().equals("Forward Parent")) {
- testForwardParent = type;
- } else if (type.getName().equals("Forward Grandchild")) {
- testForwardGrandchild = type;
- } else if (type.getId().startsWith("test.provider.Test_")) {
- numTypes++;
- checkProviderProjectType(type);
- }
- }
- // check that the forward references are properly resolved.
- assertNotNull(testForwardChild);
- assertNotNull(testForwardParent);
- assertNotNull(testForwardGrandchild);
- checkForwardProjectTypes(testForwardParent, testForwardChild, testForwardGrandchild);
-
- // check that the proper number of projectTypes were dynamically provided
- assertEquals(3, numTypes);
-
- // All these project types are defines in the plugin files, so none
- // of them should be null at this point
- assertNotNull(testRoot);
- assertNotNull(testSub);
- assertNotNull(testSubSub);
- }
-
- /**
- * This test exercises the interface the <code>IConfiguration</code> exposes to manipulate
- * its make command.
- */
- public void testMakeCommandManipulation () {
- String oldMakeCmd = "make";
- String newMakeCmd = "Ant";
-
- // Open the test project
- IProject project = null;
- try {
- project = createProject(projectName);
- IProjectDescription description = project.getDescription();
- // Make sure it has a managed nature
- if (description != null) {
- assertTrue(description.hasNature(ManagedCProjectNature.MNG_NATURE_ID));
- }
- } catch (CoreException e) {
- fail("Failed to open project in 'testMakeCommandManipulation': " + e.getLocalizedMessage());
- }
- assertNotNull(project);
-
- // Now get the default configuration
- IManagedBuildInfo info = ManagedBuildManager.getBuildInfo(project);
- assertNotNull(info);
- IManagedProject managedProj = info.getManagedProject();
- assertNotNull(managedProj);
- IConfiguration defaultConfig = info.getDefaultConfiguration();
- assertNotNull(defaultConfig);
-
- // Does it have a default build command
- assertFalse(defaultConfig.hasOverriddenBuildCommand());
- assertEquals(oldMakeCmd, defaultConfig.getBuildCommand());
-
- // Change it
- defaultConfig.setBuildCommand(newMakeCmd);
- assertEquals(newMakeCmd, defaultConfig.getBuildCommand());
- assertTrue(defaultConfig.hasOverriddenBuildCommand());
-
- // Reset it
- defaultConfig.setBuildCommand(null);
- assertFalse(defaultConfig.hasOverriddenBuildCommand());
- assertEquals(oldMakeCmd, defaultConfig.getBuildCommand());
-
- ManagedBuildManager.saveBuildInfo(project, false);
- }
-
-
- /**
- * The purpose of this test is to exercise the build path info interface.
- * To get to that point, a new project/config has to be created in the test
- * project and the default configuration changed.
- *
- * @throws CoreException
- */
- public void testScannerInfoInterface(){
- // Open the test project
- IProject project = null;
- try {
- project = createProject(projectName);
- IProjectDescription description = project.getDescription();
- // Make sure it has a managed nature
- if (description != null) {
- assertTrue(description.hasNature(ManagedCProjectNature.MNG_NATURE_ID));
- }
- } catch (CoreException e) {
- fail("Failed to open project in 'testScannerInfoInterface': " + e.getLocalizedMessage());
- }
-
- //These are the expected path settings
- final String[] expectedPaths = new String[5];
-
- // This first path is a built-in, so it will not be manipulated by build manager
- expectedPaths[0] = "/usr/gnu/include";
- expectedPaths[1] = (new Path("/usr/include")).toOSString();
- expectedPaths[2] = (new Path("/opt/gnome/include")).toOSString();
- expectedPaths[3] = (new Path("C:\\home\\tester/include")).toOSString();
- expectedPaths[4] = project.getLocation().append( "Sub Config\\\"..\\includes\"" ).toOSString();
-
- // Create a new managed project based on the sub project type
- IProjectType projType = ManagedBuildManager.getExtensionProjectType("test.sub");
- assertNotNull(projType);
-
- // Create the managed-project (.cdtbuild) for our project
- IManagedProject newProject = null;
- try {
- newProject = ManagedBuildManager.createManagedProject(project, projType);
- } catch (BuildException e) {
- fail("Failed creating new project: " + e.getLocalizedMessage());
- }
- assertNotNull(newProject);
- ManagedBuildManager.setNewProjectVersion(project);
-
- // Copy over the configs
- IConfiguration[] baseConfigs = projType.getConfigurations();
- for (int i = 0; i < baseConfigs.length; ++i) {
- newProject.createConfiguration(baseConfigs[i], baseConfigs[i].getId() + "." + i);
- }
-
- // Change the default configuration to the sub config
- IConfiguration[] configs = newProject.getConfigurations();
- assertEquals(4, configs.length);
- IManagedBuildInfo buildInfo = ManagedBuildManager.getBuildInfo(project);
- buildInfo.setDefaultConfiguration(newProject.getConfiguration(configs[0].getId()));
-
- // Save, close, reopen
- ManagedBuildManager.saveBuildInfo(project, true);
- ManagedBuildManager.removeBuildInfo(project);
- try {
- project.close(null);
- } catch (CoreException e) {
- fail("Failed on project close: " + e.getLocalizedMessage());
- }
- try {
- project.open(null);
- } catch (CoreException e) {
- fail("Failed on project open: " + e.getLocalizedMessage());
- }
- buildInfo = ManagedBuildManager.getBuildInfo(project);
-
- // Use the plugin mechanism to discover the supplier of the path information
- IExtensionPoint extensionPoint = Platform.getExtensionRegistry().getExtensionPoint(CCorePlugin.PLUGIN_ID + ".ScannerInfoProvider");
- if (extensionPoint == null) {
- fail("Failed to retrieve the extension point ScannerInfoProvider.");
- }
-
- // Find the first IScannerInfoProvider that supplies build info for the project
- IScannerInfoProvider provider = CCorePlugin.getDefault().getScannerInfoProvider(project);
- assertNotNull(provider);
-
- // Now subscribe (note that the method will be called after a change
- provider.subscribe(project, new IScannerInfoChangeListener () {
- public void changeNotification(IResource project, IScannerInfo info) {
- // Test the symbols: expect "BUILTIN" from the manifest, and "DEBUG" and "GNOME=ME"
- // from the overidden settings
- Map definedSymbols = info.getDefinedSymbols();
- assertTrue(definedSymbols.containsKey("BUILTIN"));
- assertTrue(definedSymbols.containsKey("DEBUG"));
- assertTrue(definedSymbols.containsKey("GNOME"));
- assertTrue(definedSymbols.containsValue("ME"));
- assertEquals((String)definedSymbols.get("BUILTIN"), "");
- assertEquals((String)definedSymbols.get("DEBUG"), "");
- assertEquals((String)definedSymbols.get("GNOME"), "ME");
- // Test the includes path
- String[] actualPaths = info.getIncludePaths();
- assertTrue(Arrays.equals(expectedPaths, actualPaths));
- }
- });
-
- // Check the build information before we change it
- IScannerInfo currentSettings = provider.getScannerInformation(project);
-
- Map currentSymbols = currentSettings.getDefinedSymbols();
- // It should simply contain the built-in
- assertTrue(currentSymbols.containsKey("BUILTIN"));
- assertEquals((String)currentSymbols.get("BUILTIN"), "");
- String[] currentPaths = currentSettings.getIncludePaths();
- assertTrue(Arrays.equals(expectedPaths, currentPaths));
-
- // Add some defined symbols programmatically
- String[] expectedSymbols = {"DEBUG", "GNOME = ME "};
- IConfiguration defaultConfig = buildInfo.getDefaultConfiguration();
- ITool[] tools = defaultConfig.getTools();
- ITool subTool = null;
- for (int i = 0; i < tools.length; i++) {
- ITool tool = tools[i];
- if("tool.sub".equalsIgnoreCase(tool.getSuperClass().getId())) {
- subTool = tool;
- break;
- }
- }
- assertNotNull(subTool);
- IOption symbolOpt = null;
- IOption[] opts = subTool.getOptions();
- for (int i = 0; i < opts.length; i++) {
- IOption option = opts[i];
- try {
- if (option.getValueType() == IOption.PREPROCESSOR_SYMBOLS) {
- symbolOpt = option;
- break;
- }
- } catch (BuildException e) {
- fail("Failed getting option value-type: " + e.getLocalizedMessage());
- }
- }
- assertNotNull(symbolOpt);
- IManagedBuildInfo info = ManagedBuildManager.getBuildInfo(project);
- assertFalse(info.isDirty());
- ManagedBuildManager.setOption(defaultConfig, subTool, symbolOpt, expectedSymbols);
- assertTrue(info.isDirty());
- info.setDirty(false);
- assertFalse(info.isDirty());
- }
-
- /**
- * 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 {
- final String rootName = "Root Config";
- final String overrideName = "Root Override Config";
- final String completeOverrideName = "Complete Override Config";
- final String toolCmd = "doIt";
- final String newCmd = "never";
-
- // Open the test project
- IProject project = createProject(projectName);
- IProjectDescription description = project.getDescription();
- // Make sure it has a managed nature
- if (description != null) {
- assertTrue(description.hasNature(ManagedCProjectNature.MNG_NATURE_ID));
- }
-
- // Make sure there is a ManagedProject with 3 configs
- IManagedBuildInfo info = ManagedBuildManager.getBuildInfo(project);
- IManagedProject managedProj = info.getManagedProject();
- IConfiguration[] definedConfigs = managedProj.getConfigurations();
- assertEquals(3, definedConfigs.length);
- IConfiguration baseConfig = definedConfigs[0];
- assertEquals(definedConfigs[0].getName(), rootName);
- assertEquals(definedConfigs[1].getName(), overrideName);
- assertEquals(definedConfigs[2].getName(), completeOverrideName);
-
- // Create a new configuration and test the rename function
- IConfiguration newConfig = managedProj.createConfigurationClone(baseConfig, testConfigId);
- assertEquals(4, managedProj.getConfigurations().length);
- newConfig.setName(testConfigName);
- assertEquals(newConfig.getId(), testConfigId);
- assertEquals(newConfig.getName(), testConfigName);
-
- // There is only one tool
- ITool[] definedTools = newConfig.getTools();
- assertEquals(1, definedTools.length);
- ITool rootTool = definedTools[0];
-
- // Test changing its command
- assertEquals(rootTool.getToolCommand(), toolCmd);
- newConfig.setToolCommand(rootTool, newCmd);
- assertEquals(rootTool.getToolCommand(), newCmd);
-
- // Override options in the new configuration
- IOptionCategory topCategory = rootTool.getTopOptionCategory();
- assertEquals("Root Tool", topCategory.getName());
- Object[][] options = topCategory.getOptions(newConfig);
- int i;
- for (i=0; i<options.length; i++)
- if (options[i][0] == null) break;
- assertEquals(2, i);
- ITool tool = (ITool)options[0][0];
- IOption option = (IOption)options[0][1];
- ManagedBuildManager.setOption(newConfig, tool, option, listVal);
- option = (IOption)options[1][1];
- ManagedBuildManager.setOption(newConfig, tool, option, boolVal);
-
- IOptionCategory[] categories = topCategory.getChildCategories();
- assertEquals(1, categories.length);
- options = categories[0].getOptions(newConfig);
- for (i=0; i<options.length; i++)
- if (options[i][0] == null) break;
- assertEquals(4, i);
- tool = (ITool)options[0][0];
- option = (IOption)options[0][1];
- ManagedBuildManager.setOption(newConfig, tool, option, stringVal);
- option = (IOption)options[1][1];
- ManagedBuildManager.setOption(newConfig, tool, option, anotherStringVal);
- option = (IOption)options[2][1];
- ManagedBuildManager.setOption(newConfig, tool, option, enumVal);
- option = (IOption)options[3][1];
- ManagedBuildManager.setOption(newConfig, tool, option, "False");
-
- // Save, close, reopen and test again
- ManagedBuildManager.saveBuildInfo(project, false);
- ManagedBuildManager.removeBuildInfo(project);
- project.close(null);
- project.open(null);
-
- // Test the values in the new configuration
- checkOptionReferences(project);
-
- // Now delete the new configuration and test the managed project
- info = ManagedBuildManager.getBuildInfo(project);
- managedProj = info.getManagedProject();
- definedConfigs = managedProj.getConfigurations();
- assertEquals(4, definedConfigs.length);
- managedProj.removeConfiguration(testConfigId);
- definedConfigs = managedProj.getConfigurations();
- assertEquals(3, definedConfigs.length);
- assertEquals(definedConfigs[0].getName(), rootName);
- assertEquals(definedConfigs[1].getName(), overrideName);
- ManagedBuildManager.saveBuildInfo(project, false);
- }
-
- public void testConfigurationReset() {
- // Open the test project
- IProject project = null;
- try {
- project = createProject(projectName);
- IProjectDescription description = project.getDescription();
- // Make sure it has a managed nature
- if (description != null) {
- assertTrue(description.hasNature(ManagedCProjectNature.MNG_NATURE_ID));
- }
- } catch (CoreException e) {
- fail("Failed to open project: " + e.getLocalizedMessage());
- }
-
- // Get the default configuration
- IManagedBuildInfo info = ManagedBuildManager.getBuildInfo(project);
- assertNotNull(info);
- IManagedProject managedProj = info.getManagedProject();
- assertNotNull(managedProj);
- IConfiguration defaultConfig = info.getDefaultConfiguration();
- assertNotNull(defaultConfig);
-
- // See if it still contains the overridden values (see testProjectCreation())
- try {
- checkRootManagedProject(managedProj, "z");
- } catch (BuildException e1) {
- fail("Overridden root managed project check failed: " + e1.getLocalizedMessage());
- }
-
- // Reset the config and retest
- ManagedBuildManager.resetConfiguration(project, defaultConfig);
- ManagedBuildManager.saveBuildInfo(project, false);
- try {
- checkRootManagedProject(managedProj, "x");
- } catch (BuildException e2) {
- fail("Reset root managed project check failed: " + e2.getLocalizedMessage());
- }
- }
-
- /**
- * @throws CoreException
- * @throws BuildException
- */
- public void testProjectCreation() throws BuildException {
- // Create new project
- IProject project = null;
- try {
- project = createProject(projectName);
- // Now associate the builder with the project
- addManagedBuildNature(project);
- IProjectDescription description = project.getDescription();
- // Make sure it has a managed nature
- if (description != null) {
- assertTrue(description.hasNature(ManagedCProjectNature.MNG_NATURE_ID));
- }
-
- } catch (CoreException e) {
- fail("Test failed on project creation: " + e.getLocalizedMessage());
- }
-
- // Find the base project type definition
- IProjectType projType = ManagedBuildManager.getExtensionProjectType("test.root");
- assertNotNull(projType);
-
- // Create the managed-project (.cdtbuild) for our project that builds a dummy executable
- IManagedProject newProject = ManagedBuildManager.createManagedProject(project, projType);
- assertEquals(newProject.getName(), projType.getName());
- assertFalse(newProject.equals(projType));
- ManagedBuildManager.setNewProjectVersion(project);
-
- // Copy over the configs
- IConfiguration defaultConfig = null;
- IConfiguration[] configs = projType.getConfigurations();
- for (int i = 0; i < configs.length; ++i) {
- // Make the first configuration the default
- if (i == 0) {
- defaultConfig = newProject.createConfiguration(configs[i], projType.getId() + "." + i);
- } else {
- newProject.createConfiguration(configs[i], projType.getId() + "." + i);
- }
- }
- ManagedBuildManager.setDefaultConfiguration(project, defaultConfig);
-
- String buildArtifactName = projectName;
- defaultConfig.setArtifactName(buildArtifactName);
- defaultConfig.setArtifactExtension(newExt);
-
- // Initialize the path entry container
- IStatus initResult = ManagedBuildManager.initBuildInfoContainer(project);
- if (initResult.getCode() != IStatus.OK) {
- fail("Initializing build information failed for: " + project.getName() + " because: " + initResult.getMessage());
- }
-
- // Now test the results out
- checkRootManagedProject(newProject, "x");
-
- // Override the "String Option in Category" option value
- configs = newProject.getConfigurations();
- ITool[] tools = configs[0].getTools();
- IOptionCategory topCategory = tools[0].getTopOptionCategory();
- IOptionCategory[] categories = topCategory.getChildCategories();
- Object[][] options = categories[0].getOptions(configs[0]);
- ITool tool = (ITool)options[0][0];
- IOption option = (IOption)options[0][1];
- configs[0].setOption(tool, option, "z");
- options = categories[0].getOptions((IConfiguration)null);
- tool = (ITool)options[0][0];
- option = (IOption)options[0][1];
- assertEquals("x", option.getStringValue());
- options = categories[0].getOptions(configs[0]);
- tool = (ITool)options[0][0];
- option = (IOption)options[0][1];
- assertEquals("z", option.getStringValue());
-
- // Save, close, reopen and test again
- ManagedBuildManager.saveBuildInfo(project, true);
- ManagedBuildManager.removeBuildInfo(project);
- try {
- project.close(null);
- } catch (CoreException e) {
- fail("Failed on project close: " + e.getLocalizedMessage());
- }
- try {
- project.open(null);
- } catch (CoreException e) {
- fail("Failed on project open: " + e.getLocalizedMessage());
- }
-
- // Test that the default config was remembered
- IManagedBuildInfo info = ManagedBuildManager.getBuildInfo(project);
- assertEquals(defaultConfig.getId(), info.getDefaultConfiguration().getId());
-
- // Check the rest of the default information
- checkRootManagedProject(newProject, "z");
-
- // Now test the information the makefile builder needs
- checkBuildTestSettings(info);
- ManagedBuildManager.removeBuildInfo(project);
- }
-
- /**
- * Tests that bugzilla 44159 has been addressed. After a project was renamed, the
- * build information mistakenly referred to the old project as its owner. This
- * caused a number of searches on the information to fail. In this bug, it was the
- * list of tools that could not be determined. In other cases, the information
- * retrieval caused NPEs because the old owner no longer existed.
- */
- public void testProjectRename() {
- // Open the test project
- IProject project = null;
- try {
- project = createProject(projectName);
- IProjectDescription description = project.getDescription();
- // Make sure it has a managed nature
- if (description != null) {
- assertTrue(description.hasNature(ManagedCProjectNature.MNG_NATURE_ID));
- }
- } catch (CoreException e) {
- fail("Failed to open project: " + e.getLocalizedMessage());
- }
-
- // Rename the project
- IWorkspaceRoot workspaceRoot = ResourcesPlugin.getWorkspace().getRoot();
- IResource newResource = workspaceRoot.findMember(projectRename);
- if (newResource != null) {
- try {
- newResource.delete(IResource.KEEP_HISTORY, new NullProgressMonitor());
- } catch (CoreException e) {
- fail("Failed to delete old project " + projectRename + ": " + e.getLocalizedMessage());
- }
- }
- IProjectDescription description = null;
- try {
- description = project.getDescription();
- } catch (CoreException e) {
- fail("Failed to find project descriptor for " + projectName + ": " + e.getLocalizedMessage());
- }
- description.setName(projectRename);
- try {
- project.move(description, IResource.FORCE | IResource.SHALLOW, new NullProgressMonitor());
- } catch (CoreException e) {
- fail("Failed to rename project: " + e.getLocalizedMessage());
- }
- try {
- project = createProject(projectRename);
- description = project.getDescription();
- // Make sure it has a managed nature
- if (description != null) {
- assertTrue(description.hasNature(ManagedCProjectNature.MNG_NATURE_ID));
- }
- } catch (CoreException e) {
- fail("Failed to open renamed project: " + e.getLocalizedMessage());
- }
-
- // By now the project should have 3 configs
- IManagedBuildInfo info = ManagedBuildManager.getBuildInfo(project);
- IManagedProject managedProj = info.getManagedProject();
- IConfiguration[] definedConfigs = managedProj.getConfigurations();
- assertEquals(4, definedConfigs.length);
- IConfiguration baseConfig = definedConfigs[1];
-
- // There is only one tool
- ITool[] definedTools = baseConfig.getTools();
- assertEquals(1, definedTools.length);
- ITool rootTool = definedTools[0];
-
- // Get the options (2) in top category and (4) in its child
- IOptionCategory topCategory = rootTool.getTopOptionCategory();
- assertEquals("Root Tool", topCategory.getName());
- Object[][] options = topCategory.getOptions(baseConfig);
- int i;
- for (i=0; i<options.length; i++)
- if (options[i][0] == null) break;
- assertEquals(2, i);
- IOptionCategory[] categories = topCategory.getChildCategories();
- assertEquals(1, categories.length);
- options = categories[0].getOptions(baseConfig);
- for (i=0; i<options.length; i++)
- if (options[i][0] == null) break;
- assertEquals(4, i);
-
- // Set the name back
- newResource = workspaceRoot.findMember(projectName);
- if (newResource != null) {
- try {
- newResource.delete(IResource.KEEP_HISTORY, new NullProgressMonitor());
- } catch (CoreException e) {
- fail("Failed to delete old project " + projectName + ": " + e.getLocalizedMessage());
- }
- }
- try {
- description = project.getDescription();
- } catch (CoreException e) {
- fail("Failed to find project descriptor for " + projectRename + ": " + e.getLocalizedMessage());
- }
- description.setName(projectName);
- try {
- project.move(description, IResource.FORCE | IResource.SHALLOW, new NullProgressMonitor());
- } catch (CoreException e) {
- fail("Failed to re-rename project: " + e.getLocalizedMessage());
- }
- try {
- project = createProject(projectName);
- description = project.getDescription();
- // Make sure it has a managed nature
- if (description != null) {
- assertTrue(description.hasNature(ManagedCProjectNature.MNG_NATURE_ID));
- }
- } catch (CoreException e) {
- fail("Failed to open re-renamed project: " + e.getLocalizedMessage());
- }
-
- // Do it all again
- info = ManagedBuildManager.getBuildInfo(project);
- managedProj = info.getManagedProject();
- definedConfigs = managedProj.getConfigurations();
- assertEquals(4, definedConfigs.length);
- baseConfig = definedConfigs[1];
- definedTools = baseConfig.getTools();
- assertEquals(1, definedTools.length);
- rootTool = definedTools[0];
- topCategory = rootTool.getTopOptionCategory();
- assertEquals("Root Tool", topCategory.getName());
- options = topCategory.getOptions(baseConfig);
- for (i=0; i<options.length; i++)
- if (options[i][0] == null) break;
- assertEquals(2, i);
- categories = topCategory.getChildCategories();
- assertEquals(1, categories.length);
- options = categories[0].getOptions(baseConfig);
- for (i=0; i<options.length; i++)
- if (options[i][0] == null) break;
- assertEquals(4, i);
- }
-
- private void addManagedBuildNature (IProject project) {
- // Create the buildinformation object for the project
- ManagedBuildManager.createBuildInfo(project);
-
- // Add the managed build nature
- try {
- ManagedCProjectNature.addManagedNature(project, new NullProgressMonitor());
- ManagedCProjectNature.addManagedBuilder(project, new NullProgressMonitor());
- } catch (CoreException e) {
- fail("Test failed on adding managed build nature or builder: " + e.getLocalizedMessage());
- }
-
- // Associate the project with the managed builder so the clients can get proper information
- ICDescriptor desc = null;
- try {
- desc = CCorePlugin.getDefault().getCProjectDescription(project, true);
- desc.remove(CCorePlugin.BUILD_SCANNER_INFO_UNIQ_ID);
- desc.create(CCorePlugin.BUILD_SCANNER_INFO_UNIQ_ID, ManagedBuildManager.INTERFACE_IDENTITY);
- } catch (CoreException e) {
- fail("Test failed on adding managed builder as scanner info provider: " + e.getLocalizedMessage());
- }
- try {
- desc.saveProjectData();
- } catch (CoreException e) {
- fail("Test failed on saving the ICDescriptor data: " + e.getLocalizedMessage()); }
- }
-
- /**
- * Tests the tool settings through the interface the makefile generator
- * uses.
- *
- * @param project
- */
- private void checkBuildTestSettings(IManagedBuildInfo info) {
- String ext1 = "foo";
- String ext2 = "bar";
- String badExt = "cpp";
- String expectedOutput = "toor";
- String expectedCmd = "doIt";
-
- assertNotNull(info);
- assertEquals(info.getBuildArtifactName(), projectName);
-
- // There should be a default configuration defined for the project
- IManagedProject managedProj = info.getManagedProject();
- assertNotNull(managedProj);
- IConfiguration buildConfig = info.getDefaultConfiguration();
- assertNotNull(buildConfig);
-
- // 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.getToolForConfiguration(ext1));
- assertNull(info.getToolForConfiguration(ext2));
-
- // There is no tool that builds toor
- assertNull(info.getToolForSource(expectedOutput));
- // but there is one that produces it
- assertEquals(info.getToolForConfiguration(expectedOutput), expectedCmd);
-
- // Now check the build flags
- assertEquals(info.getFlagsForSource(ext1), "-La -Lb z -e1 -nob");
- assertEquals(info.getFlagsForSource(ext1), info.getFlagsForSource(ext2));
-
- }
-
- /**
- * 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 configs
- IManagedBuildInfo info = ManagedBuildManager.getBuildInfo(project);
- IManagedProject managedProj = info.getManagedProject();
- IConfiguration[] definedConfigs = managedProj.getConfigurations();
- assertEquals(4, definedConfigs.length);
- IConfiguration newConfig = managedProj.getConfiguration(testConfigId);
- assertNotNull(newConfig);
-
- // Now get the tool options and make sure the values are correct
- ITool[] definedTools = newConfig.getTools();
- assertEquals(1, definedTools.length);
- ITool rootTool = definedTools[0];
-
- // Check that the options in the new config contain overridden values
- IOption[] rootOptions = rootTool.getOptions();
- assertEquals(6, rootOptions.length);
- // First is the new list
- assertEquals("List Option in Top", rootOptions[0].getName());
- assertEquals(IOption.STRING_LIST, rootOptions[0].getValueType());
- String[] list = rootOptions[0].getStringListValue();
- assertEquals(3, list.length);
- assertTrue(Arrays.equals(listVal, list));
- assertEquals(rootOptions[0].getCommand(), "-L");
- // Next option is a boolean in top
- assertEquals("Boolean Option in Top", rootOptions[1].getName());
- assertEquals(IOption.BOOLEAN, rootOptions[1].getValueType());
- assertEquals(boolVal, rootOptions[1].getBooleanValue());
- assertEquals("-b", rootOptions[1].getCommand());
- // Next option is a string in category
- assertEquals("String Option in Category", rootOptions[2].getName());
- assertEquals(IOption.STRING, rootOptions[2].getValueType());
- assertEquals(stringVal, rootOptions[2].getStringValue());
- // Next option is a another string in category
- assertEquals("Another String Option in Category", rootOptions[3].getName());
- assertEquals(IOption.STRING, rootOptions[3].getValueType());
- assertEquals(anotherStringVal, rootOptions[3].getStringValue());
- assertEquals("-str", rootOptions[3].getCommand());
- // Next option is an enumerated in category
- assertEquals("Enumerated Option in Category", rootOptions[4].getName());
- assertEquals(IOption.ENUMERATED, rootOptions[4].getValueType());
- String selEnum = rootOptions[4].getSelectedEnum();
- assertEquals(enumVal, selEnum);
- String[] enums = rootOptions[4].getApplicableValues();
- assertEquals(2, enums.length);
- assertEquals("Default Enum", enums[0]);
- assertEquals("Another Enum", enums[1]);
- assertEquals("-e1", rootOptions[4].getEnumCommand(enums[0]));
- assertEquals("-e2", rootOptions[4].getEnumCommand(enums[1]));
- assertEquals("-e2", rootOptions[4].getEnumCommand(selEnum));
- // Final option is a boolean in Category
- assertEquals("Boolean Option in Category", rootOptions[5].getName());
- assertEquals(IOption.BOOLEAN, rootOptions[5].getValueType());
- assertEquals(false, rootOptions[5].getBooleanValue());
- assertEquals("-nob", rootOptions[5].getCommandFalse());
- }
-
- /*
- * Do a full sanity check on the root project type.
- */
- private void checkRootProjectType(IProjectType type) throws BuildException {
- // Project stuff
- String expectedCleanCmd = "del /myworld";
- String expectedParserId = "org.eclipse.cdt.core.PE";
- String[] expectedOSList = {"win32"};
- String[] expectedArchList = {"all"};
- assertTrue(type.isTestProjectType());
- IConfiguration[] configs = type.getConfigurations();
- if (configs[0].getArtifactName().equals("ManagedBuildTest")) {
- assertEquals(configs[0].getArtifactExtension(), newExt);
- } else {
- assertEquals(configs[0].getArtifactExtension(), rootExt);
- }
- assertEquals(expectedCleanCmd, configs[0].getCleanCommand());
- assertEquals("make", configs[0].getBuildCommand());
- IToolChain toolChain = configs[0].getToolChain();
- ITargetPlatform targetPlatform = toolChain.getTargetPlatform();
- assertEquals(expectedParserId, targetPlatform.getBinaryParserId());
- assertTrue(Arrays.equals(expectedOSList, toolChain.getOSList()));
- assertTrue(Arrays.equals(expectedArchList, toolChain.getArchList()));
- // This configuration defines no errors parsers.
- assertNull(configs[0].getErrorParserIds());
- assertTrue(Arrays.equals(configs[0].getErrorParserList(), CCorePlugin.getDefault().getAllErrorParsersIDs()));
-
- // Tools
- ITool[] tools = toolChain.getTools();
- // Root Tool
- ITool rootTool = tools[0];
- assertEquals("Root Tool", rootTool.getName());
- // 6 Options are defined in the root tool
- IOption[] options = rootTool.getOptions();
- assertEquals(6, options.length);
- // First option is a 3-element list with 1 built-in
- assertEquals("List Option in Top", options[0].getName());
- assertEquals(IOption.STRING_LIST, options[0].getValueType());
- String[] valueList = options[0].getStringListValue();
- assertEquals(2, valueList.length);
- assertEquals("a", valueList[0]);
- assertEquals("b", valueList[1]);
- String[] builtInList = options[0].getBuiltIns();
- assertEquals(1, builtInList.length);
- assertEquals("c", builtInList[0]);
- assertEquals(options[0].getCommand(), "-L");
- // Next option is a boolean in top
- assertEquals("Boolean Option in Top", options[1].getName());
- assertEquals(IOption.BOOLEAN, options[1].getValueType());
- assertEquals(false, options[1].getBooleanValue());
- assertEquals("-b", options[1].getCommand());
- // Next option is a string category
- assertEquals("String Option in Category", options[2].getName());
- assertEquals(IOption.STRING, options[2].getValueType());
- assertEquals("x", options[2].getStringValue());
- // Next option is another string category
- assertEquals("Another String Option in Category", options[3].getName());
- assertEquals(IOption.STRING, options[3].getValueType());
- assertEquals("", options[3].getStringValue());
- assertEquals("-str", options[3].getCommand());
- // Next option is an enumerated
- assertEquals("Enumerated Option in Category", options[4].getName());
- assertEquals(IOption.ENUMERATED, options[4].getValueType());
- // Post-2.0 enums store the ID, not the string value
- assertEquals("default.enum.option", options[4].getSelectedEnum());
- assertEquals("-e1", options[4].getEnumCommand("default.enum.option"));
- // Need this methof to populate the UI selection widget
- valueList = options[4].getApplicableValues();
- assertEquals(2, valueList.length);
- assertEquals("Default Enum", valueList[0]);
- assertEquals("Another Enum", valueList[1]);
- // Test compatability with 1.2 scheme of getting the command from the name
- assertEquals("-e1", options[4].getEnumCommand(valueList[0]));
- assertEquals("-e2", options[4].getEnumCommand(valueList[1]));
- // Final option is another boolean
- assertEquals("Boolean Option in Category", options[5].getName());
- assertEquals(IOption.BOOLEAN, options[5].getValueType());
- assertEquals(false, options[5].getBooleanValue());
- assertEquals("", options[5].getCommand());
- assertEquals("-nob", options[5].getCommandFalse());
-
- // Option Categories
- IOptionCategory topCategory = rootTool.getTopOptionCategory();
- assertEquals("Root Tool", topCategory.getName());
- Object[][] catoptions = topCategory.getOptions(configs[0]);
- int i;
- for (i=0; i<catoptions.length; i++)
- if (catoptions[i][0] == null) break;
- assertEquals(2, i);
- assertEquals("List Option in Top", ((IOption)catoptions[0][1]).getName());
- assertEquals("Boolean Option in Top", ((IOption)catoptions[1][1]).getName());
- IOptionCategory[] categories = topCategory.getChildCategories();
- assertEquals(1, categories.length);
- assertEquals("Category", categories[0].getName());
- catoptions = categories[0].getOptions(configs[0]);
- for (i=0; i<catoptions.length; i++)
- if (catoptions[i][0] == null) break;
- assertEquals(4, i);
- assertEquals("String Option in Category", ((IOption)catoptions[0][1]).getName());
- assertEquals("Another String Option in Category", ((IOption)catoptions[1][1]).getName());
- assertEquals("Enumerated Option in Category", ((IOption)catoptions[2][1]).getName());
- assertEquals("Boolean Option in Category", ((IOption)catoptions[3][1]).getName());
-
- // There should be 3 defined configs
- configs = type.getConfigurations();
- assertEquals(3, configs.length);
-
- // Root Config
- IConfiguration rootConfig = configs[0];
- assertEquals("Root Config", rootConfig.getName());
-
- // Tool elements
- tools = rootConfig.getTools();
- assertEquals(1, tools.length);
- assertEquals("Root Tool", tools[0].getName());
- assertEquals("-r", tools[0].getOutputFlag());
- assertTrue(tools[0].buildsFileType("foo"));
- assertTrue(tools[0].buildsFileType("bar"));
- assertTrue(tools[0].producesFileType("toor"));
- assertEquals("doIt", tools[0].getToolCommand());
- assertEquals("", tools[0].getOutputPrefix());
- // The root tool defines one valid header file extension
- assertTrue(rootTool.isHeaderFile("baz"));
- assertTrue(tools[0].isHeaderFile("baz"));
- assertEquals(ITool.FILTER_C, rootTool.getNatureFilter());
-
- // Partially Overriden Configuration
- assertEquals("Root Override Config", configs[1].getName());
- tools = configs[1].getTools();
- assertEquals(1, tools.length);
- assertEquals("Root Tool", tools[0].getName());
- topCategory = tools[0].getTopOptionCategory();
- catoptions = topCategory.getOptions(configs[1]);
- for (i=0; i<catoptions.length; i++)
- if (catoptions[i][0] == null) break;
- assertEquals(2, i);
- assertEquals("List Option in Top", ((IOption)catoptions[0][1]).getName());
- valueList = ((IOption)catoptions[0][1]).getStringListValue();
- assertEquals("a", valueList[0]);
- assertEquals("b", valueList[1]);
- assertEquals("Boolean Option in Top", ((IOption)catoptions[1][1]).getName());
- assertEquals(true, ((IOption)catoptions[1][1]).getBooleanValue());
- assertEquals("-b", ((IOption)catoptions[1][1]).getCommand());
- categories = topCategory.getChildCategories();
- catoptions = categories[0].getOptions(configs[1]);
- for (i=0; i<catoptions.length; i++)
- if (catoptions[i][0] == null) break;
- assertEquals(4, i);
- assertEquals("String Option in Category", ((IOption)catoptions[0][1]).getName());
- assertEquals("y", ((IOption)catoptions[0][1]).getStringValue());
- assertEquals("Another String Option in Category", ((IOption)catoptions[1][1]).getName());
- assertEquals("", ((IOption)catoptions[1][1]).getStringValue());
- assertEquals("Enumerated Option in Category", ((IOption)catoptions[2][1]).getName());
- valueList = ((IOption)catoptions[2][1]).getApplicableValues();
- assertEquals(2, valueList.length);
- assertEquals("Default Enum", valueList[0]);
- assertEquals("Another Enum", valueList[1]);
- assertEquals("-e1", ((IOption)catoptions[2][1]).getEnumCommand(valueList[0]));
- assertEquals("-e2", ((IOption)catoptions[2][1]).getEnumCommand(valueList[1]));
- assertEquals(1, tools.length);
- assertEquals("Boolean Option in Category", ((IOption)catoptions[3][1]).getName());
- assertEquals(false, ((IOption)catoptions[3][1]).getBooleanValue());
- assertEquals("", ((IOption)catoptions[3][1]).getCommand());
- assertEquals("-nob", ((IOption)catoptions[3][1]).getCommandFalse());
- assertEquals(1, tools.length);
- ITool tool = tools[0];
- assertNotNull(tool);
- assertEquals("Root Tool", tool.getName());
- assertEquals("-r", tool.getOutputFlag());
- assertTrue(tool.buildsFileType("foo"));
- assertTrue(tool.buildsFileType("bar"));
- assertTrue(tool.producesFileType("toor"));
- assertTrue(tool.isHeaderFile("baz"));
- assertEquals("doIt", tool.getToolCommand());
- assertEquals("-La -Lb -b y -e1 -nob", tool.getToolFlags());
-
- // Completely Overridden configuration
- assertEquals("Complete Override Config", configs[2].getName());
- tools = configs[2].getTools();
- assertEquals(1, tools.length);
- assertEquals("Root Tool", tools[0].getName());
- topCategory = tools[0].getTopOptionCategory();
- catoptions = topCategory.getOptions(configs[2]);
- for (i=0; i<catoptions.length; i++)
- if (catoptions[i][0] == null) break;
- assertEquals(2, i);
- // Check that there's an string list with totally new values
- assertEquals("List Option in Top", ((IOption)catoptions[0][1]).getName());
- assertEquals(IOption.STRING_LIST, ((IOption)catoptions[0][1]).getValueType());
- valueList = ((IOption)catoptions[0][1]).getStringListValue();
- assertTrue(valueList.length == 3);
- assertEquals("d", valueList[0]);
- assertEquals("e", valueList[1]);
- assertEquals("f", valueList[2]);
- assertEquals("-L", ((IOption)catoptions[0][1]).getCommand());
- // and a true boolean (commands should not have changed)
- assertEquals("Boolean Option in Top", ((IOption)catoptions[1][1]).getName());
- assertEquals(IOption.BOOLEAN, ((IOption)catoptions[1][1]).getValueType());
- assertEquals(true, ((IOption)catoptions[1][1]).getBooleanValue());
- assertEquals("-b", ((IOption)catoptions[1][1]).getCommand());
- // Check that there's an overridden enumeration and string
- categories = topCategory.getChildCategories();
- catoptions = categories[0].getOptions(configs[2]);
- for (i=0; i<catoptions.length; i++)
- if (catoptions[i][0] == null) break;
- assertEquals(4, i);
- assertEquals("String Option in Category", ((IOption)catoptions[0][1]).getName());
- assertEquals(IOption.STRING, ((IOption)catoptions[0][1]).getValueType());
- assertEquals("overridden", ((IOption)catoptions[0][1]).getStringValue());
- assertEquals("Another String Option in Category", ((IOption)catoptions[1][1]).getName());
- assertEquals(IOption.STRING, ((IOption)catoptions[1][1]).getValueType());
- assertEquals("alsooverridden", ((IOption)catoptions[1][1]).getStringValue());
- assertEquals("Enumerated Option in Category", ((IOption)catoptions[2][1]).getName());
- assertEquals(IOption.ENUMERATED, ((IOption)catoptions[2][1]).getValueType());
- assertEquals("another.enum.option", ((IOption)catoptions[2][1]).getSelectedEnum());
- assertEquals("Boolean Option in Category", ((IOption)catoptions[3][1]).getName());
- assertEquals(IOption.BOOLEAN, ((IOption)catoptions[3][1]).getValueType());
- assertEquals(true, ((IOption)catoptions[3][1]).getBooleanValue());
- tool = tools[0];
- assertEquals("-Ld -Le -Lf -b overridden -stralsooverridden -e2", tool.getToolFlags());
-
- // Make sure that the build manager returns the default makefile generator (not null)
- assertNotNull(ManagedBuildManager.getBuildfileGenerator(configs[0]));
- }
-
- /*
- * Do a full sanity check on the root managed project.
- */
- private void checkRootManagedProject(IManagedProject managedProj, String testValue) throws BuildException {
- String expectedCleanCmd = "del /myworld";
- String expectedParserId = "org.eclipse.cdt.core.PE";
- String[] expectedOSList = {"win32"};
- String[] expectedArchList = {"all"};
- assertTrue(managedProj.getProjectType().isTestProjectType());
- IConfiguration[] configs = managedProj.getConfigurations();
- if (configs[0].getArtifactName().equals("ManagedBuildTest")) {
- assertEquals(configs[0].getArtifactExtension(), newExt);
- } else {
- assertEquals(configs[0].getArtifactExtension(), rootExt);
- }
- assertEquals(expectedCleanCmd, configs[0].getCleanCommand());
- assertEquals("make", configs[0].getBuildCommand());
- IToolChain toolChain = configs[0].getToolChain();
- ITargetPlatform targetPlatform = toolChain.getTargetPlatform();
- assertEquals(expectedParserId, targetPlatform.getBinaryParserId());
- assertTrue(Arrays.equals(expectedOSList, toolChain.getOSList()));
- assertTrue(Arrays.equals(expectedArchList, toolChain.getArchList()));
- // This configuration defines no errors parsers.
- assertNull(configs[0].getErrorParserIds());
- assertTrue(Arrays.equals(configs[0].getErrorParserList(), CCorePlugin.getDefault().getAllErrorParsersIDs()));
-
- // Tools
- ITool[] tools = configs[0].getTools();
- // Root Tool
- ITool rootTool = tools[0];
- assertEquals("Root Tool", rootTool.getName());
- // 6 Options are defined in the root tool
- IOption[] options = rootTool.getOptions();
- assertEquals(6, options.length);
- // First option is a 3-element list with 1 built-in
- assertEquals("List Option in Top", options[0].getName());
- assertEquals(IOption.STRING_LIST, options[0].getValueType());
- String[] valueList = options[0].getStringListValue();
- assertEquals(2, valueList.length);
- assertEquals("a", valueList[0]);
- assertEquals("b", valueList[1]);
- String[] builtInList = options[0].getBuiltIns();
- assertEquals(1, builtInList.length);
- assertEquals("c", builtInList[0]);
- assertEquals(options[0].getCommand(), "-L");
- // Next option is a boolean in top
- assertEquals("Boolean Option in Top", options[1].getName());
- assertEquals(IOption.BOOLEAN, options[1].getValueType());
- assertEquals(false, options[1].getBooleanValue());
- assertEquals("-b", options[1].getCommand());
- // Next option is a string category
- assertEquals("String Option in Category", options[2].getName());
- assertEquals(IOption.STRING, options[2].getValueType());
- assertEquals(testValue, options[2].getStringValue());
- // Next option is another string category
- assertEquals("Another String Option in Category", options[3].getName());
- assertEquals(IOption.STRING, options[3].getValueType());
- assertEquals("", options[3].getStringValue());
- assertEquals("-str", options[3].getCommand());
- // Next option is an enumerated
- assertEquals("Enumerated Option in Category", options[4].getName());
- assertEquals(IOption.ENUMERATED, options[4].getValueType());
- // Post-2.0 enums store the ID, not the string value
- assertEquals("default.enum.option", options[4].getSelectedEnum());
- assertEquals("-e1", options[4].getEnumCommand("default.enum.option"));
- // Need this methof to populate the UI selection widget
- valueList = options[4].getApplicableValues();
- assertEquals(2, valueList.length);
- assertEquals("Default Enum", valueList[0]);
- assertEquals("Another Enum", valueList[1]);
- // Test compatability with 1.2 scheme of getting the command from the name
- assertEquals("-e1", options[4].getEnumCommand(valueList[0]));
- assertEquals("-e2", options[4].getEnumCommand(valueList[1]));
- // Final option is another boolean
- assertEquals("Boolean Option in Category", options[5].getName());
- assertEquals(IOption.BOOLEAN, options[5].getValueType());
- assertEquals(false, options[5].getBooleanValue());
- assertEquals("", options[5].getCommand());
- assertEquals("-nob", options[5].getCommandFalse());
-
- // Option Categories
- IOptionCategory topCategory = rootTool.getTopOptionCategory();
- assertEquals("Root Tool", topCategory.getName());
- Object[][] catoptions = topCategory.getOptions(configs[0]);
- int i;
- for (i=0; i<catoptions.length; i++)
- if (catoptions[i][0] == null) break;
- assertEquals(2, i);
- IOption catOption = (IOption)catoptions[0][1];
- assertEquals("List Option in Top", catOption.getName());
- catOption = (IOption)catoptions[1][1];
- assertEquals("Boolean Option in Top", catOption.getName());
- IOptionCategory[] categories = topCategory.getChildCategories();
- assertEquals(1, categories.length);
- assertEquals("Category", categories[0].getName());
- catoptions = categories[0].getOptions(configs[0]);
- for (i=0; i<catoptions.length; i++)
- if (catoptions[i][0] == null) break;
- assertEquals(4, i);
- catOption = (IOption)catoptions[0][1];
- assertEquals("String Option in Category", catOption.getName());
- catOption = (IOption)catoptions[1][1];
- assertEquals("Another String Option in Category", catOption.getName());
- catOption = (IOption)catoptions[2][1];
- assertEquals("Enumerated Option in Category", catOption.getName());
- catOption = (IOption)catoptions[3][1];
- assertEquals("Boolean Option in Category", catOption.getName());
-
- // There should be 3 defined configs
- assertEquals(3, configs.length);
-
- // Root Config
- IConfiguration rootConfig = configs[0];
- assertEquals("Root Config", rootConfig.getName());
-
- // Tool elements
- tools = rootConfig.getTools();
- assertEquals(1, tools.length);
- assertEquals("Root Tool", tools[0].getName());
- assertEquals("-r", tools[0].getOutputFlag());
- assertTrue(tools[0].buildsFileType("foo"));
- assertTrue(tools[0].buildsFileType("bar"));
- assertTrue(tools[0].producesFileType("toor"));
- assertEquals("doIt", tools[0].getToolCommand());
- assertEquals("", tools[0].getOutputPrefix());
- // The root tool defines one valid header file extension
- assertTrue(rootTool.isHeaderFile("baz"));
- assertTrue(tools[0].isHeaderFile("baz"));
- assertEquals(ITool.FILTER_C, rootTool.getNatureFilter());
-
- // Partially Overriden Configuration
- assertEquals("Root Override Config", configs[1].getName());
- tools = configs[1].getTools();
- assertEquals(1, tools.length);
- assertEquals("Root Tool", tools[0].getName());
- topCategory = tools[0].getTopOptionCategory();
- catoptions = topCategory.getOptions(configs[1]);
- for (i=0; i<catoptions.length; i++)
- if (catoptions[i][0] == null) break;
- assertEquals(2, i);
- catOption = (IOption)catoptions[0][1];
- assertEquals("List Option in Top", catOption.getName());
- valueList = catOption.getStringListValue();
- assertEquals("a", valueList[0]);
- assertEquals("b", valueList[1]);
- catOption = (IOption)catoptions[1][1];
- assertEquals("Boolean Option in Top", catOption.getName());
- assertEquals(true, catOption.getBooleanValue());
- assertEquals("-b", catOption.getCommand());
- categories = topCategory.getChildCategories();
- catoptions = categories[0].getOptions(configs[1]);
- for (i=0; i<catoptions.length; i++)
- if (catoptions[i][0] == null) break;
- assertEquals(4, i);
- catOption = (IOption)catoptions[0][1];
- assertEquals("String Option in Category", catOption.getName());
- assertEquals("y", catOption.getStringValue());
- catOption = (IOption)catoptions[1][1];
- assertEquals("Another String Option in Category", catOption.getName());
- assertEquals("", catOption.getStringValue());
- catOption = (IOption)catoptions[2][1];
- assertEquals("Enumerated Option in Category", catOption.getName());
- valueList = catOption.getApplicableValues();
- assertEquals(2, valueList.length);
- assertEquals("Default Enum", valueList[0]);
- assertEquals("Another Enum", valueList[1]);
- catOption = (IOption)catoptions[2][1];
- assertEquals("-e1", catOption.getEnumCommand(valueList[0]));
- assertEquals("-e2", catOption.getEnumCommand(valueList[1]));
- assertEquals(1, tools.length);
- catOption = (IOption)catoptions[3][1];
- assertEquals("Boolean Option in Category", catOption.getName());
- assertEquals(false, catOption.getBooleanValue());
- assertEquals("", catOption.getCommand());
- assertEquals("-nob", catOption.getCommandFalse());
- assertEquals(1, tools.length);
- ITool tool = tools[0];
- assertNotNull(tool);
- assertEquals("Root Tool", tool.getName());
- assertEquals("-r", tool.getOutputFlag());
- assertTrue(tool.buildsFileType("foo"));
- assertTrue(tool.buildsFileType("bar"));
- assertTrue(tool.producesFileType("toor"));
- assertTrue(tool.isHeaderFile("baz"));
- assertEquals("doIt", tool.getToolCommand());
- assertEquals("-La -Lb -b y -e1 -nob", tool.getToolFlags());
-
- // Completely Overridden configuration
- assertEquals("Complete Override Config", configs[2].getName());
- tools = configs[2].getTools();
- assertEquals(1, tools.length);
- assertEquals("Root Tool", tools[0].getName());
- topCategory = tools[0].getTopOptionCategory();
- catoptions = topCategory.getOptions(configs[2]);
- for (i=0; i<catoptions.length; i++)
- if (catoptions[i][0] == null) break;
- assertEquals(2, i);
- // Check that there's an string list with totally new values
- catOption = (IOption)catoptions[0][1];
- assertEquals("List Option in Top", catOption.getName());
- assertEquals(IOption.STRING_LIST, catOption.getValueType());
- valueList = catOption.getStringListValue();
- assertTrue(valueList.length == 3);
- assertEquals("d", valueList[0]);
- assertEquals("e", valueList[1]);
- assertEquals("f", valueList[2]);
- assertEquals("-L", catOption.getCommand());
- // and a true boolean (commands should not have changed)
- catOption = (IOption)catoptions[1][1];
- assertEquals("Boolean Option in Top", catOption.getName());
- assertEquals(IOption.BOOLEAN, catOption.getValueType());
- assertEquals(true, catOption.getBooleanValue());
- assertEquals("-b", catOption.getCommand());
- // Check that there's an overridden enumeration and string
- categories = topCategory.getChildCategories();
- catoptions = categories[0].getOptions(configs[2]);
- for (i=0; i<catoptions.length; i++)
- if (catoptions[i][0] == null) break;
- assertEquals(4, i);
- catOption = (IOption)catoptions[0][1];
- assertEquals("String Option in Category", catOption.getName());
- assertEquals(IOption.STRING, catOption.getValueType());
- assertEquals("overridden", catOption.getStringValue());
- catOption = (IOption)catoptions[1][1];
- assertEquals("Another String Option in Category", catOption.getName());
- assertEquals(IOption.STRING, catOption.getValueType());
- assertEquals("alsooverridden", catOption.getStringValue());
- catOption = (IOption)catoptions[2][1];
- assertEquals("Enumerated Option in Category", catOption.getName());
- assertEquals(IOption.ENUMERATED, catOption.getValueType());
- assertEquals("another.enum.option", catOption.getSelectedEnum());
- catOption = (IOption)catoptions[3][1];
- assertEquals("Boolean Option in Category", catOption.getName());
- assertEquals(IOption.BOOLEAN, catOption.getValueType());
- assertEquals(true, catOption.getBooleanValue());
- tool = tools[0];
- assertEquals("-Ld -Le -Lf -b overridden -stralsooverridden -e2", tool.getToolFlags());
-
- // Make sure that the build manager returns the default makefile generator (not null)
- assertNotNull(ManagedBuildManager.getBuildfileGenerator(configs[0]));
- }
-
- /*
- * The Sub Sub project type has a reference to a tool that is defined
- * independently from the project type itself. This is a common pattern
- * for tools that are shared between many project types.
- *
- * The tool itself is defined as having two option categories, with
- * one option in each category. To test that the reference is properly
- * inheritted, the project type overrides the default value of the boolean
- * option.
- *
- * The test confirms that the basic settings are inheritted through the
- * reference, and that the overridden value is used instead of the
- * default. It also tests that the command can be overidden through a
- * tool reference.
- *
- * Finally, the string option in the configuration is overridden and the
- * test confirms that it contains both the overridden boolean that the
- * project type provides, and the overridden string that it provides.
- *
- * @param testSubSub
- */
- private void checkSubSubProjectType(IProjectType projType) {
- final String indyToolName = "Target Independent Tool";
- final String indyToolCommand = "RC.EXE";
- final String indyToolInputExt = "rc";
- final String indyToolOutputExt = "free";
- final String indyToolOutFlag = "/fo";
- final String indyToolHeader = "h";
- final String indyToolHeaderNot = "j";
- final String indyCatOne = "Free";
- final String indyCatTwo = "Chained";
- final String freeOptName = "String in Free";
- final String chainedOptName = "Boolean in Chained";
- final String freeOptValue = "Live free or die";
- final String newCmd = "Let the Wookie win";
- final String stringOverride = "The future language of slaves";
-
- IConfiguration[] configs = projType.getConfigurations();
- // Check the inherited clean command
- assertEquals("rm -yourworld", configs[0].getCleanCommand());
- // Check that the make command is overridden from parent
- assertEquals("nmake", configs[0].getBuildCommand());
- // Make sure we get the proper binary parser
- IToolChain toolChain = configs[0].getToolChain();
- ITargetPlatform targetPlatform = toolChain.getTargetPlatform();
- assertEquals("org.eclipse.cdt.core.ELF", targetPlatform.getBinaryParserId());
- // Make sure the os list is inherited
- String[] expectedOSList = {"win32","linux","solaris"};
- assertTrue(Arrays.equals(expectedOSList, toolChain.getOSList()));
- // Make sure the arch list is inherited
- String[] expectedArchList = {"x86", "ppc"};
- assertTrue(Arrays.equals(expectedArchList, toolChain.getArchList()));
-
- // Get the 5 configurations (3 from test, 1 from test sub and 1 from this)
- assertEquals(5, configs.length);
-
- // Check the tools. We should have 3 (1 from each parent and the one referenced).
- ITool[] tools = configs[0].getTools();
- assertEquals(3, tools.length);
- ITool toolRef = tools[0];
-
- // Make sure we get all the tool settings
- assertEquals(toolRef.getName(), indyToolName);
- assertEquals(toolRef.getToolCommand(), indyToolCommand);
- assertTrue(toolRef.buildsFileType(indyToolInputExt));
- assertEquals(toolRef.getOutputExtension(indyToolInputExt), indyToolOutputExt);
- assertEquals(toolRef.getOutputFlag(), indyToolOutFlag);
- assertTrue(toolRef.isHeaderFile(indyToolHeader));
- assertFalse(toolRef.isHeaderFile(indyToolHeaderNot));
- assertEquals(toolRef.getNatureFilter(), ITool.FILTER_BOTH);
- // Check out the referenced tool and make sure we get all option categories
- IOptionCategory topCategory = toolRef.getTopOptionCategory();
- IOptionCategory[] categories = topCategory.getChildCategories();
- assertEquals(1, categories.length);
- assertEquals(categories[0].getName(), indyCatOne);
- IOptionCategory[] subCategories = categories[0].getChildCategories();
- // Is the chained category a subcategory
- assertEquals(1, subCategories.length);
- assertEquals(subCategories[0].getName(), indyCatTwo);
- // Make sure the option in the top category is correct
- Object[][] optsInCat = categories[0].getOptions(configs[0]);
- int i;
- for (i=0; i<optsInCat.length; i++)
- if (optsInCat[i][0] == null) break;
- assertEquals(1, i);
- IOption optCat = (IOption)optsInCat[0][1];
- assertEquals(freeOptName, optCat.getName());
- try {
- // We get the option categories and options from the tool itself, but the
- // tool reference will have a set of 0 to n option references that contain
- // overridden settings. In this case, the string is inheritted and should
- // not be reference
- assertEquals(IOption.STRING, optCat.getValueType());
- IOption stringOpt = toolRef.getOptionById(optCat.getId());
- assertTrue(stringOpt instanceof Option);
- assertEquals(freeOptValue, stringOpt.getStringValue());
- } catch (BuildException e1) {
- fail("Failed getting string value in subsub :" + e1.getLocalizedMessage());
- }
-
- // Do the same for the options in the child cat
- Object[][] optsInSubCat = subCategories[0].getOptions(configs[0]);
- for (i=0; i<optsInSubCat.length; i++)
- if (optsInSubCat[i][0] == null) break;
- assertEquals(1, i);
- IOption booleanRef = toolRef.getOptionById(((IOption)optsInSubCat[0][1]).getId());
- assertEquals(chainedOptName, booleanRef.getName());
- try {
- assertEquals(IOption.BOOLEAN, booleanRef.getValueType());
- assertTrue(booleanRef.getBooleanValue());
- } catch (BuildException e) {
- fail("Failure getting boolean value in subsub: " + e.getLocalizedMessage());
- }
-
- // Test that the tool command can be changed through the reference
- toolRef.setToolCommand(newCmd);
- assertEquals(toolRef.getToolCommand(), newCmd);
-
- // Muck about with the options in the local config
- IConfiguration subSubConfig = projType.getConfiguration("sub.sub.config");
- assertNotNull(subSubConfig);
- ITool[] configTools = subSubConfig.getTools();
- // This tool ref is inherited from parent, so it does not belong to the config
- ITool configToolRef = configTools[0];
- assertNotNull(configToolRef);
- optCat = (IOption)optsInCat[0][1];
- IOption configStringOpt = configToolRef.getOptionById(optCat.getId());
- assertNotNull(configStringOpt);
- // Override the string option
- try {
- subSubConfig.setOption(configToolRef, configStringOpt, stringOverride);
- } catch (BuildException e) {
- fail("Failure setting string value in subsubconfiguration: " + e.getLocalizedMessage());
- }
- // Now the config should have a tool ref to the independent tool
- configTools = subSubConfig.getTools();
- configToolRef = configTools[0];
- assertNotNull(configToolRef);
-
- // Test that the string option is overridden in the configuration
- optsInCat = categories[0].getOptions(configs[0]);
- for (i=0; i<optsInCat.length; i++)
- if (optsInCat[i][0] == null) break;
- assertEquals(1, i);
- optCat = (IOption)optsInCat[0][1];
- assertEquals(freeOptName, optCat.getName());
- configStringOpt = configToolRef.getOptionById(optCat.getId());
- try {
- assertEquals(stringOverride, configStringOpt.getStringValue());
- } catch (BuildException e) {
- fail("Failure getting string value in subsubconfiguration: " + e.getLocalizedMessage());
- }
- // The tool should also contain the boolean option set to true
- IOption optSubCat = (IOption)optsInSubCat[0][1];
- IOption configBoolOpt = configToolRef.getOptionById(optSubCat.getId());
- assertNotNull(configBoolOpt);
- try {
- assertTrue(configBoolOpt.getBooleanValue());
- } catch (BuildException e) {
- fail("Failure getting boolean value in subsubconfiguration: " + e.getLocalizedMessage());
- }
-
- // Override it in config and retest
- try {
- subSubConfig.setOption(configToolRef, configBoolOpt, false);
- } catch (BuildException e) {
- fail("Failure setting boolean value in subsubconfiguration: " + e.getLocalizedMessage());
- }
- optsInSubCat = subCategories[0].getOptions(configs[0]);
- for (i=0; i<optsInSubCat.length; i++)
- if (optsInSubCat[i][0] == null) break;
- assertEquals(1, i);
- configBoolOpt = configToolRef.getOptionById(((IOption)optsInSubCat[0][1]).getId());
- assertEquals(chainedOptName, booleanRef.getName());
- try {
- assertFalse(configBoolOpt.getBooleanValue());
- } catch (BuildException e) {
- fail("Failure getting boolean value in subsubconfiguration: " + e.getLocalizedMessage());
- }
- }
-
- /*
- * Do a sanity check on the values in the sub-project type. Most of the
- * sanity on the how build model entries are read is performed in
- * the root project type check, so these tests just verify that the the sub
- * project type properly inherits from its parent. For the new options
- * in the sub project type, the test does a sanity check just to be complete.
+ * Navigates through the CDT 2.1 manifest file and verifies that the
+ * definitions are loaded correctly.
*/
- private void checkSubProjectType(IProjectType projType) throws BuildException {
- final String expectedFlags = "-I/usr/include -I/opt/gnome/include -IC:\\home\\tester/include -I\"../includes\" x y z";
-
- IConfiguration[] configs = projType.getConfigurations();
- // Check the overridden clean command
- assertEquals("rm -yourworld", configs[0].getCleanCommand());
- // Make sure the projType inherits the make command
- assertEquals("make", configs[0].getBuildCommand());
- // Make sure the binary parser is hard-coded and available
- IToolChain toolChain = configs[0].getToolChain();
- ITargetPlatform targetPlatform = toolChain.getTargetPlatform();
- assertEquals("org.eclipse.cdt.core.PE", targetPlatform.getBinaryParserId());
- String[] expectedOSList = {"win32","linux","solaris"};
- assertTrue(Arrays.equals(expectedOSList, toolChain.getOSList()));
- // Make sure the list is overridden
- String[] expectedArchList = {"x86", "ppc"};
- assertTrue(Arrays.equals(expectedArchList, toolChain.getArchList()));
-
- // Make sure this is a test projType
- assertTrue(projType.isTestProjectType());
- // Make sure the build artifact extension is there
- assertEquals(configs[0].getArtifactExtension(), subExt);
-
- // Get the tools for this projType
- ITool[] tools = configs[0].getTools();
- // Do we inherit properly from parent
- ITool rootTool = tools[0];
- assertEquals("Root Tool", rootTool.getName());
- // Now get the tool defined for this projType
- ITool subTool = tools[1];
- assertEquals("Sub Tool", subTool.getName());
- // Confirm that it has four options
- IOption[] subOpts = subTool.getOptions();
- assertEquals(5, subOpts.length);
- assertEquals("", subTool.getOutputFlag());
- assertTrue(subTool.buildsFileType("yarf"));
- assertTrue(subTool.producesFileType("bus"));
- assertEquals("", subTool.getToolCommand());
- assertEquals("lib", subTool.getOutputPrefix());
- assertTrue(subTool.isHeaderFile("arf"));
- assertTrue(subTool.isHeaderFile("barf"));
- assertEquals(ITool.FILTER_BOTH, subTool.getNatureFilter());
-
- // Do a sanity check on the options
- assertEquals("Include Paths", subOpts[0].getName());
- assertEquals(IOption.INCLUDE_PATH, subOpts[0].getValueType());
- String[] incPath = subOpts[0].getIncludePaths();
- assertEquals(2, incPath.length);
- assertEquals("/usr/include", incPath[0]);
- assertEquals("/opt/gnome/include", incPath[1]);
- String[] builtInPaths = subOpts[0].getBuiltIns();
- assertEquals(1, builtInPaths.length);
- assertEquals("/usr/gnu/include", builtInPaths[0]);
- assertEquals("-I", subOpts[0].getCommand());
- assertEquals(IOption.BROWSE_DIR, subOpts[0].getBrowseType());
-
- // There are no user-defined preprocessor symbols
- assertEquals("Defined Symbols", subOpts[1].getName());
- assertEquals(IOption.PREPROCESSOR_SYMBOLS, subOpts[1].getValueType());
- String[] defdSymbols = subOpts[1].getDefinedSymbols();
- assertEquals(0, defdSymbols.length);
- assertEquals("-D", subOpts[1].getCommand());
- // But there is a builtin
- String[] builtInSymbols = subOpts[1].getBuiltIns();
- assertEquals(1, builtInSymbols.length);
- assertEquals("BUILTIN", builtInSymbols[0]);
- // Broswe type should be none
- assertEquals(IOption.BROWSE_NONE, subOpts[1].getBrowseType());
-
- assertEquals("More Includes", subOpts[2].getName());
- assertEquals(IOption.INCLUDE_PATH, subOpts[2].getValueType());
- String[] moreIncPath = subOpts[2].getIncludePaths();
- assertEquals(2, moreIncPath.length);
- assertEquals("C:\\home\\tester/include", moreIncPath[0]);
- assertEquals("-I", subOpts[2].getCommand());
- assertEquals(IOption.BROWSE_DIR, subOpts[2].getBrowseType());
-
- // Check the user object option
- assertEquals("User Objects", subOpts[3].getName());
- assertEquals(IOption.OBJECTS, subOpts[3].getValueType());
- String[] objs = subOpts[3].getUserObjects();
- assertEquals(2, objs.length);
- assertEquals("obj1.o", objs[0]);
- assertEquals("obj2.o", objs[1]);
- assertEquals(IOption.BROWSE_FILE, subOpts[3].getBrowseType());
- assertEquals("", subOpts[3].getCommand());
-
- // There should be a string list with no command
- assertEquals("No Command StringList", subOpts[4].getName());
- assertEquals(IOption.STRING_LIST, subOpts[4].getValueType());
-
- // Make sure the tool flags look right
- assertEquals(subTool.getToolFlags(), expectedFlags);
-
- // Get the configs for this projType; it should inherit all the configs defined for the parent
- assertEquals(4, configs.length);
- assertEquals("Sub Config", configs[0].getName());
- assertEquals("Root Config", configs[1].getName());
- assertEquals("Root Override Config", configs[2].getName());
- assertEquals("Complete Override Config", configs[3].getName());
- }
-
- private void checkForwardProjectTypes(IProjectType parent, IProjectType child, IProjectType grandchild) {
- // check that the projType parent reference has been resolved.
- assertEquals(parent, child.getSuperClass());
- assertEquals(child, grandchild.getSuperClass());
-
- // get the parent tool
- IConfiguration[] parentConfigs = parent.getConfigurations();
- ITool[] parentTools = parentConfigs[0].getTools();
- assertEquals(1, parentTools.length);
- ITool parentTool = parentTools[0];
- assertNotNull(parentTool);
-
- // check option categories
- IOption option = parentTool.getOptionById("test.forward.option");
- assertNotNull(option);
- IOptionCategory[] firstLevel = parentTool.getTopOptionCategory()
- .getChildCategories();
- assertEquals(1, firstLevel.length);
- IOptionCategory[] secondLevel = firstLevel[0].getChildCategories();
- assertEquals(1, secondLevel.length);
- assertEquals(0, secondLevel[0].getChildCategories().length);
- Object[][] optList = secondLevel[0].getOptions(parentConfigs[0]);
- int i;
- for (i=0; i<optList.length; i++)
- if (optList[i][0] == null) break;
- assertEquals(1, i);
- assertEquals(option, optList[0][1]);
-
- // get the tool reference from the child
- IConfiguration[] childConfigs = child.getConfigurations();
- ITool[] childTools = childConfigs[0].getTools();
- assertEquals(1, childTools.length);
- ITool childToolRef = childTools[0];
- assertEquals(parentTool.getSuperClass(), childToolRef.getSuperClass());
-
- // get and check the option reference
- IOption optRef = childToolRef.getOptionById("test.forward.option");
- assertEquals(option, optRef);
-
- // get the tool reference from the grandchild
- IConfiguration[] grandConfigs = grandchild.getConfigurations();
- ITool[] grandTools = grandConfigs[0].getTools();
- assertEquals(1, grandTools.length);
- ITool grandToolRef = grandTools[0];
- assertEquals(parentTool.getSuperClass(), grandToolRef.getSuperClass());
-
- }
-
- public void checkProviderProjectType(IProjectType projType) throws Exception {
- Properties props = new Properties();
- props.load(getClass().getResourceAsStream("test_commands"));
-
- // check that this projType is in the file
- String command = props.getProperty(projType.getId());
- assertNotNull(command);
-
- IProjectType parent = projType.getSuperClass();
- assertNotNull(parent);
- assertEquals("test.forward.parent.target", parent.getId());
-
- IConfiguration[] configs = projType.getConfigurations();
- ITool toolRef = configs[0].getFilteredTools()[0];
- assertEquals(command, toolRef.getToolCommand());
+ public void testLoadManifest() throws Exception {
+ IProjectType exeType = ManagedBuildManager.getProjectType("cdt.managedbuild.target.testgnu.exe");
+ assertNotNull(exeType);
+ IProjectType libType = ManagedBuildManager.getProjectType("cdt.managedbuild.target.testgnu.lib");
+ assertNotNull(libType);
+ IProjectType dllType = ManagedBuildManager.getProjectType("cdt.managedbuild.target.testgnu.so");
+ assertNotNull(dllType);
}
/**
* Remove all the project information associated with the project used during test.
*/
public void cleanup() {
- removeProject(projectName);
- removeProject(projectName2);
- }
-
- /* (non-Javadoc)
- * 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 newProjectHandle = root.getProject(name);
- IProject project = null;
-
- if (!newProjectHandle.exists()) {
- IWorkspace workspace = ResourcesPlugin.getWorkspace();
- IWorkspaceDescription workspaceDesc = workspace.getDescription();
- workspaceDesc.setAutoBuilding(false);
- workspace.setDescription(workspaceDesc);
- IProjectDescription description = workspace.newProjectDescription(newProjectHandle.getName());
- //description.setLocation(root.getLocation());
- project = CCorePlugin.getDefault().createCProject(description, newProjectHandle, new NullProgressMonitor(), MakeCorePlugin.MAKE_PROJECT_ID);
- } else {
- newProjectHandle.refreshLocal(IResource.DEPTH_INFINITE, null);
- project = newProjectHandle;
- }
-
- // Open the project if we have to
- if (!project.isOpen()) {
- project.open(new NullProgressMonitor());
- }
-
- 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 {
- Thread.sleep(1000);
- } catch (InterruptedException e1) {
- } finally {
- try {
- System.gc();
- System.runFinalization();
- project.delete(true, true, null);
- } catch (CoreException e2) {
- assertTrue(false);
- }
- }
- }
- }
- /**
- * @throws CoreException
- * @throws BuildException
- */
- public void testErrorParsers() throws BuildException {
- // Create new project
- IProject project = null;
- try {
- project = createProject(projectName2);
- // Now associate the builder with the project
- addManagedBuildNature(project);
- IProjectDescription description = project.getDescription();
- // Make sure it has a managed nature
- if (description != null) {
- assertTrue(description.hasNature(ManagedCProjectNature.MNG_NATURE_ID));
- }
- } catch (CoreException e) {
- fail("Test failed on error parser project creation: " + e.getLocalizedMessage());
- }
-
- // Find the base project Type definition
- IProjectType projType = ManagedBuildManager.getProjectType("test.error.parsers");
- assertNotNull(projType);
-
- // Create the target for our project that builds a dummy executable
- IManagedProject newProj = ManagedBuildManager.createManagedProject(project, projType);
- assertEquals(newProj.getName(), projType.getName());
- ManagedBuildManager.setNewProjectVersion(project);
-
- // Initialize the path entry container
- IStatus initResult = ManagedBuildManager.initBuildInfoContainer(project);
- if (initResult.getCode() != IStatus.OK) {
- fail("Initializing build information failed for: " + project.getName() + " because: " + initResult.getMessage());
- }
-
- // Copy over the configs
- IConfiguration[] baseConfigs = projType.getConfigurations();
- for (int i = 0; i < baseConfigs.length; ++i) {
- newProj.createConfiguration(baseConfigs[i], baseConfigs[i].getId() + "." + i);
- }
-
- // Test this out
- checkErrorParsersProject(newProj);
-
- // Save, close, reopen and test again
- ManagedBuildManager.saveBuildInfo(project, true);
- ManagedBuildManager.removeBuildInfo(project);
- try {
- project.close(null);
- } catch (CoreException e) {
- fail("Failed on error parser project close: " + e.getLocalizedMessage());
- }
- try {
- project.open(null);
- } catch (CoreException e) {
- fail("Failed on error parser project open: " + e.getLocalizedMessage());
- }
-
- // Test that the default config was remembered
- IManagedBuildInfo info = ManagedBuildManager.getBuildInfo(project);
-
- // Check the rest of the default information
- checkErrorParsersProject(info.getManagedProject());
- ManagedBuildManager.removeBuildInfo(project);
- }
-
- /*
- * Do a sanity check on the error parsers target.
- */
- private void checkErrorParsersProject(IManagedProject proj) throws BuildException {
- // Target stuff
- String expectedBinParserId = "org.eclipse.cdt.core.PE";
- IConfiguration[] configs = proj.getConfigurations();
- IToolChain toolChain = configs[0].getToolChain();
- ITargetPlatform targetPlatform = toolChain.getTargetPlatform();
- assertEquals(expectedBinParserId, targetPlatform.getBinaryParserId());
- // This target defines errors parsers. Check that the error parsers
- // have been assigned.
- assertEquals("org.eclipse.cdt.core.MakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GLDErrorParser", configs[0].getErrorParserIds());
-
- // Tool
- ITool[] tools = configs[0].getTools();
- ITool rootTool = tools[0];
- assertEquals(1, tools.length);
- assertEquals("EP Tool", tools[0].getName());
- assertEquals("-o", tools[0].getOutputFlag());
- assertTrue(tools[0].buildsFileType("y"));
- assertTrue(tools[0].buildsFileType("x"));
- assertTrue(tools[0].producesFileType("xy"));
- assertEquals("EP", tools[0].getToolCommand());
- assertEquals(ITool.FILTER_C, rootTool.getNatureFilter());
-
- // There should be one defined configs
- assertEquals(1, configs.length);
- }
-
- /**
- * Test that the build artifact of a <code>ITarget</code> can be modified
- * programmatically.
- */
- public void testConfigBuildArtifact () throws CoreException {
- // Open the test project
- IProject project = createProject(projectName);
- IManagedBuildInfo info = ManagedBuildManager.getBuildInfo(project);
- assertNotNull(info);
- IManagedProject managedProj = info.getManagedProject();
- assertNotNull(managedProj);
- IConfiguration defaultConfig = info.getDefaultConfiguration();
- assertNotNull(defaultConfig);
-
- // Set the build artifact of the configuration
- String ext = defaultConfig.getArtifactExtension();
- String name = project.getName() + "." + ext;
- defaultConfig.setArtifactName(name);
-
- // Save, close, reopen and test again
- ManagedBuildManager.saveBuildInfo(project, false);
- ManagedBuildManager.removeBuildInfo(project);
- project.close(null);
- project.open(null);
-
- // Check the artifact name
- info = ManagedBuildManager.getBuildInfo(project);
- assertNotNull(info);
- managedProj = info.getManagedProject();
- assertNotNull(managedProj);
- defaultConfig = info.getDefaultConfiguration();
- assertNotNull(defaultConfig);
- assertEquals(name, defaultConfig.getArtifactName());
- }
-
- public void testThatAlwaysFails() {
- assertTrue(false);
- }
-
- public void testBug43450 () throws Exception{
- IProject project = createProject( projectName );
-
- IFolder folder = project.getProject().getFolder( "includes" );
- if( !folder.exists() ){
- folder.create( false, true, null );
- }
-
- IFile file = project.getProject().getFile( "includes/header.h" );
- if( !file.exists() ){
- file.create( new ByteArrayInputStream( "class A { public : static int i; };".getBytes() ), false, null );
- }
-
- IScannerInfoProvider provider = CCorePlugin.getDefault().getScannerInfoProvider(project);
- IScannerInfo info = provider.getScannerInformation( project );
- ISourceElementRequestor callback = new NullSourceElementRequestor();
-
- IScanner scanner = ParserFactory.createScanner( new CodeReader( "#include <header.h>\n int A::i = 1;".toCharArray() ),
- info, ParserMode.COMPLETE_PARSE, ParserLanguage.CPP, callback, new NullLogService(), null);
-
- IParser parser = ParserFactory.createParser( scanner, callback, ParserMode.COMPLETE_PARSE, ParserLanguage.CPP, null );
- assertTrue( parser.parse() );
+ //removeProject(projectName);
}
}
Index: tests/org/eclipse/cdt/managedbuild/core/tests/ManagedCommandLineGeneratorTest.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.managedbuilder.core.tests/tests/org/eclipse/cdt/managedbuild/core/tests/ManagedCommandLineGeneratorTest.java,v
retrieving revision 1.1
diff -u -r1.1 ManagedCommandLineGeneratorTest.java
--- tests/org/eclipse/cdt/managedbuild/core/tests/ManagedCommandLineGeneratorTest.java 28 Oct 2004 17:16:26 -0000 1.1
+++ tests/org/eclipse/cdt/managedbuild/core/tests/ManagedCommandLineGeneratorTest.java 1 Nov 2004 19:29:48 -0000
@@ -10,13 +10,21 @@
**********************************************************************/
package org.eclipse.cdt.managedbuild.core.tests;
+import java.util.ArrayList;
+
import junit.framework.TestCase;
import junit.framework.Test;
import junit.framework.TestSuite;
+import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
+import org.eclipse.cdt.managedbuilder.core.IProjectType;
+import org.eclipse.cdt.managedbuilder.core.IConfiguration;
+import org.eclipse.cdt.managedbuilder.core.ITool;
+import org.eclipse.cdt.managedbuilder.core.IOption;
import org.eclipse.cdt.managedbuilder.core.IManagedCommandLineGenerator;
import org.eclipse.cdt.managedbuilder.core.IManagedCommandLineInfo;
import org.eclipse.cdt.managedbuilder.internal.core.ManagedCommandLineGenerator;
+import org.eclipse.cdt.managedbuilder.makegen.IManagedBuilderMakefileGenerator;
public class ManagedCommandLineGeneratorTest extends TestCase {
@@ -58,6 +66,7 @@
suite.addTest( new ManagedCommandLineGeneratorTest( "testGenerateCommandLineInfoPatterns" ) );
// TODO: The parameters set to NULL in these tests are not currently allowed to be null
//suite.addTest( new ManagedCommandLineGeneratorTest( "testGenerateCommandLineInfoParameters" ) );
+ suite.addTest( new ManagedCommandLineGeneratorTest( "testCustomGenerator" ) );
return suite;
}
@@ -99,6 +108,49 @@
info = gen.generateCommandLineInfo( null, COMMAND_VAL, FLAGS_ARRAY_VAL, OUTPUT_FLAG_VAL, OUTPUT_PREFIX_VAL, OUTPUT_VAL, null, null );
assertNotNull( info );
assertEquals( info.getCommandLine().trim(), commandLineEtalonesForParameters[5].trim() );
+ }
+
+ public final void testCustomGenerator() {
+
+ // First, verify the elements in the project type
+ IProjectType proj = ManagedBuildManager.getProjectType("cdt.managedbuild.test.java.attrs");
+ assertNotNull(proj);
+ IConfiguration[] configs = proj.getConfigurations();
+ assertEquals(1, configs.length);
+ IConfiguration config = proj.getConfiguration("cdt.managedbuild.test.java.attrs.config");
+ assertNotNull(config);
+ ITool[] tools = config.getTools();
+ assertEquals(1, tools.length);
+ ITool tool = config.getTool("cdt.managedbuild.test.java.attrs.tool");
+ assertNotNull(tool);
+ IOption[] options = tool.getOptions();
+ assertEquals(20, options.length);
+ IOption option = tool.getOption("testgnu.c.compiler.option.preprocessor.def.symbols.test");
+ assertNotNull(option);
+ Object val = option.getValue();
+ assertTrue(val instanceof ArrayList);
+ ArrayList list = (ArrayList)val;
+ assertEquals("foo", list.get(0));
+ assertEquals("bar", list.get(1));
+
+ // Next, invoke the commandLineGenerator for this tool
+ IManagedCommandLineGenerator gen = tool.getCommandLineGenerator();
+ String[] flags = {"-a", "-b", "-c"};
+ String[] inputs = {"xy.cpp", "ab.cpp", "lt.cpp", "c.cpp"};
+ IManagedCommandLineInfo info = gen.generateCommandLineInfo(tool, "MyName", flags, "-of", "opre", "TheOutput.exe", inputs, "[COMMAND] [FLAGS]");
+ assertEquals("compiler.gnu.cMyName", info.getCommandName());
+ assertEquals("-c -b -a", info.getFlags());
+ assertEquals("ab.cpp c.cpp foo.cpp lt.cpp xy.cpp", info.getInputs());
+ assertEquals("-0h", info.getOutputFlag());
+ assertEquals("", info.getOutputPrefix());
+ assertEquals("Testme", info.getOutput());
+ assertEquals("[COMMAND] [FLAGS]", info.getCommandLinePattern());
+ assertEquals("This is a test command line", info.getCommandLine());
+
+ // Next, invoke the build file generator for the tool chain
+ IManagedBuilderMakefileGenerator makeGen = ManagedBuildManager.getBuildfileGenerator(config);
+ String name = makeGen.getMakefileName();
+ assertEquals("TestBuildFile.mak", name);
}
}
Index: tests/org/eclipse/cdt/managedbuild/core/tests/BuildFileGenerator.java
===================================================================
RCS file: tests/org/eclipse/cdt/managedbuild/core/tests/BuildFileGenerator.java
diff -N tests/org/eclipse/cdt/managedbuild/core/tests/BuildFileGenerator.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ tests/org/eclipse/cdt/managedbuild/core/tests/BuildFileGenerator.java 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,91 @@
+/**********************************************************************
+ * Copyright (c) 2004 Intel Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * Intel Corporation - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.cdt.managedbuild.core.tests;
+
+import org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo;
+import org.eclipse.cdt.managedbuilder.makegen.gnu.GnuMakefileGenerator;
+import org.eclipse.cdt.managedbuilder.makegen.IManagedBuilderMakefileGenerator;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IResourceDelta;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.MultiStatus;
+
+/**
+ * Test build file generator
+ */
+public class BuildFileGenerator implements IManagedBuilderMakefileGenerator {
+
+ private IManagedBuilderMakefileGenerator defGen = new GnuMakefileGenerator();
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.managedbuilder.makegen.IManagedBuilderMakefileGenerator#generateDependencies()
+ */
+ public void generateDependencies() throws CoreException {
+ defGen.generateDependencies();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.managedbuilder.makegen.IManagedBuilderMakefileGenerator#generateMakefiles(org.eclipse.core.resources.IResourceDelta)
+ */
+ public MultiStatus generateMakefiles(IResourceDelta delta)
+ throws CoreException {
+ return defGen.generateMakefiles(delta);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.managedbuilder.makegen.IManagedBuilderMakefileGenerator#getBuildWorkingDir()
+ */
+ public IPath getBuildWorkingDir() {
+ IPath current = defGen.getBuildWorkingDir();
+ current.append("temp");
+ return current;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.managedbuilder.makegen.IManagedBuilderMakefileGenerator#getMakefileName()
+ */
+ public String getMakefileName() {
+ return new String("TestBuildFile.mak");
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.managedbuilder.makegen.IManagedBuilderMakefileGenerator#initialize(org.eclipse.core.resources.IProject, org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo, org.eclipse.core.runtime.IProgressMonitor)
+ */
+ public void initialize(IProject project, IManagedBuildInfo info,
+ IProgressMonitor monitor) {
+ defGen.initialize(project, info, monitor);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.managedbuilder.makegen.IManagedBuilderMakefileGenerator#isGeneratedResource(org.eclipse.core.resources.IResource)
+ */
+ public boolean isGeneratedResource(IResource resource) {
+ return defGen.isGeneratedResource(resource);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.managedbuilder.makegen.IManagedBuilderMakefileGenerator#regenerateDependencies(boolean)
+ */
+ public void regenerateDependencies(boolean force) throws CoreException {
+ defGen.regenerateDependencies(force);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.managedbuilder.makegen.IManagedBuilderMakefileGenerator#regenerateMakefiles()
+ */
+ public MultiStatus regenerateMakefiles() throws CoreException {
+ return defGen.regenerateMakefiles();
+ }
+
+}
Index: tests/org/eclipse/cdt/managedbuild/core/tests/ManagedBuildCommandLineGenerator.java
===================================================================
RCS file: tests/org/eclipse/cdt/managedbuild/core/tests/ManagedBuildCommandLineGenerator.java
diff -N tests/org/eclipse/cdt/managedbuild/core/tests/ManagedBuildCommandLineGenerator.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ tests/org/eclipse/cdt/managedbuild/core/tests/ManagedBuildCommandLineGenerator.java 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,76 @@
+/**********************************************************************
+ * Copyright (c) 2004 Intel Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * Intel Corporation - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.cdt.managedbuild.core.tests;
+
+import org.eclipse.cdt.managedbuilder.core.IManagedCommandLineGenerator;
+import org.eclipse.cdt.managedbuilder.core.IManagedCommandLineInfo;
+import org.eclipse.cdt.managedbuilder.core.ITool;
+import org.eclipse.cdt.managedbuilder.core.IToolChain;
+
+/**
+ * Test command line generator
+ */
+public class ManagedBuildCommandLineGenerator implements
+ IManagedCommandLineGenerator {
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.managedbuilder.core.IManagedCommandLineGenerator#generateCommandLineInfo(org.eclipse.cdt.managedbuilder.core.ITool, java.lang.String, java.lang.String[], java.lang.String, java.lang.String, java.lang.String, java.lang.String[], java.lang.String)
+ */
+ public IManagedCommandLineInfo generateCommandLineInfo(ITool tool,
+ String commandName, String[] flags, String outputFlag,
+ String outputPrefix, String outputName, String[] inputResources,
+ String commandLinePattern) {
+ ManagedBuildCommandLineInfo info = new ManagedBuildCommandLineInfo();
+ // Concatenate the tool name and the passed in command name
+ info.commandName = new String(tool.getName() + commandName);
+ // Put out the flags backwards
+ String myflags = new String();
+ for (int i = flags.length - 1; i >= 0; i--) {
+ if (i < flags.length - 1) myflags += " ";
+ myflags += flags[i];
+ }
+ info.commandFlags = myflags;
+ // Alphabetize the inputs and add foo.cpp
+ String[] inputs = new String[inputResources.length + 1];
+ String myinputs = new String();
+ for (int i=0; i<inputResources.length; i++) {
+ inputs[i] = inputResources[i];
+ }
+ inputs[inputResources.length] = "foo.cpp";
+ // Sort
+ for (int i = 0; i < inputs.length; i++) {
+ for (int j = 1; j < inputs.length; j++) {
+ if (inputs[j].compareTo(inputs[j-1]) < 0) {
+ String temp = inputs[j-1];
+ inputs[j-1] = inputs[j];
+ inputs[j] = temp;
+ }
+ }
+ }
+ for (int i = 0; i < inputs.length; i++) {
+ if (i > 0) myinputs += " ";
+ myinputs += inputs[i];
+ }
+ info.commandInputs = myinputs;
+ // Don't change the command line pattern
+ info.commandLinePattern = new String(commandLinePattern);
+ // Config artifact name
+ info.commandOutput = new String(((IToolChain)tool.getParent()).getParent().getArtifactName());
+ // -Oh
+ info.commandOutputFlag = new String("-0h");
+ // ""
+ info.commandOutputPrefix = new String("");
+ // "This is a test command line"
+ info.commandLine = new String("This is a test command line");
+ return info;
+ }
+
+}
Index: tests/org/eclipse/cdt/managedbuild/core/tests/ManagedBuildCommandLineInfo.java
===================================================================
RCS file: tests/org/eclipse/cdt/managedbuild/core/tests/ManagedBuildCommandLineInfo.java
diff -N tests/org/eclipse/cdt/managedbuild/core/tests/ManagedBuildCommandLineInfo.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ tests/org/eclipse/cdt/managedbuild/core/tests/ManagedBuildCommandLineInfo.java 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,84 @@
+/**********************************************************************
+ * Copyright (c) 2004 Intel Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * Intel Corporation - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.cdt.managedbuild.core.tests;
+
+import org.eclipse.cdt.managedbuilder.core.IManagedCommandLineInfo;
+
+/**
+ * Command line info for use with ManagedBuildCommandLineGenerator
+ */
+public class ManagedBuildCommandLineInfo implements IManagedCommandLineInfo {
+ public String commandLine;
+ public String commandLinePattern;
+ public String commandName;
+ public String commandFlags;
+ public String commandInputs;
+ public String commandOutput;
+ public String commandOutputFlag;
+ public String commandOutputPrefix;
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.managedbuilder.core.IManagedCommandLineInfo#getCommandLine()
+ */
+ public String getCommandLine() {
+ return commandLine;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.managedbuilder.core.IManagedCommandLineInfo#getCommandLinePattern()
+ */
+ public String getCommandLinePattern() {
+ return commandLinePattern;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.managedbuilder.core.IManagedCommandLineInfo#getCommandName()
+ */
+ public String getCommandName() {
+ return commandName;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.managedbuilder.core.IManagedCommandLineInfo#getFlags()
+ */
+ public String getFlags() {
+ return commandFlags;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.managedbuilder.core.IManagedCommandLineInfo#getInputs()
+ */
+ public String getInputs() {
+ return commandInputs;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.managedbuilder.core.IManagedCommandLineInfo#getOutput()
+ */
+ public String getOutput() {
+ return commandOutput;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.managedbuilder.core.IManagedCommandLineInfo#getOutputFlag()
+ */
+ public String getOutputFlag() {
+ return commandOutputFlag;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.managedbuilder.core.IManagedCommandLineInfo#getOutputPrefix()
+ */
+ public String getOutputPrefix() {
+ return commandOutputPrefix;
+ }
+
+}
Index: tests/org/eclipse/cdt/managedbuild/core/tests/ManagedBuildCoreTests20.java
===================================================================
RCS file: tests/org/eclipse/cdt/managedbuild/core/tests/ManagedBuildCoreTests20.java
diff -N tests/org/eclipse/cdt/managedbuild/core/tests/ManagedBuildCoreTests20.java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ tests/org/eclipse/cdt/managedbuild/core/tests/ManagedBuildCoreTests20.java 1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,1920 @@
+/**********************************************************************
+ * Copyright (c) 2003 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ **********************************************************************/
+package org.eclipse.cdt.managedbuild.core.tests;
+
+import java.io.ByteArrayInputStream;
+import java.util.Arrays;
+import java.util.Map;
+import java.util.Properties;
+
+import junit.framework.Test;
+import junit.framework.TestCase;
+import junit.framework.TestSuite;
+
+import org.eclipse.cdt.core.CCorePlugin;
+import org.eclipse.cdt.core.ICDescriptor;
+import org.eclipse.cdt.core.parser.CodeReader;
+import org.eclipse.cdt.core.parser.IParser;
+import org.eclipse.cdt.core.parser.IScanner;
+import org.eclipse.cdt.core.parser.IScannerInfo;
+import org.eclipse.cdt.core.parser.IScannerInfoChangeListener;
+import org.eclipse.cdt.core.parser.IScannerInfoProvider;
+import org.eclipse.cdt.core.parser.ISourceElementRequestor;
+import org.eclipse.cdt.core.parser.NullLogService;
+import org.eclipse.cdt.core.parser.NullSourceElementRequestor;
+import org.eclipse.cdt.core.parser.ParserFactory;
+import org.eclipse.cdt.core.parser.ParserLanguage;
+import org.eclipse.cdt.core.parser.ParserMode;
+import org.eclipse.cdt.make.core.MakeCorePlugin;
+import org.eclipse.cdt.managedbuilder.core.BuildException;
+import org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo;
+import org.eclipse.cdt.managedbuilder.core.IProjectType;
+import org.eclipse.cdt.managedbuilder.core.IManagedProject;
+import org.eclipse.cdt.managedbuilder.core.IConfiguration;
+import org.eclipse.cdt.managedbuilder.core.IToolChain;
+import org.eclipse.cdt.managedbuilder.core.ITool;
+import org.eclipse.cdt.managedbuilder.core.IOption;
+import org.eclipse.cdt.managedbuilder.core.IOptionCategory;
+import org.eclipse.cdt.managedbuilder.core.ITargetPlatform;
+import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
+import org.eclipse.cdt.managedbuilder.core.ManagedCProjectNature;
+import org.eclipse.cdt.managedbuilder.internal.core.Option;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IProjectDescription;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IWorkspace;
+import org.eclipse.core.resources.IWorkspaceDescription;
+import org.eclipse.core.resources.IWorkspaceRoot;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IExtensionPoint;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Platform;
+
+/*
+ * These tests exercise CDT 2.0 manifest file functionality
+ */
+public class ManagedBuildCoreTests20 extends TestCase {
+ private static final boolean boolVal = true;
+ private static final String testConfigId = "test.config.override";
+ private static final String testConfigName = "Tester";
+ private static final String enumVal = "Another Enum";
+ private static final String[] listVal = {"_DEBUG", "/usr/include", "libglade.a"};
+ private static final String newExt = "wen";
+ private static final String projectName = "ManagedBuildTest";
+ private static final String projectName2 = "ManagedBuildTest2";
+ private static final String projectRename = "ManagedBuildRedux";
+ private static final String rootExt = "toor";
+ private static final String stringVal = "-c -Wall";
+ private static final String anotherStringVal = "thevalue";
+ private static final String subExt = "bus";
+
+ public ManagedBuildCoreTests20(String name) {
+ super(name);
+ }
+
+ public static Test suite() {
+ TestSuite suite = new TestSuite(ManagedBuildCoreTests20.class.getName());
+
+ suite.addTest(new ManagedBuildCoreTests20("testExtensions"));
+ suite.addTest(new ManagedBuildCoreTests20("testProjectCreation"));
+ suite.addTest(new ManagedBuildCoreTests20("testConfigurations"));
+ suite.addTest(new ManagedBuildCoreTests20("testConfigurationReset"));
+ suite.addTest(new ManagedBuildCoreTests20("testConfigBuildArtifact"));
+ suite.addTest(new ManagedBuildCoreTests20("testMakeCommandManipulation"));
+ suite.addTest(new ManagedBuildCoreTests20("testScannerInfoInterface"));
+ suite.addTest(new ManagedBuildCoreTests20("testBug43450"));
+ suite.addTest(new ManagedBuildCoreTests20("testProjectRename"));
+ suite.addTest(new ManagedBuildCoreTests20("testErrorParsers"));
+ suite.addTest(new ManagedBuildCoreTests20("cleanup"));
+
+ return suite;
+ }
+
+ /**
+ * Navigates through the build info as defined in the extensions
+ * defined in this plugin
+ */
+ public void testExtensions() throws Exception {
+ IProjectType testRoot = null;
+ IProjectType testSub = null;
+ IProjectType testSubSub = null;
+ IProjectType testForwardChild = null;
+ IProjectType testForwardParent = null;
+ IProjectType testForwardGrandchild = null;
+ int numTypes = 0;
+
+ // Note secret null parameter which means just extensions
+ IProjectType[] projTypes = ManagedBuildManager.getDefinedProjectTypes();
+
+ for (int i = 0; i < projTypes.length; ++i) {
+ IProjectType type = projTypes[i];
+
+ if (type.getName().equals("Test Root")) {
+ testRoot = type;
+ checkRootProjectType(testRoot);
+ } else if (type.getName().equals("Test Sub")) {
+ testSub = type;
+ checkSubProjectType(testSub);
+ } else if (type.getName().equals("Test Sub Sub")) {
+ testSubSub = type;
+ checkSubSubProjectType(testSubSub);
+ } else if (type.getName().equals("Forward Child")) {
+ testForwardChild = type;
+ } else if (type.getName().equals("Forward Parent")) {
+ testForwardParent = type;
+ } else if (type.getName().equals("Forward Grandchild")) {
+ testForwardGrandchild = type;
+ } else if (type.getId().startsWith("test.provider.Test_")) {
+ numTypes++;
+ checkProviderProjectType(type);
+ }
+ }
+ // check that the forward references are properly resolved.
+ assertNotNull(testForwardChild);
+ assertNotNull(testForwardParent);
+ assertNotNull(testForwardGrandchild);
+ checkForwardProjectTypes(testForwardParent, testForwardChild, testForwardGrandchild);
+
+ // check that the proper number of projectTypes were dynamically provided
+ assertEquals(3, numTypes);
+
+ // All these project types are defines in the plugin files, so none
+ // of them should be null at this point
+ assertNotNull(testRoot);
+ assertNotNull(testSub);
+ assertNotNull(testSubSub);
+ }
+
+ /**
+ * This test exercises the interface the <code>IConfiguration</code> exposes to manipulate
+ * its make command.
+ */
+ public void testMakeCommandManipulation () {
+ String oldMakeCmd = "make";
+ String newMakeCmd = "Ant";
+
+ // Open the test project
+ IProject project = null;
+ try {
+ project = createProject(projectName);
+ IProjectDescription description = project.getDescription();
+ // Make sure it has a managed nature
+ if (description != null) {
+ assertTrue(description.hasNature(ManagedCProjectNature.MNG_NATURE_ID));
+ }
+ } catch (CoreException e) {
+ fail("Failed to open project in 'testMakeCommandManipulation': " + e.getLocalizedMessage());
+ }
+ assertNotNull(project);
+
+ // Now get the default configuration
+ IManagedBuildInfo info = ManagedBuildManager.getBuildInfo(project);
+ assertNotNull(info);
+ IManagedProject managedProj = info.getManagedProject();
+ assertNotNull(managedProj);
+ IConfiguration defaultConfig = info.getDefaultConfiguration();
+ assertNotNull(defaultConfig);
+
+ // Does it have a default build command
+ assertFalse(defaultConfig.hasOverriddenBuildCommand());
+ assertEquals(oldMakeCmd, defaultConfig.getBuildCommand());
+
+ // Change it
+ defaultConfig.setBuildCommand(newMakeCmd);
+ assertEquals(newMakeCmd, defaultConfig.getBuildCommand());
+ assertTrue(defaultConfig.hasOverriddenBuildCommand());
+
+ // Reset it
+ defaultConfig.setBuildCommand(null);
+ assertFalse(defaultConfig.hasOverriddenBuildCommand());
+ assertEquals(oldMakeCmd, defaultConfig.getBuildCommand());
+
+ ManagedBuildManager.saveBuildInfo(project, false);
+ }
+
+
+ /**
+ * The purpose of this test is to exercise the build path info interface.
+ * To get to that point, a new project/config has to be created in the test
+ * project and the default configuration changed.
+ *
+ * @throws CoreException
+ */
+ public void testScannerInfoInterface(){
+ // Open the test project
+ IProject project = null;
+ try {
+ project = createProject(projectName);
+ IProjectDescription description = project.getDescription();
+ // Make sure it has a managed nature
+ if (description != null) {
+ assertTrue(description.hasNature(ManagedCProjectNature.MNG_NATURE_ID));
+ }
+ } catch (CoreException e) {
+ fail("Failed to open project in 'testScannerInfoInterface': " + e.getLocalizedMessage());
+ }
+
+ //These are the expected path settings
+ final String[] expectedPaths = new String[5];
+
+ // This first path is a built-in, so it will not be manipulated by build manager
+ expectedPaths[0] = "/usr/gnu/include";
+ expectedPaths[1] = (new Path("/usr/include")).toOSString();
+ expectedPaths[2] = (new Path("/opt/gnome/include")).toOSString();
+ expectedPaths[3] = (new Path("C:\\home\\tester/include")).toOSString();
+ expectedPaths[4] = project.getLocation().append( "Sub Config\\\"..\\includes\"" ).toOSString();
+
+ // Create a new managed project based on the sub project type
+ IProjectType projType = ManagedBuildManager.getExtensionProjectType("test.sub");
+ assertNotNull(projType);
+
+ // Create the managed-project (.cdtbuild) for our project
+ IManagedProject newProject = null;
+ try {
+ newProject = ManagedBuildManager.createManagedProject(project, projType);
+ } catch (BuildException e) {
+ fail("Failed creating new project: " + e.getLocalizedMessage());
+ }
+ assertNotNull(newProject);
+ ManagedBuildManager.setNewProjectVersion(project);
+
+ // Copy over the configs
+ IConfiguration[] baseConfigs = projType.getConfigurations();
+ for (int i = 0; i < baseConfigs.length; ++i) {
+ newProject.createConfiguration(baseConfigs[i], baseConfigs[i].getId() + "." + i);
+ }
+
+ // Change the default configuration to the sub config
+ IConfiguration[] configs = newProject.getConfigurations();
+ assertEquals(4, configs.length);
+ IManagedBuildInfo buildInfo = ManagedBuildManager.getBuildInfo(project);
+ buildInfo.setDefaultConfiguration(newProject.getConfiguration(configs[0].getId()));
+
+ // Save, close, reopen
+ ManagedBuildManager.saveBuildInfo(project, true);
+ ManagedBuildManager.removeBuildInfo(project);
+ try {
+ project.close(null);
+ } catch (CoreException e) {
+ fail("Failed on project close: " + e.getLocalizedMessage());
+ }
+ try {
+ project.open(null);
+ } catch (CoreException e) {
+ fail("Failed on project open: " + e.getLocalizedMessage());
+ }
+ buildInfo = ManagedBuildManager.getBuildInfo(project);
+
+ // Use the plugin mechanism to discover the supplier of the path information
+ IExtensionPoint extensionPoint = Platform.getExtensionRegistry().getExtensionPoint(CCorePlugin.PLUGIN_ID + ".ScannerInfoProvider");
+ if (extensionPoint == null) {
+ fail("Failed to retrieve the extension point ScannerInfoProvider.");
+ }
+
+ // Find the first IScannerInfoProvider that supplies build info for the project
+ IScannerInfoProvider provider = CCorePlugin.getDefault().getScannerInfoProvider(project);
+ assertNotNull(provider);
+
+ // Now subscribe (note that the method will be called after a change
+ provider.subscribe(project, new IScannerInfoChangeListener () {
+ public void changeNotification(IResource project, IScannerInfo info) {
+ // Test the symbols: expect "BUILTIN" from the manifest, and "DEBUG" and "GNOME=ME"
+ // from the overidden settings
+ Map definedSymbols = info.getDefinedSymbols();
+ assertTrue(definedSymbols.containsKey("BUILTIN"));
+ assertTrue(definedSymbols.containsKey("DEBUG"));
+ assertTrue(definedSymbols.containsKey("GNOME"));
+ assertTrue(definedSymbols.containsValue("ME"));
+ assertEquals((String)definedSymbols.get("BUILTIN"), "");
+ assertEquals((String)definedSymbols.get("DEBUG"), "");
+ assertEquals((String)definedSymbols.get("GNOME"), "ME");
+ // Test the includes path
+ String[] actualPaths = info.getIncludePaths();
+ assertTrue(Arrays.equals(expectedPaths, actualPaths));
+ }
+ });
+
+ // Check the build information before we change it
+ IScannerInfo currentSettings = provider.getScannerInformation(project);
+
+ Map currentSymbols = currentSettings.getDefinedSymbols();
+ // It should simply contain the built-in
+ assertTrue(currentSymbols.containsKey("BUILTIN"));
+ assertEquals((String)currentSymbols.get("BUILTIN"), "");
+ String[] currentPaths = currentSettings.getIncludePaths();
+ assertTrue(Arrays.equals(expectedPaths, currentPaths));
+
+ // Add some defined symbols programmatically
+ String[] expectedSymbols = {"DEBUG", "GNOME = ME "};
+ IConfiguration defaultConfig = buildInfo.getDefaultConfiguration();
+ ITool[] tools = defaultConfig.getTools();
+ ITool subTool = null;
+ for (int i = 0; i < tools.length; i++) {
+ ITool tool = tools[i];
+ if("tool.sub".equalsIgnoreCase(tool.getSuperClass().getId())) {
+ subTool = tool;
+ break;
+ }
+ }
+ assertNotNull(subTool);
+ IOption symbolOpt = null;
+ IOption[] opts = subTool.getOptions();
+ for (int i = 0; i < opts.length; i++) {
+ IOption option = opts[i];
+ try {
+ if (option.getValueType() == IOption.PREPROCESSOR_SYMBOLS) {
+ symbolOpt = option;
+ break;
+ }
+ } catch (BuildException e) {
+ fail("Failed getting option value-type: " + e.getLocalizedMessage());
+ }
+ }
+ assertNotNull(symbolOpt);
+ IManagedBuildInfo info = ManagedBuildManager.getBuildInfo(project);
+ assertFalse(info.isDirty());
+ ManagedBuildManager.setOption(defaultConfig, subTool, symbolOpt, expectedSymbols);
+ assertTrue(info.isDirty());
+ info.setDirty(false);
+ assertFalse(info.isDirty());
+ }
+
+ /**
+ * 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 {
+ final String rootName = "Root Config";
+ final String overrideName = "Root Override Config";
+ final String completeOverrideName = "Complete Override Config";
+ final String toolCmd = "doIt";
+ final String newCmd = "never";
+
+ // Open the test project
+ IProject project = createProject(projectName);
+ IProjectDescription description = project.getDescription();
+ // Make sure it has a managed nature
+ if (description != null) {
+ assertTrue(description.hasNature(ManagedCProjectNature.MNG_NATURE_ID));
+ }
+
+ // Make sure there is a ManagedProject with 3 configs
+ IManagedBuildInfo info = ManagedBuildManager.getBuildInfo(project);
+ IManagedProject managedProj = info.getManagedProject();
+ IConfiguration[] definedConfigs = managedProj.getConfigurations();
+ assertEquals(3, definedConfigs.length);
+ IConfiguration baseConfig = definedConfigs[0];
+ assertEquals(definedConfigs[0].getName(), rootName);
+ assertEquals(definedConfigs[1].getName(), overrideName);
+ assertEquals(definedConfigs[2].getName(), completeOverrideName);
+
+ // Create a new configuration and test the rename function
+ IConfiguration newConfig = managedProj.createConfigurationClone(baseConfig, testConfigId);
+ assertEquals(4, managedProj.getConfigurations().length);
+ newConfig.setName(testConfigName);
+ assertEquals(newConfig.getId(), testConfigId);
+ assertEquals(newConfig.getName(), testConfigName);
+
+ // There is only one tool
+ ITool[] definedTools = newConfig.getTools();
+ assertEquals(1, definedTools.length);
+ ITool rootTool = definedTools[0];
+
+ // Test changing its command
+ assertEquals(rootTool.getToolCommand(), toolCmd);
+ newConfig.setToolCommand(rootTool, newCmd);
+ assertEquals(rootTool.getToolCommand(), newCmd);
+
+ // Override options in the new configuration
+ IOptionCategory topCategory = rootTool.getTopOptionCategory();
+ assertEquals("Root Tool", topCategory.getName());
+ Object[][] options = topCategory.getOptions(newConfig);
+ int i;
+ for (i=0; i<options.length; i++)
+ if (options[i][0] == null) break;
+ assertEquals(2, i);
+ ITool tool = (ITool)options[0][0];
+ IOption option = (IOption)options[0][1];
+ ManagedBuildManager.setOption(newConfig, tool, option, listVal);
+ option = (IOption)options[1][1];
+ ManagedBuildManager.setOption(newConfig, tool, option, boolVal);
+
+ IOptionCategory[] categories = topCategory.getChildCategories();
+ assertEquals(1, categories.length);
+ options = categories[0].getOptions(newConfig);
+ for (i=0; i<options.length; i++)
+ if (options[i][0] == null) break;
+ assertEquals(4, i);
+ tool = (ITool)options[0][0];
+ option = (IOption)options[0][1];
+ ManagedBuildManager.setOption(newConfig, tool, option, stringVal);
+ option = (IOption)options[1][1];
+ ManagedBuildManager.setOption(newConfig, tool, option, anotherStringVal);
+ option = (IOption)options[2][1];
+ ManagedBuildManager.setOption(newConfig, tool, option, enumVal);
+ option = (IOption)options[3][1];
+ ManagedBuildManager.setOption(newConfig, tool, option, "False");
+
+ // Save, close, reopen and test again
+ ManagedBuildManager.saveBuildInfo(project, false);
+ ManagedBuildManager.removeBuildInfo(project);
+ project.close(null);
+ project.open(null);
+
+ // Test the values in the new configuration
+ checkOptionReferences(project);
+
+ // Now delete the new configuration and test the managed project
+ info = ManagedBuildManager.getBuildInfo(project);
+ managedProj = info.getManagedProject();
+ definedConfigs = managedProj.getConfigurations();
+ assertEquals(4, definedConfigs.length);
+ managedProj.removeConfiguration(testConfigId);
+ definedConfigs = managedProj.getConfigurations();
+ assertEquals(3, definedConfigs.length);
+ assertEquals(definedConfigs[0].getName(), rootName);
+ assertEquals(definedConfigs[1].getName(), overrideName);
+ ManagedBuildManager.saveBuildInfo(project, false);
+ }
+
+ public void testConfigurationReset() {
+ // Open the test project
+ IProject project = null;
+ try {
+ project = createProject(projectName);
+ IProjectDescription description = project.getDescription();
+ // Make sure it has a managed nature
+ if (description != null) {
+ assertTrue(description.hasNature(ManagedCProjectNature.MNG_NATURE_ID));
+ }
+ } catch (CoreException e) {
+ fail("Failed to open project: " + e.getLocalizedMessage());
+ }
+
+ // Get the default configuration
+ IManagedBuildInfo info = ManagedBuildManager.getBuildInfo(project);
+ assertNotNull(info);
+ IManagedProject managedProj = info.getManagedProject();
+ assertNotNull(managedProj);
+ IConfiguration defaultConfig = info.getDefaultConfiguration();
+ assertNotNull(defaultConfig);
+
+ // See if it still contains the overridden values (see testProjectCreation())
+ try {
+ checkRootManagedProject(managedProj, "z");
+ } catch (BuildException e1) {
+ fail("Overridden root managed project check failed: " + e1.getLocalizedMessage());
+ }
+
+ // Reset the config and retest
+ ManagedBuildManager.resetConfiguration(project, defaultConfig);
+ ManagedBuildManager.saveBuildInfo(project, false);
+ try {
+ checkRootManagedProject(managedProj, "x");
+ } catch (BuildException e2) {
+ fail("Reset root managed project check failed: " + e2.getLocalizedMessage());
+ }
+ }
+
+ /**
+ * @throws CoreException
+ * @throws BuildException
+ */
+ public void testProjectCreation() throws BuildException {
+ // Create new project
+ IProject project = null;
+ try {
+ project = createProject(projectName);
+ // Now associate the builder with the project
+ addManagedBuildNature(project);
+ IProjectDescription description = project.getDescription();
+ // Make sure it has a managed nature
+ if (description != null) {
+ assertTrue(description.hasNature(ManagedCProjectNature.MNG_NATURE_ID));
+ }
+
+ } catch (CoreException e) {
+ fail("Test failed on project creation: " + e.getLocalizedMessage());
+ }
+
+ // Find the base project type definition
+ IProjectType projType = ManagedBuildManager.getExtensionProjectType("test.root");
+ assertNotNull(projType);
+
+ // Create the managed-project (.cdtbuild) for our project that builds a dummy executable
+ IManagedProject newProject = ManagedBuildManager.createManagedProject(project, projType);
+ assertEquals(newProject.getName(), projType.getName());
+ assertFalse(newProject.equals(projType));
+ ManagedBuildManager.setNewProjectVersion(project);
+
+ // Copy over the configs
+ IConfiguration defaultConfig = null;
+ IConfiguration[] configs = projType.getConfigurations();
+ for (int i = 0; i < configs.length; ++i) {
+ // Make the first configuration the default
+ if (i == 0) {
+ defaultConfig = newProject.createConfiguration(configs[i], projType.getId() + "." + i);
+ } else {
+ newProject.createConfiguration(configs[i], projType.getId() + "." + i);
+ }
+ }
+ ManagedBuildManager.setDefaultConfiguration(project, defaultConfig);
+
+ String buildArtifactName = projectName;
+ defaultConfig.setArtifactName(buildArtifactName);
+ defaultConfig.setArtifactExtension(newExt);
+
+ // Initialize the path entry container
+ IStatus initResult = ManagedBuildManager.initBuildInfoContainer(project);
+ if (initResult.getCode() != IStatus.OK) {
+ fail("Initializing build information failed for: " + project.getName() + " because: " + initResult.getMessage());
+ }
+
+ // Now test the results out
+ checkRootManagedProject(newProject, "x");
+
+ // Override the "String Option in Category" option value
+ configs = newProject.getConfigurations();
+ ITool[] tools = configs[0].getTools();
+ IOptionCategory topCategory = tools[0].getTopOptionCategory();
+ IOptionCategory[] categories = topCategory.getChildCategories();
+ Object[][] options = categories[0].getOptions(configs[0]);
+ ITool tool = (ITool)options[0][0];
+ IOption option = (IOption)options[0][1];
+ configs[0].setOption(tool, option, "z");
+ options = categories[0].getOptions((IConfiguration)null);
+ tool = (ITool)options[0][0];
+ option = (IOption)options[0][1];
+ assertEquals("x", option.getStringValue());
+ options = categories[0].getOptions(configs[0]);
+ tool = (ITool)options[0][0];
+ option = (IOption)options[0][1];
+ assertEquals("z", option.getStringValue());
+
+ // Save, close, reopen and test again
+ ManagedBuildManager.saveBuildInfo(project, true);
+ ManagedBuildManager.removeBuildInfo(project);
+ try {
+ project.close(null);
+ } catch (CoreException e) {
+ fail("Failed on project close: " + e.getLocalizedMessage());
+ }
+ try {
+ project.open(null);
+ } catch (CoreException e) {
+ fail("Failed on project open: " + e.getLocalizedMessage());
+ }
+
+ // Test that the default config was remembered
+ IManagedBuildInfo info = ManagedBuildManager.getBuildInfo(project);
+ assertEquals(defaultConfig.getId(), info.getDefaultConfiguration().getId());
+
+ // Check the rest of the default information
+ checkRootManagedProject(newProject, "z");
+
+ // Now test the information the makefile builder needs
+ checkBuildTestSettings(info);
+ ManagedBuildManager.removeBuildInfo(project);
+ }
+
+ /**
+ * Tests that bugzilla 44159 has been addressed. After a project was renamed, the
+ * build information mistakenly referred to the old project as its owner. This
+ * caused a number of searches on the information to fail. In this bug, it was the
+ * list of tools that could not be determined. In other cases, the information
+ * retrieval caused NPEs because the old owner no longer existed.
+ */
+ public void testProjectRename() {
+ // Open the test project
+ IProject project = null;
+ try {
+ project = createProject(projectName);
+ IProjectDescription description = project.getDescription();
+ // Make sure it has a managed nature
+ if (description != null) {
+ assertTrue(description.hasNature(ManagedCProjectNature.MNG_NATURE_ID));
+ }
+ } catch (CoreException e) {
+ fail("Failed to open project: " + e.getLocalizedMessage());
+ }
+
+ // Rename the project
+ IWorkspaceRoot workspaceRoot = ResourcesPlugin.getWorkspace().getRoot();
+ IResource newResource = workspaceRoot.findMember(projectRename);
+ if (newResource != null) {
+ try {
+ newResource.delete(IResource.KEEP_HISTORY, new NullProgressMonitor());
+ } catch (CoreException e) {
+ fail("Failed to delete old project " + projectRename + ": " + e.getLocalizedMessage());
+ }
+ }
+ IProjectDescription description = null;
+ try {
+ description = project.getDescription();
+ } catch (CoreException e) {
+ fail("Failed to find project descriptor for " + projectName + ": " + e.getLocalizedMessage());
+ }
+ description.setName(projectRename);
+ try {
+ project.move(description, IResource.FORCE | IResource.SHALLOW, new NullProgressMonitor());
+ } catch (CoreException e) {
+ fail("Failed to rename project: " + e.getLocalizedMessage());
+ }
+ try {
+ project = createProject(projectRename);
+ description = project.getDescription();
+ // Make sure it has a managed nature
+ if (description != null) {
+ assertTrue(description.hasNature(ManagedCProjectNature.MNG_NATURE_ID));
+ }
+ } catch (CoreException e) {
+ fail("Failed to open renamed project: " + e.getLocalizedMessage());
+ }
+
+ // By now the project should have 3 configs
+ IManagedBuildInfo info = ManagedBuildManager.getBuildInfo(project);
+ IManagedProject managedProj = info.getManagedProject();
+ IConfiguration[] definedConfigs = managedProj.getConfigurations();
+ assertEquals(4, definedConfigs.length);
+ IConfiguration baseConfig = definedConfigs[1];
+
+ // There is only one tool
+ ITool[] definedTools = baseConfig.getTools();
+ assertEquals(1, definedTools.length);
+ ITool rootTool = definedTools[0];
+
+ // Get the options (2) in top category and (4) in its child
+ IOptionCategory topCategory = rootTool.getTopOptionCategory();
+ assertEquals("Root Tool", topCategory.getName());
+ Object[][] options = topCategory.getOptions(baseConfig);
+ int i;
+ for (i=0; i<options.length; i++)
+ if (options[i][0] == null) break;
+ assertEquals(2, i);
+ IOptionCategory[] categories = topCategory.getChildCategories();
+ assertEquals(1, categories.length);
+ options = categories[0].getOptions(baseConfig);
+ for (i=0; i<options.length; i++)
+ if (options[i][0] == null) break;
+ assertEquals(4, i);
+
+ // Set the name back
+ newResource = workspaceRoot.findMember(projectName);
+ if (newResource != null) {
+ try {
+ newResource.delete(IResource.KEEP_HISTORY, new NullProgressMonitor());
+ } catch (CoreException e) {
+ fail("Failed to delete old project " + projectName + ": " + e.getLocalizedMessage());
+ }
+ }
+ try {
+ description = project.getDescription();
+ } catch (CoreException e) {
+ fail("Failed to find project descriptor for " + projectRename + ": " + e.getLocalizedMessage());
+ }
+ description.setName(projectName);
+ try {
+ project.move(description, IResource.FORCE | IResource.SHALLOW, new NullProgressMonitor());
+ } catch (CoreException e) {
+ fail("Failed to re-rename project: " + e.getLocalizedMessage());
+ }
+ try {
+ project = createProject(projectName);
+ description = project.getDescription();
+ // Make sure it has a managed nature
+ if (description != null) {
+ assertTrue(description.hasNature(ManagedCProjectNature.MNG_NATURE_ID));
+ }
+ } catch (CoreException e) {
+ fail("Failed to open re-renamed project: " + e.getLocalizedMessage());
+ }
+
+ // Do it all again
+ info = ManagedBuildManager.getBuildInfo(project);
+ managedProj = info.getManagedProject();
+ definedConfigs = managedProj.getConfigurations();
+ assertEquals(4, definedConfigs.length);
+ baseConfig = definedConfigs[1];
+ definedTools = baseConfig.getTools();
+ assertEquals(1, definedTools.length);
+ rootTool = definedTools[0];
+ topCategory = rootTool.getTopOptionCategory();
+ assertEquals("Root Tool", topCategory.getName());
+ options = topCategory.getOptions(baseConfig);
+ for (i=0; i<options.length; i++)
+ if (options[i][0] == null) break;
+ assertEquals(2, i);
+ categories = topCategory.getChildCategories();
+ assertEquals(1, categories.length);
+ options = categories[0].getOptions(baseConfig);
+ for (i=0; i<options.length; i++)
+ if (options[i][0] == null) break;
+ assertEquals(4, i);
+ }
+
+ private void addManagedBuildNature (IProject project) {
+ // Create the buildinformation object for the project
+ ManagedBuildManager.createBuildInfo(project);
+
+ // Add the managed build nature
+ try {
+ ManagedCProjectNature.addManagedNature(project, new NullProgressMonitor());
+ ManagedCProjectNature.addManagedBuilder(project, new NullProgressMonitor());
+ } catch (CoreException e) {
+ fail("Test failed on adding managed build nature or builder: " + e.getLocalizedMessage());
+ }
+
+ // Associate the project with the managed builder so the clients can get proper information
+ ICDescriptor desc = null;
+ try {
+ desc = CCorePlugin.getDefault().getCProjectDescription(project, true);
+ desc.remove(CCorePlugin.BUILD_SCANNER_INFO_UNIQ_ID);
+ desc.create(CCorePlugin.BUILD_SCANNER_INFO_UNIQ_ID, ManagedBuildManager.INTERFACE_IDENTITY);
+ } catch (CoreException e) {
+ fail("Test failed on adding managed builder as scanner info provider: " + e.getLocalizedMessage());
+ }
+ try {
+ desc.saveProjectData();
+ } catch (CoreException e) {
+ fail("Test failed on saving the ICDescriptor data: " + e.getLocalizedMessage()); }
+ }
+
+ /**
+ * Tests the tool settings through the interface the makefile generator
+ * uses.
+ *
+ * @param project
+ */
+ private void checkBuildTestSettings(IManagedBuildInfo info) {
+ String ext1 = "foo";
+ String ext2 = "bar";
+ String badExt = "cpp";
+ String expectedOutput = "toor";
+ String expectedCmd = "doIt";
+
+ assertNotNull(info);
+ assertEquals(info.getBuildArtifactName(), projectName);
+
+ // There should be a default configuration defined for the project
+ IManagedProject managedProj = info.getManagedProject();
+ assertNotNull(managedProj);
+ IConfiguration buildConfig = info.getDefaultConfiguration();
+ assertNotNull(buildConfig);
+
+ // 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.getToolForConfiguration(ext1));
+ assertNull(info.getToolForConfiguration(ext2));
+
+ // There is no tool that builds toor
+ assertNull(info.getToolForSource(expectedOutput));
+ // but there is one that produces it
+ assertEquals(info.getToolForConfiguration(expectedOutput), expectedCmd);
+
+ // Now check the build flags
+ assertEquals(info.getFlagsForSource(ext1), "-La -Lb z -e1 -nob");
+ assertEquals(info.getFlagsForSource(ext1), info.getFlagsForSource(ext2));
+
+ }
+
+ /**
+ * 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 configs
+ IManagedBuildInfo info = ManagedBuildManager.getBuildInfo(project);
+ IManagedProject managedProj = info.getManagedProject();
+ IConfiguration[] definedConfigs = managedProj.getConfigurations();
+ assertEquals(4, definedConfigs.length);
+ IConfiguration newConfig = managedProj.getConfiguration(testConfigId);
+ assertNotNull(newConfig);
+
+ // Now get the tool options and make sure the values are correct
+ ITool[] definedTools = newConfig.getTools();
+ assertEquals(1, definedTools.length);
+ ITool rootTool = definedTools[0];
+
+ // Check that the options in the new config contain overridden values
+ IOption[] rootOptions = rootTool.getOptions();
+ assertEquals(6, rootOptions.length);
+ // First is the new list
+ assertEquals("List Option in Top", rootOptions[0].getName());
+ assertEquals(IOption.STRING_LIST, rootOptions[0].getValueType());
+ String[] list = rootOptions[0].getStringListValue();
+ assertEquals(3, list.length);
+ assertTrue(Arrays.equals(listVal, list));
+ assertEquals(rootOptions[0].getCommand(), "-L");
+ // Next option is a boolean in top
+ assertEquals("Boolean Option in Top", rootOptions[1].getName());
+ assertEquals(IOption.BOOLEAN, rootOptions[1].getValueType());
+ assertEquals(boolVal, rootOptions[1].getBooleanValue());
+ assertEquals("-b", rootOptions[1].getCommand());
+ // Next option is a string in category
+ assertEquals("String Option in Category", rootOptions[2].getName());
+ assertEquals(IOption.STRING, rootOptions[2].getValueType());
+ assertEquals(stringVal, rootOptions[2].getStringValue());
+ // Next option is a another string in category
+ assertEquals("Another String Option in Category", rootOptions[3].getName());
+ assertEquals(IOption.STRING, rootOptions[3].getValueType());
+ assertEquals(anotherStringVal, rootOptions[3].getStringValue());
+ assertEquals("-str", rootOptions[3].getCommand());
+ // Next option is an enumerated in category
+ assertEquals("Enumerated Option in Category", rootOptions[4].getName());
+ assertEquals(IOption.ENUMERATED, rootOptions[4].getValueType());
+ String selEnum = rootOptions[4].getSelectedEnum();
+ assertEquals(enumVal, selEnum);
+ String[] enums = rootOptions[4].getApplicableValues();
+ assertEquals(2, enums.length);
+ assertEquals("Default Enum", enums[0]);
+ assertEquals("Another Enum", enums[1]);
+ assertEquals("-e1", rootOptions[4].getEnumCommand(enums[0]));
+ assertEquals("-e2", rootOptions[4].getEnumCommand(enums[1]));
+ assertEquals("-e2", rootOptions[4].getEnumCommand(selEnum));
+ // Final option is a boolean in Category
+ assertEquals("Boolean Option in Category", rootOptions[5].getName());
+ assertEquals(IOption.BOOLEAN, rootOptions[5].getValueType());
+ assertEquals(false, rootOptions[5].getBooleanValue());
+ assertEquals("-nob", rootOptions[5].getCommandFalse());
+ }
+
+ /*
+ * Do a full sanity check on the root project type.
+ */
+ private void checkRootProjectType(IProjectType type) throws BuildException {
+ // Project stuff
+ String expectedCleanCmd = "del /myworld";
+ String expectedParserId = "org.eclipse.cdt.core.PE";
+ String[] expectedOSList = {"win32"};
+ String[] expectedArchList = {"all"};
+ assertTrue(type.isTestProjectType());
+ IConfiguration[] configs = type.getConfigurations();
+ if (configs[0].getArtifactName().equals("ManagedBuildTest")) {
+ assertEquals(configs[0].getArtifactExtension(), newExt);
+ } else {
+ assertEquals(configs[0].getArtifactExtension(), rootExt);
+ }
+ assertEquals(expectedCleanCmd, configs[0].getCleanCommand());
+ assertEquals("make", configs[0].getBuildCommand());
+ IToolChain toolChain = configs[0].getToolChain();
+ ITargetPlatform targetPlatform = toolChain.getTargetPlatform();
+ assertEquals(expectedParserId, targetPlatform.getBinaryParserId());
+ assertTrue(Arrays.equals(expectedOSList, toolChain.getOSList()));
+ assertTrue(Arrays.equals(expectedArchList, toolChain.getArchList()));
+ // This configuration defines no errors parsers.
+ assertNull(configs[0].getErrorParserIds());
+ assertTrue(Arrays.equals(configs[0].getErrorParserList(), CCorePlugin.getDefault().getAllErrorParsersIDs()));
+
+ // Tools
+ ITool[] tools = toolChain.getTools();
+ // Root Tool
+ ITool rootTool = tools[0];
+ assertEquals("Root Tool", rootTool.getName());
+ // 6 Options are defined in the root tool
+ IOption[] options = rootTool.getOptions();
+ assertEquals(6, options.length);
+ // First option is a 3-element list with 1 built-in
+ assertEquals("List Option in Top", options[0].getName());
+ assertEquals(IOption.STRING_LIST, options[0].getValueType());
+ String[] valueList = options[0].getStringListValue();
+ assertEquals(2, valueList.length);
+ assertEquals("a", valueList[0]);
+ assertEquals("b", valueList[1]);
+ String[] builtInList = options[0].getBuiltIns();
+ assertEquals(1, builtInList.length);
+ assertEquals("c", builtInList[0]);
+ assertEquals(options[0].getCommand(), "-L");
+ // Next option is a boolean in top
+ assertEquals("Boolean Option in Top", options[1].getName());
+ assertEquals(IOption.BOOLEAN, options[1].getValueType());
+ assertEquals(false, options[1].getBooleanValue());
+ assertEquals("-b", options[1].getCommand());
+ // Next option is a string category
+ assertEquals("String Option in Category", options[2].getName());
+ assertEquals(IOption.STRING, options[2].getValueType());
+ assertEquals("x", options[2].getStringValue());
+ // Next option is another string category
+ assertEquals("Another String Option in Category", options[3].getName());
+ assertEquals(IOption.STRING, options[3].getValueType());
+ assertEquals("", options[3].getStringValue());
+ assertEquals("-str", options[3].getCommand());
+ // Next option is an enumerated
+ assertEquals("Enumerated Option in Category", options[4].getName());
+ assertEquals(IOption.ENUMERATED, options[4].getValueType());
+ // Post-2.0 enums store the ID, not the string value
+ assertEquals("default.enum.option", options[4].getSelectedEnum());
+ assertEquals("-e1", options[4].getEnumCommand("default.enum.option"));
+ // Need this methof to populate the UI selection widget
+ valueList = options[4].getApplicableValues();
+ assertEquals(2, valueList.length);
+ assertEquals("Default Enum", valueList[0]);
+ assertEquals("Another Enum", valueList[1]);
+ // Test compatability with 1.2 scheme of getting the command from the name
+ assertEquals("-e1", options[4].getEnumCommand(valueList[0]));
+ assertEquals("-e2", options[4].getEnumCommand(valueList[1]));
+ // Final option is another boolean
+ assertEquals("Boolean Option in Category", options[5].getName());
+ assertEquals(IOption.BOOLEAN, options[5].getValueType());
+ assertEquals(false, options[5].getBooleanValue());
+ assertEquals("", options[5].getCommand());
+ assertEquals("-nob", options[5].getCommandFalse());
+
+ // Option Categories
+ IOptionCategory topCategory = rootTool.getTopOptionCategory();
+ assertEquals("Root Tool", topCategory.getName());
+ Object[][] catoptions = topCategory.getOptions(configs[0]);
+ int i;
+ for (i=0; i<catoptions.length; i++)
+ if (catoptions[i][0] == null) break;
+ assertEquals(2, i);
+ assertEquals("List Option in Top", ((IOption)catoptions[0][1]).getName());
+ assertEquals("Boolean Option in Top", ((IOption)catoptions[1][1]).getName());
+ IOptionCategory[] categories = topCategory.getChildCategories();
+ assertEquals(1, categories.length);
+ assertEquals("Category", categories[0].getName());
+ catoptions = categories[0].getOptions(configs[0]);
+ for (i=0; i<catoptions.length; i++)
+ if (catoptions[i][0] == null) break;
+ assertEquals(4, i);
+ assertEquals("String Option in Category", ((IOption)catoptions[0][1]).getName());
+ assertEquals("Another String Option in Category", ((IOption)catoptions[1][1]).getName());
+ assertEquals("Enumerated Option in Category", ((IOption)catoptions[2][1]).getName());
+ assertEquals("Boolean Option in Category", ((IOption)catoptions[3][1]).getName());
+
+ // There should be 3 defined configs
+ configs = type.getConfigurations();
+ assertEquals(3, configs.length);
+
+ // Root Config
+ IConfiguration rootConfig = configs[0];
+ assertEquals("Root Config", rootConfig.getName());
+
+ // Tool elements
+ tools = rootConfig.getTools();
+ assertEquals(1, tools.length);
+ assertEquals("Root Tool", tools[0].getName());
+ assertEquals("-r", tools[0].getOutputFlag());
+ assertTrue(tools[0].buildsFileType("foo"));
+ assertTrue(tools[0].buildsFileType("bar"));
+ assertTrue(tools[0].producesFileType("toor"));
+ assertEquals("doIt", tools[0].getToolCommand());
+ assertEquals("", tools[0].getOutputPrefix());
+ // The root tool defines one valid header file extension
+ assertTrue(rootTool.isHeaderFile("baz"));
+ assertTrue(tools[0].isHeaderFile("baz"));
+ assertEquals(ITool.FILTER_C, rootTool.getNatureFilter());
+
+ // Partially Overriden Configuration
+ assertEquals("Root Override Config", configs[1].getName());
+ tools = configs[1].getTools();
+ assertEquals(1, tools.length);
+ assertEquals("Root Tool", tools[0].getName());
+ topCategory = tools[0].getTopOptionCategory();
+ catoptions = topCategory.getOptions(configs[1]);
+ for (i=0; i<catoptions.length; i++)
+ if (catoptions[i][0] == null) break;
+ assertEquals(2, i);
+ assertEquals("List Option in Top", ((IOption)catoptions[0][1]).getName());
+ valueList = ((IOption)catoptions[0][1]).getStringListValue();
+ assertEquals("a", valueList[0]);
+ assertEquals("b", valueList[1]);
+ assertEquals("Boolean Option in Top", ((IOption)catoptions[1][1]).getName());
+ assertEquals(true, ((IOption)catoptions[1][1]).getBooleanValue());
+ assertEquals("-b", ((IOption)catoptions[1][1]).getCommand());
+ categories = topCategory.getChildCategories();
+ catoptions = categories[0].getOptions(configs[1]);
+ for (i=0; i<catoptions.length; i++)
+ if (catoptions[i][0] == null) break;
+ assertEquals(4, i);
+ assertEquals("String Option in Category", ((IOption)catoptions[0][1]).getName());
+ assertEquals("y", ((IOption)catoptions[0][1]).getStringValue());
+ assertEquals("Another String Option in Category", ((IOption)catoptions[1][1]).getName());
+ assertEquals("", ((IOption)catoptions[1][1]).getStringValue());
+ assertEquals("Enumerated Option in Category", ((IOption)catoptions[2][1]).getName());
+ valueList = ((IOption)catoptions[2][1]).getApplicableValues();
+ assertEquals(2, valueList.length);
+ assertEquals("Default Enum", valueList[0]);
+ assertEquals("Another Enum", valueList[1]);
+ assertEquals("-e1", ((IOption)catoptions[2][1]).getEnumCommand(valueList[0]));
+ assertEquals("-e2", ((IOption)catoptions[2][1]).getEnumCommand(valueList[1]));
+ assertEquals(1, tools.length);
+ assertEquals("Boolean Option in Category", ((IOption)catoptions[3][1]).getName());
+ assertEquals(false, ((IOption)catoptions[3][1]).getBooleanValue());
+ assertEquals("", ((IOption)catoptions[3][1]).getCommand());
+ assertEquals("-nob", ((IOption)catoptions[3][1]).getCommandFalse());
+ assertEquals(1, tools.length);
+ ITool tool = tools[0];
+ assertNotNull(tool);
+ assertEquals("Root Tool", tool.getName());
+ assertEquals("-r", tool.getOutputFlag());
+ assertTrue(tool.buildsFileType("foo"));
+ assertTrue(tool.buildsFileType("bar"));
+ assertTrue(tool.producesFileType("toor"));
+ assertTrue(tool.isHeaderFile("baz"));
+ assertEquals("doIt", tool.getToolCommand());
+ assertEquals("-La -Lb -b y -e1 -nob", tool.getToolFlags());
+
+ // Completely Overridden configuration
+ assertEquals("Complete Override Config", configs[2].getName());
+ tools = configs[2].getTools();
+ assertEquals(1, tools.length);
+ assertEquals("Root Tool", tools[0].getName());
+ topCategory = tools[0].getTopOptionCategory();
+ catoptions = topCategory.getOptions(configs[2]);
+ for (i=0; i<catoptions.length; i++)
+ if (catoptions[i][0] == null) break;
+ assertEquals(2, i);
+ // Check that there's an string list with totally new values
+ assertEquals("List Option in Top", ((IOption)catoptions[0][1]).getName());
+ assertEquals(IOption.STRING_LIST, ((IOption)catoptions[0][1]).getValueType());
+ valueList = ((IOption)catoptions[0][1]).getStringListValue();
+ assertTrue(valueList.length == 3);
+ assertEquals("d", valueList[0]);
+ assertEquals("e", valueList[1]);
+ assertEquals("f", valueList[2]);
+ assertEquals("-L", ((IOption)catoptions[0][1]).getCommand());
+ // and a true boolean (commands should not have changed)
+ assertEquals("Boolean Option in Top", ((IOption)catoptions[1][1]).getName());
+ assertEquals(IOption.BOOLEAN, ((IOption)catoptions[1][1]).getValueType());
+ assertEquals(true, ((IOption)catoptions[1][1]).getBooleanValue());
+ assertEquals("-b", ((IOption)catoptions[1][1]).getCommand());
+ // Check that there's an overridden enumeration and string
+ categories = topCategory.getChildCategories();
+ catoptions = categories[0].getOptions(configs[2]);
+ for (i=0; i<catoptions.length; i++)
+ if (catoptions[i][0] == null) break;
+ assertEquals(4, i);
+ assertEquals("String Option in Category", ((IOption)catoptions[0][1]).getName());
+ assertEquals(IOption.STRING, ((IOption)catoptions[0][1]).getValueType());
+ assertEquals("overridden", ((IOption)catoptions[0][1]).getStringValue());
+ assertEquals("Another String Option in Category", ((IOption)catoptions[1][1]).getName());
+ assertEquals(IOption.STRING, ((IOption)catoptions[1][1]).getValueType());
+ assertEquals("alsooverridden", ((IOption)catoptions[1][1]).getStringValue());
+ assertEquals("Enumerated Option in Category", ((IOption)catoptions[2][1]).getName());
+ assertEquals(IOption.ENUMERATED, ((IOption)catoptions[2][1]).getValueType());
+ assertEquals("another.enum.option", ((IOption)catoptions[2][1]).getSelectedEnum());
+ assertEquals("Boolean Option in Category", ((IOption)catoptions[3][1]).getName());
+ assertEquals(IOption.BOOLEAN, ((IOption)catoptions[3][1]).getValueType());
+ assertEquals(true, ((IOption)catoptions[3][1]).getBooleanValue());
+ tool = tools[0];
+ assertEquals("-Ld -Le -Lf -b overridden -stralsooverridden -e2", tool.getToolFlags());
+
+ // Make sure that the build manager returns the default makefile generator (not null)
+ assertNotNull(ManagedBuildManager.getBuildfileGenerator(configs[0]));
+ }
+
+ /*
+ * Do a full sanity check on the root managed project.
+ */
+ private void checkRootManagedProject(IManagedProject managedProj, String testValue) throws BuildException {
+ String expectedCleanCmd = "del /myworld";
+ String expectedParserId = "org.eclipse.cdt.core.PE";
+ String[] expectedOSList = {"win32"};
+ String[] expectedArchList = {"all"};
+ assertTrue(managedProj.getProjectType().isTestProjectType());
+ IConfiguration[] configs = managedProj.getConfigurations();
+ if (configs[0].getArtifactName().equals("ManagedBuildTest")) {
+ assertEquals(configs[0].getArtifactExtension(), newExt);
+ } else {
+ assertEquals(configs[0].getArtifactExtension(), rootExt);
+ }
+ assertEquals(expectedCleanCmd, configs[0].getCleanCommand());
+ assertEquals("make", configs[0].getBuildCommand());
+ IToolChain toolChain = configs[0].getToolChain();
+ ITargetPlatform targetPlatform = toolChain.getTargetPlatform();
+ assertEquals(expectedParserId, targetPlatform.getBinaryParserId());
+ assertTrue(Arrays.equals(expectedOSList, toolChain.getOSList()));
+ assertTrue(Arrays.equals(expectedArchList, toolChain.getArchList()));
+ // This configuration defines no errors parsers.
+ assertNull(configs[0].getErrorParserIds());
+ assertTrue(Arrays.equals(configs[0].getErrorParserList(), CCorePlugin.getDefault().getAllErrorParsersIDs()));
+
+ // Tools
+ ITool[] tools = configs[0].getTools();
+ // Root Tool
+ ITool rootTool = tools[0];
+ assertEquals("Root Tool", rootTool.getName());
+ // 6 Options are defined in the root tool
+ IOption[] options = rootTool.getOptions();
+ assertEquals(6, options.length);
+ // First option is a 3-element list with 1 built-in
+ assertEquals("List Option in Top", options[0].getName());
+ assertEquals(IOption.STRING_LIST, options[0].getValueType());
+ String[] valueList = options[0].getStringListValue();
+ assertEquals(2, valueList.length);
+ assertEquals("a", valueList[0]);
+ assertEquals("b", valueList[1]);
+ String[] builtInList = options[0].getBuiltIns();
+ assertEquals(1, builtInList.length);
+ assertEquals("c", builtInList[0]);
+ assertEquals(options[0].getCommand(), "-L");
+ // Next option is a boolean in top
+ assertEquals("Boolean Option in Top", options[1].getName());
+ assertEquals(IOption.BOOLEAN, options[1].getValueType());
+ assertEquals(false, options[1].getBooleanValue());
+ assertEquals("-b", options[1].getCommand());
+ // Next option is a string category
+ assertEquals("String Option in Category", options[2].getName());
+ assertEquals(IOption.STRING, options[2].getValueType());
+ assertEquals(testValue, options[2].getStringValue());
+ // Next option is another string category
+ assertEquals("Another String Option in Category", options[3].getName());
+ assertEquals(IOption.STRING, options[3].getValueType());
+ assertEquals("", options[3].getStringValue());
+ assertEquals("-str", options[3].getCommand());
+ // Next option is an enumerated
+ assertEquals("Enumerated Option in Category", options[4].getName());
+ assertEquals(IOption.ENUMERATED, options[4].getValueType());
+ // Post-2.0 enums store the ID, not the string value
+ assertEquals("default.enum.option", options[4].getSelectedEnum());
+ assertEquals("-e1", options[4].getEnumCommand("default.enum.option"));
+ // Need this methof to populate the UI selection widget
+ valueList = options[4].getApplicableValues();
+ assertEquals(2, valueList.length);
+ assertEquals("Default Enum", valueList[0]);
+ assertEquals("Another Enum", valueList[1]);
+ // Test compatability with 1.2 scheme of getting the command from the name
+ assertEquals("-e1", options[4].getEnumCommand(valueList[0]));
+ assertEquals("-e2", options[4].getEnumCommand(valueList[1]));
+ // Final option is another boolean
+ assertEquals("Boolean Option in Category", options[5].getName());
+ assertEquals(IOption.BOOLEAN, options[5].getValueType());
+ assertEquals(false, options[5].getBooleanValue());
+ assertEquals("", options[5].getCommand());
+ assertEquals("-nob", options[5].getCommandFalse());
+
+ // Option Categories
+ IOptionCategory topCategory = rootTool.getTopOptionCategory();
+ assertEquals("Root Tool", topCategory.getName());
+ Object[][] catoptions = topCategory.getOptions(configs[0]);
+ int i;
+ for (i=0; i<catoptions.length; i++)
+ if (catoptions[i][0] == null) break;
+ assertEquals(2, i);
+ IOption catOption = (IOption)catoptions[0][1];
+ assertEquals("List Option in Top", catOption.getName());
+ catOption = (IOption)catoptions[1][1];
+ assertEquals("Boolean Option in Top", catOption.getName());
+ IOptionCategory[] categories = topCategory.getChildCategories();
+ assertEquals(1, categories.length);
+ assertEquals("Category", categories[0].getName());
+ catoptions = categories[0].getOptions(configs[0]);
+ for (i=0; i<catoptions.length; i++)
+ if (catoptions[i][0] == null) break;
+ assertEquals(4, i);
+ catOption = (IOption)catoptions[0][1];
+ assertEquals("String Option in Category", catOption.getName());
+ catOption = (IOption)catoptions[1][1];
+ assertEquals("Another String Option in Category", catOption.getName());
+ catOption = (IOption)catoptions[2][1];
+ assertEquals("Enumerated Option in Category", catOption.getName());
+ catOption = (IOption)catoptions[3][1];
+ assertEquals("Boolean Option in Category", catOption.getName());
+
+ // There should be 3 defined configs
+ assertEquals(3, configs.length);
+
+ // Root Config
+ IConfiguration rootConfig = configs[0];
+ assertEquals("Root Config", rootConfig.getName());
+
+ // Tool elements
+ tools = rootConfig.getTools();
+ assertEquals(1, tools.length);
+ assertEquals("Root Tool", tools[0].getName());
+ assertEquals("-r", tools[0].getOutputFlag());
+ assertTrue(tools[0].buildsFileType("foo"));
+ assertTrue(tools[0].buildsFileType("bar"));
+ assertTrue(tools[0].producesFileType("toor"));
+ assertEquals("doIt", tools[0].getToolCommand());
+ assertEquals("", tools[0].getOutputPrefix());
+ // The root tool defines one valid header file extension
+ assertTrue(rootTool.isHeaderFile("baz"));
+ assertTrue(tools[0].isHeaderFile("baz"));
+ assertEquals(ITool.FILTER_C, rootTool.getNatureFilter());
+
+ // Partially Overriden Configuration
+ assertEquals("Root Override Config", configs[1].getName());
+ tools = configs[1].getTools();
+ assertEquals(1, tools.length);
+ assertEquals("Root Tool", tools[0].getName());
+ topCategory = tools[0].getTopOptionCategory();
+ catoptions = topCategory.getOptions(configs[1]);
+ for (i=0; i<catoptions.length; i++)
+ if (catoptions[i][0] == null) break;
+ assertEquals(2, i);
+ catOption = (IOption)catoptions[0][1];
+ assertEquals("List Option in Top", catOption.getName());
+ valueList = catOption.getStringListValue();
+ assertEquals("a", valueList[0]);
+ assertEquals("b", valueList[1]);
+ catOption = (IOption)catoptions[1][1];
+ assertEquals("Boolean Option in Top", catOption.getName());
+ assertEquals(true, catOption.getBooleanValue());
+ assertEquals("-b", catOption.getCommand());
+ categories = topCategory.getChildCategories();
+ catoptions = categories[0].getOptions(configs[1]);
+ for (i=0; i<catoptions.length; i++)
+ if (catoptions[i][0] == null) break;
+ assertEquals(4, i);
+ catOption = (IOption)catoptions[0][1];
+ assertEquals("String Option in Category", catOption.getName());
+ assertEquals("y", catOption.getStringValue());
+ catOption = (IOption)catoptions[1][1];
+ assertEquals("Another String Option in Category", catOption.getName());
+ assertEquals("", catOption.getStringValue());
+ catOption = (IOption)catoptions[2][1];
+ assertEquals("Enumerated Option in Category", catOption.getName());
+ valueList = catOption.getApplicableValues();
+ assertEquals(2, valueList.length);
+ assertEquals("Default Enum", valueList[0]);
+ assertEquals("Another Enum", valueList[1]);
+ catOption = (IOption)catoptions[2][1];
+ assertEquals("-e1", catOption.getEnumCommand(valueList[0]));
+ assertEquals("-e2", catOption.getEnumCommand(valueList[1]));
+ assertEquals(1, tools.length);
+ catOption = (IOption)catoptions[3][1];
+ assertEquals("Boolean Option in Category", catOption.getName());
+ assertEquals(false, catOption.getBooleanValue());
+ assertEquals("", catOption.getCommand());
+ assertEquals("-nob", catOption.getCommandFalse());
+ assertEquals(1, tools.length);
+ ITool tool = tools[0];
+ assertNotNull(tool);
+ assertEquals("Root Tool", tool.getName());
+ assertEquals("-r", tool.getOutputFlag());
+ assertTrue(tool.buildsFileType("foo"));
+ assertTrue(tool.buildsFileType("bar"));
+ assertTrue(tool.producesFileType("toor"));
+ assertTrue(tool.isHeaderFile("baz"));
+ assertEquals("doIt", tool.getToolCommand());
+ assertEquals("-La -Lb -b y -e1 -nob", tool.getToolFlags());
+
+ // Completely Overridden configuration
+ assertEquals("Complete Override Config", configs[2].getName());
+ tools = configs[2].getTools();
+ assertEquals(1, tools.length);
+ assertEquals("Root Tool", tools[0].getName());
+ topCategory = tools[0].getTopOptionCategory();
+ catoptions = topCategory.getOptions(configs[2]);
+ for (i=0; i<catoptions.length; i++)
+ if (catoptions[i][0] == null) break;
+ assertEquals(2, i);
+ // Check that there's an string list with totally new values
+ catOption = (IOption)catoptions[0][1];
+ assertEquals("List Option in Top", catOption.getName());
+ assertEquals(IOption.STRING_LIST, catOption.getValueType());
+ valueList = catOption.getStringListValue();
+ assertTrue(valueList.length == 3);
+ assertEquals("d", valueList[0]);
+ assertEquals("e", valueList[1]);
+ assertEquals("f", valueList[2]);
+ assertEquals("-L", catOption.getCommand());
+ // and a true boolean (commands should not have changed)
+ catOption = (IOption)catoptions[1][1];
+ assertEquals("Boolean Option in Top", catOption.getName());
+ assertEquals(IOption.BOOLEAN, catOption.getValueType());
+ assertEquals(true, catOption.getBooleanValue());
+ assertEquals("-b", catOption.getCommand());
+ // Check that there's an overridden enumeration and string
+ categories = topCategory.getChildCategories();
+ catoptions = categories[0].getOptions(configs[2]);
+ for (i=0; i<catoptions.length; i++)
+ if (catoptions[i][0] == null) break;
+ assertEquals(4, i);
+ catOption = (IOption)catoptions[0][1];
+ assertEquals("String Option in Category", catOption.getName());
+ assertEquals(IOption.STRING, catOption.getValueType());
+ assertEquals("overridden", catOption.getStringValue());
+ catOption = (IOption)catoptions[1][1];
+ assertEquals("Another String Option in Category", catOption.getName());
+ assertEquals(IOption.STRING, catOption.getValueType());
+ assertEquals("alsooverridden", catOption.getStringValue());
+ catOption = (IOption)catoptions[2][1];
+ assertEquals("Enumerated Option in Category", catOption.getName());
+ assertEquals(IOption.ENUMERATED, catOption.getValueType());
+ assertEquals("another.enum.option", catOption.getSelectedEnum());
+ catOption = (IOption)catoptions[3][1];
+ assertEquals("Boolean Option in Category", catOption.getName());
+ assertEquals(IOption.BOOLEAN, catOption.getValueType());
+ assertEquals(true, catOption.getBooleanValue());
+ tool = tools[0];
+ assertEquals("-Ld -Le -Lf -b overridden -stralsooverridden -e2", tool.getToolFlags());
+
+ // Make sure that the build manager returns the default makefile generator (not null)
+ assertNotNull(ManagedBuildManager.getBuildfileGenerator(configs[0]));
+ }
+
+ /*
+ * The Sub Sub project type has a reference to a tool that is defined
+ * independently from the project type itself. This is a common pattern
+ * for tools that are shared between many project types.
+ *
+ * The tool itself is defined as having two option categories, with
+ * one option in each category. To test that the reference is properly
+ * inheritted, the project type overrides the default value of the boolean
+ * option.
+ *
+ * The test confirms that the basic settings are inheritted through the
+ * reference, and that the overridden value is used instead of the
+ * default. It also tests that the command can be overidden through a
+ * tool reference.
+ *
+ * Finally, the string option in the configuration is overridden and the
+ * test confirms that it contains both the overridden boolean that the
+ * project type provides, and the overridden string that it provides.
+ *
+ * @param testSubSub
+ */
+ private void checkSubSubProjectType(IProjectType projType) {
+ final String indyToolName = "Target Independent Tool";
+ final String indyToolCommand = "RC.EXE";
+ final String indyToolInputExt = "rc";
+ final String indyToolOutputExt = "free";
+ final String indyToolOutFlag = "/fo";
+ final String indyToolHeader = "h";
+ final String indyToolHeaderNot = "j";
+ final String indyCatOne = "Free";
+ final String indyCatTwo = "Chained";
+ final String freeOptName = "String in Free";
+ final String chainedOptName = "Boolean in Chained";
+ final String freeOptValue = "Live free or die";
+ final String newCmd = "Let the Wookie win";
+ final String stringOverride = "The future language of slaves";
+
+ IConfiguration[] configs = projType.getConfigurations();
+ // Check the inherited clean command
+ assertEquals("rm -yourworld", configs[0].getCleanCommand());
+ // Check that the make command is overridden from parent
+ assertEquals("nmake", configs[0].getBuildCommand());
+ // Make sure we get the proper binary parser
+ IToolChain toolChain = configs[0].getToolChain();
+ ITargetPlatform targetPlatform = toolChain.getTargetPlatform();
+ assertEquals("org.eclipse.cdt.core.ELF", targetPlatform.getBinaryParserId());
+ // Make sure the os list is inherited
+ String[] expectedOSList = {"win32","linux","solaris"};
+ assertTrue(Arrays.equals(expectedOSList, toolChain.getOSList()));
+ // Make sure the arch list is inherited
+ String[] expectedArchList = {"x86", "ppc"};
+ assertTrue(Arrays.equals(expectedArchList, toolChain.getArchList()));
+
+ // Get the 5 configurations (3 from test, 1 from test sub and 1 from this)
+ assertEquals(5, configs.length);
+
+ // Check the tools. We should have 3 (1 from each parent and the one referenced).
+ ITool[] tools = configs[0].getTools();
+ assertEquals(3, tools.length);
+ ITool toolRef = tools[0];
+
+ // Make sure we get all the tool settings
+ assertEquals(toolRef.getName(), indyToolName);
+ assertEquals(toolRef.getToolCommand(), indyToolCommand);
+ assertTrue(toolRef.buildsFileType(indyToolInputExt));
+ assertEquals(toolRef.getOutputExtension(indyToolInputExt), indyToolOutputExt);
+ assertEquals(toolRef.getOutputFlag(), indyToolOutFlag);
+ assertTrue(toolRef.isHeaderFile(indyToolHeader));
+ assertFalse(toolRef.isHeaderFile(indyToolHeaderNot));
+ assertEquals(toolRef.getNatureFilter(), ITool.FILTER_BOTH);
+ // Check out the referenced tool and make sure we get all option categories
+ IOptionCategory topCategory = toolRef.getTopOptionCategory();
+ IOptionCategory[] categories = topCategory.getChildCategories();
+ assertEquals(1, categories.length);
+ assertEquals(categories[0].getName(), indyCatOne);
+ IOptionCategory[] subCategories = categories[0].getChildCategories();
+ // Is the chained category a subcategory
+ assertEquals(1, subCategories.length);
+ assertEquals(subCategories[0].getName(), indyCatTwo);
+ // Make sure the option in the top category is correct
+ Object[][] optsInCat = categories[0].getOptions(configs[0]);
+ int i;
+ for (i=0; i<optsInCat.length; i++)
+ if (optsInCat[i][0] == null) break;
+ assertEquals(1, i);
+ IOption optCat = (IOption)optsInCat[0][1];
+ assertEquals(freeOptName, optCat.getName());
+ try {
+ // We get the option categories and options from the tool itself, but the
+ // tool reference will have a set of 0 to n option references that contain
+ // overridden settings. In this case, the string is inheritted and should
+ // not be reference
+ assertEquals(IOption.STRING, optCat.getValueType());
+ IOption stringOpt = toolRef.getOptionById(optCat.getId());
+ assertTrue(stringOpt instanceof Option);
+ assertEquals(freeOptValue, stringOpt.getStringValue());
+ } catch (BuildException e1) {
+ fail("Failed getting string value in subsub :" + e1.getLocalizedMessage());
+ }
+
+ // Do the same for the options in the child cat
+ Object[][] optsInSubCat = subCategories[0].getOptions(configs[0]);
+ for (i=0; i<optsInSubCat.length; i++)
+ if (optsInSubCat[i][0] == null) break;
+ assertEquals(1, i);
+ IOption booleanRef = toolRef.getOptionById(((IOption)optsInSubCat[0][1]).getId());
+ assertEquals(chainedOptName, booleanRef.getName());
+ try {
+ assertEquals(IOption.BOOLEAN, booleanRef.getValueType());
+ assertTrue(booleanRef.getBooleanValue());
+ } catch (BuildException e) {
+ fail("Failure getting boolean value in subsub: " + e.getLocalizedMessage());
+ }
+
+ // Test that the tool command can be changed through the reference
+ toolRef.setToolCommand(newCmd);
+ assertEquals(toolRef.getToolCommand(), newCmd);
+
+ // Muck about with the options in the local config
+ IConfiguration subSubConfig = projType.getConfiguration("sub.sub.config");
+ assertNotNull(subSubConfig);
+ ITool[] configTools = subSubConfig.getTools();
+ // This tool ref is inherited from parent, so it does not belong to the config
+ ITool configToolRef = configTools[0];
+ assertNotNull(configToolRef);
+ optCat = (IOption)optsInCat[0][1];
+ IOption configStringOpt = configToolRef.getOptionById(optCat.getId());
+ assertNotNull(configStringOpt);
+ // Override the string option
+ try {
+ subSubConfig.setOption(configToolRef, configStringOpt, stringOverride);
+ } catch (BuildException e) {
+ fail("Failure setting string value in subsubconfiguration: " + e.getLocalizedMessage());
+ }
+ // Now the config should have a tool ref to the independent tool
+ configTools = subSubConfig.getTools();
+ configToolRef = configTools[0];
+ assertNotNull(configToolRef);
+
+ // Test that the string option is overridden in the configuration
+ optsInCat = categories[0].getOptions(configs[0]);
+ for (i=0; i<optsInCat.length; i++)
+ if (optsInCat[i][0] == null) break;
+ assertEquals(1, i);
+ optCat = (IOption)optsInCat[0][1];
+ assertEquals(freeOptName, optCat.getName());
+ configStringOpt = configToolRef.getOptionById(optCat.getId());
+ try {
+ assertEquals(stringOverride, configStringOpt.getStringValue());
+ } catch (BuildException e) {
+ fail("Failure getting string value in subsubconfiguration: " + e.getLocalizedMessage());
+ }
+ // The tool should also contain the boolean option set to true
+ IOption optSubCat = (IOption)optsInSubCat[0][1];
+ IOption configBoolOpt = configToolRef.getOptionById(optSubCat.getId());
+ assertNotNull(configBoolOpt);
+ try {
+ assertTrue(configBoolOpt.getBooleanValue());
+ } catch (BuildException e) {
+ fail("Failure getting boolean value in subsubconfiguration: " + e.getLocalizedMessage());
+ }
+
+ // Override it in config and retest
+ try {
+ subSubConfig.setOption(configToolRef, configBoolOpt, false);
+ } catch (BuildException e) {
+ fail("Failure setting boolean value in subsubconfiguration: " + e.getLocalizedMessage());
+ }
+ optsInSubCat = subCategories[0].getOptions(configs[0]);
+ for (i=0; i<optsInSubCat.length; i++)
+ if (optsInSubCat[i][0] == null) break;
+ assertEquals(1, i);
+ configBoolOpt = configToolRef.getOptionById(((IOption)optsInSubCat[0][1]).getId());
+ assertEquals(chainedOptName, booleanRef.getName());
+ try {
+ assertFalse(configBoolOpt.getBooleanValue());
+ } catch (BuildException e) {
+ fail("Failure getting boolean value in subsubconfiguration: " + e.getLocalizedMessage());
+ }
+ }
+
+ /*
+ * Do a sanity check on the values in the sub-project type. Most of the
+ * sanity on the how build model entries are read is performed in
+ * the root project type check, so these tests just verify that the the sub
+ * project type properly inherits from its parent. For the new options
+ * in the sub project type, the test does a sanity check just to be complete.
+ */
+ private void checkSubProjectType(IProjectType projType) throws BuildException {
+ final String expectedFlags = "-I/usr/include -I/opt/gnome/include -IC:\\home\\tester/include -I\"../includes\" x y z";
+
+ IConfiguration[] configs = projType.getConfigurations();
+ // Check the overridden clean command
+ assertEquals("rm -yourworld", configs[0].getCleanCommand());
+ // Make sure the projType inherits the make command
+ assertEquals("make", configs[0].getBuildCommand());
+ // Make sure the binary parser is hard-coded and available
+ IToolChain toolChain = configs[0].getToolChain();
+ ITargetPlatform targetPlatform = toolChain.getTargetPlatform();
+ assertEquals("org.eclipse.cdt.core.PE", targetPlatform.getBinaryParserId());
+ String[] expectedOSList = {"win32","linux","solaris"};
+ assertTrue(Arrays.equals(expectedOSList, toolChain.getOSList()));
+ // Make sure the list is overridden
+ String[] expectedArchList = {"x86", "ppc"};
+ assertTrue(Arrays.equals(expectedArchList, toolChain.getArchList()));
+
+ // Make sure this is a test projType
+ assertTrue(projType.isTestProjectType());
+ // Make sure the build artifact extension is there
+ assertEquals(configs[0].getArtifactExtension(), subExt);
+
+ // Get the tools for this projType
+ ITool[] tools = configs[0].getTools();
+ // Do we inherit properly from parent
+ ITool rootTool = tools[0];
+ assertEquals("Root Tool", rootTool.getName());
+ // Now get the tool defined for this projType
+ ITool subTool = tools[1];
+ assertEquals("Sub Tool", subTool.getName());
+ // Confirm that it has four options
+ IOption[] subOpts = subTool.getOptions();
+ assertEquals(5, subOpts.length);
+ assertEquals("", subTool.getOutputFlag());
+ assertTrue(subTool.buildsFileType("yarf"));
+ assertTrue(subTool.producesFileType("bus"));
+ assertEquals("", subTool.getToolCommand());
+ assertEquals("lib", subTool.getOutputPrefix());
+ assertTrue(subTool.isHeaderFile("arf"));
+ assertTrue(subTool.isHeaderFile("barf"));
+ assertEquals(ITool.FILTER_BOTH, subTool.getNatureFilter());
+
+ // Do a sanity check on the options
+ assertEquals("Include Paths", subOpts[0].getName());
+ assertEquals(IOption.INCLUDE_PATH, subOpts[0].getValueType());
+ String[] incPath = subOpts[0].getIncludePaths();
+ assertEquals(2, incPath.length);
+ assertEquals("/usr/include", incPath[0]);
+ assertEquals("/opt/gnome/include", incPath[1]);
+ String[] builtInPaths = subOpts[0].getBuiltIns();
+ assertEquals(1, builtInPaths.length);
+ assertEquals("/usr/gnu/include", builtInPaths[0]);
+ assertEquals("-I", subOpts[0].getCommand());
+ assertEquals(IOption.BROWSE_DIR, subOpts[0].getBrowseType());
+
+ // There are no user-defined preprocessor symbols
+ assertEquals("Defined Symbols", subOpts[1].getName());
+ assertEquals(IOption.PREPROCESSOR_SYMBOLS, subOpts[1].getValueType());
+ String[] defdSymbols = subOpts[1].getDefinedSymbols();
+ assertEquals(0, defdSymbols.length);
+ assertEquals("-D", subOpts[1].getCommand());
+ // But there is a builtin
+ String[] builtInSymbols = subOpts[1].getBuiltIns();
+ assertEquals(1, builtInSymbols.length);
+ assertEquals("BUILTIN", builtInSymbols[0]);
+ // Broswe type should be none
+ assertEquals(IOption.BROWSE_NONE, subOpts[1].getBrowseType());
+
+ assertEquals("More Includes", subOpts[2].getName());
+ assertEquals(IOption.INCLUDE_PATH, subOpts[2].getValueType());
+ String[] moreIncPath = subOpts[2].getIncludePaths();
+ assertEquals(2, moreIncPath.length);
+ assertEquals("C:\\home\\tester/include", moreIncPath[0]);
+ assertEquals("-I", subOpts[2].getCommand());
+ assertEquals(IOption.BROWSE_DIR, subOpts[2].getBrowseType());
+
+ // Check the user object option
+ assertEquals("User Objects", subOpts[3].getName());
+ assertEquals(IOption.OBJECTS, subOpts[3].getValueType());
+ String[] objs = subOpts[3].getUserObjects();
+ assertEquals(2, objs.length);
+ assertEquals("obj1.o", objs[0]);
+ assertEquals("obj2.o", objs[1]);
+ assertEquals(IOption.BROWSE_FILE, subOpts[3].getBrowseType());
+ assertEquals("", subOpts[3].getCommand());
+
+ // There should be a string list with no command
+ assertEquals("No Command StringList", subOpts[4].getName());
+ assertEquals(IOption.STRING_LIST, subOpts[4].getValueType());
+
+ // Make sure the tool flags look right
+ assertEquals(subTool.getToolFlags(), expectedFlags);
+
+ // Get the configs for this projType; it should inherit all the configs defined for the parent
+ assertEquals(4, configs.length);
+ assertEquals("Sub Config", configs[0].getName());
+ assertEquals("Root Config", configs[1].getName());
+ assertEquals("Root Override Config", configs[2].getName());
+ assertEquals("Complete Override Config", configs[3].getName());
+ }
+
+ private void checkForwardProjectTypes(IProjectType parent, IProjectType child, IProjectType grandchild) {
+ // check that the projType parent reference has been resolved.
+ assertEquals(parent, child.getSuperClass());
+ assertEquals(child, grandchild.getSuperClass());
+
+ // get the parent tool
+ IConfiguration[] parentConfigs = parent.getConfigurations();
+ ITool[] parentTools = parentConfigs[0].getTools();
+ assertEquals(1, parentTools.length);
+ ITool parentTool = parentTools[0];
+ assertNotNull(parentTool);
+
+ // check option categories
+ IOption option = parentTool.getOptionById("test.forward.option");
+ assertNotNull(option);
+ IOptionCategory[] firstLevel = parentTool.getTopOptionCategory()
+ .getChildCategories();
+ assertEquals(1, firstLevel.length);
+ IOptionCategory[] secondLevel = firstLevel[0].getChildCategories();
+ assertEquals(1, secondLevel.length);
+ assertEquals(0, secondLevel[0].getChildCategories().length);
+ Object[][] optList = secondLevel[0].getOptions(parentConfigs[0]);
+ int i;
+ for (i=0; i<optList.length; i++)
+ if (optList[i][0] == null) break;
+ assertEquals(1, i);
+ assertEquals(option, optList[0][1]);
+
+ // get the tool reference from the child
+ IConfiguration[] childConfigs = child.getConfigurations();
+ ITool[] childTools = childConfigs[0].getTools();
+ assertEquals(1, childTools.length);
+ ITool childToolRef = childTools[0];
+ assertEquals(parentTool.getSuperClass(), childToolRef.getSuperClass());
+
+ // get and check the option reference
+ IOption optRef = childToolRef.getOptionById("test.forward.option");
+ assertEquals(option, optRef);
+
+ // get the tool reference from the grandchild
+ IConfiguration[] grandConfigs = grandchild.getConfigurations();
+ ITool[] grandTools = grandConfigs[0].getTools();
+ assertEquals(1, grandTools.length);
+ ITool grandToolRef = grandTools[0];
+ assertEquals(parentTool.getSuperClass(), grandToolRef.getSuperClass());
+
+ }
+
+ public void checkProviderProjectType(IProjectType projType) throws Exception {
+ Properties props = new Properties();
+ props.load(getClass().getResourceAsStream("test_commands"));
+
+ // check that this projType is in the file
+ String command = props.getProperty(projType.getId());
+ assertNotNull(command);
+
+ IProjectType parent = projType.getSuperClass();
+ assertNotNull(parent);
+ assertEquals("test.forward.parent.target", parent.getId());
+
+ IConfiguration[] configs = projType.getConfigurations();
+ ITool toolRef = configs[0].getFilteredTools()[0];
+ assertEquals(command, toolRef.getToolCommand());
+ }
+
+ /**
+ * Remove all the project information associated with the project used during test.
+ */
+ public void cleanup() {
+ removeProject(projectName);
+ removeProject(projectName2);
+ }
+
+ /* (non-Javadoc)
+ * 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 newProjectHandle = root.getProject(name);
+ IProject project = null;
+
+ if (!newProjectHandle.exists()) {
+ IWorkspace workspace = ResourcesPlugin.getWorkspace();
+ IWorkspaceDescription workspaceDesc = workspace.getDescription();
+ workspaceDesc.setAutoBuilding(false);
+ workspace.setDescription(workspaceDesc);
+ IProjectDescription description = workspace.newProjectDescription(newProjectHandle.getName());
+ //description.setLocation(root.getLocation());
+ project = CCorePlugin.getDefault().createCProject(description, newProjectHandle, new NullProgressMonitor(), MakeCorePlugin.MAKE_PROJECT_ID);
+ } else {
+ newProjectHandle.refreshLocal(IResource.DEPTH_INFINITE, null);
+ project = newProjectHandle;
+ }
+
+ // Open the project if we have to
+ if (!project.isOpen()) {
+ project.open(new NullProgressMonitor());
+ }
+
+ 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 {
+ Thread.sleep(1000);
+ } catch (InterruptedException e1) {
+ } finally {
+ try {
+ System.gc();
+ System.runFinalization();
+ project.delete(true, true, null);
+ } catch (CoreException e2) {
+ assertTrue(false);
+ }
+ }
+ }
+ }
+ /**
+ * @throws CoreException
+ * @throws BuildException
+ */
+ public void testErrorParsers() throws BuildException {
+ // Create new project
+ IProject project = null;
+ try {
+ project = createProject(projectName2);
+ // Now associate the builder with the project
+ addManagedBuildNature(project);
+ IProjectDescription description = project.getDescription();
+ // Make sure it has a managed nature
+ if (description != null) {
+ assertTrue(description.hasNature(ManagedCProjectNature.MNG_NATURE_ID));
+ }
+ } catch (CoreException e) {
+ fail("Test failed on error parser project creation: " + e.getLocalizedMessage());
+ }
+
+ // Find the base project Type definition
+ IProjectType projType = ManagedBuildManager.getProjectType("test.error.parsers");
+ assertNotNull(projType);
+
+ // Create the target for our project that builds a dummy executable
+ IManagedProject newProj = ManagedBuildManager.createManagedProject(project, projType);
+ assertEquals(newProj.getName(), projType.getName());
+ ManagedBuildManager.setNewProjectVersion(project);
+
+ // Initialize the path entry container
+ IStatus initResult = ManagedBuildManager.initBuildInfoContainer(project);
+ if (initResult.getCode() != IStatus.OK) {
+ fail("Initializing build information failed for: " + project.getName() + " because: " + initResult.getMessage());
+ }
+
+ // Copy over the configs
+ IConfiguration[] baseConfigs = projType.getConfigurations();
+ for (int i = 0; i < baseConfigs.length; ++i) {
+ newProj.createConfiguration(baseConfigs[i], baseConfigs[i].getId() + "." + i);
+ }
+
+ // Test this out
+ checkErrorParsersProject(newProj);
+
+ // Save, close, reopen and test again
+ ManagedBuildManager.saveBuildInfo(project, true);
+ ManagedBuildManager.removeBuildInfo(project);
+ try {
+ project.close(null);
+ } catch (CoreException e) {
+ fail("Failed on error parser project close: " + e.getLocalizedMessage());
+ }
+ try {
+ project.open(null);
+ } catch (CoreException e) {
+ fail("Failed on error parser project open: " + e.getLocalizedMessage());
+ }
+
+ // Test that the default config was remembered
+ IManagedBuildInfo info = ManagedBuildManager.getBuildInfo(project);
+
+ // Check the rest of the default information
+ checkErrorParsersProject(info.getManagedProject());
+ ManagedBuildManager.removeBuildInfo(project);
+ }
+
+ /*
+ * Do a sanity check on the error parsers target.
+ */
+ private void checkErrorParsersProject(IManagedProject proj) throws BuildException {
+ // Target stuff
+ String expectedBinParserId = "org.eclipse.cdt.core.PE";
+ IConfiguration[] configs = proj.getConfigurations();
+ IToolChain toolChain = configs[0].getToolChain();
+ ITargetPlatform targetPlatform = toolChain.getTargetPlatform();
+ assertEquals(expectedBinParserId, targetPlatform.getBinaryParserId());
+ // This target defines errors parsers. Check that the error parsers
+ // have been assigned.
+ assertEquals("org.eclipse.cdt.core.MakeErrorParser;org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GLDErrorParser", configs[0].getErrorParserIds());
+
+ // Tool
+ ITool[] tools = configs[0].getTools();
+ ITool rootTool = tools[0];
+ assertEquals(1, tools.length);
+ assertEquals("EP Tool", tools[0].getName());
+ assertEquals("-o", tools[0].getOutputFlag());
+ assertTrue(tools[0].buildsFileType("y"));
+ assertTrue(tools[0].buildsFileType("x"));
+ assertTrue(tools[0].producesFileType("xy"));
+ assertEquals("EP", tools[0].getToolCommand());
+ assertEquals(ITool.FILTER_C, rootTool.getNatureFilter());
+
+ // There should be one defined configs
+ assertEquals(1, configs.length);
+ }
+
+ /**
+ * Test that the build artifact of a <code>ITarget</code> can be modified
+ * programmatically.
+ */
+ public void testConfigBuildArtifact () throws CoreException {
+ // Open the test project
+ IProject project = createProject(projectName);
+ IManagedBuildInfo info = ManagedBuildManager.getBuildInfo(project);
+ assertNotNull(info);
+ IManagedProject managedProj = info.getManagedProject();
+ assertNotNull(managedProj);
+ IConfiguration defaultConfig = info.getDefaultConfiguration();
+ assertNotNull(defaultConfig);
+
+ // Set the build artifact of the configuration
+ String ext = defaultConfig.getArtifactExtension();
+ String name = project.getName() + "." + ext;
+ defaultConfig.setArtifactName(name);
+
+ // Save, close, reopen and test again
+ ManagedBuildManager.saveBuildInfo(project, false);
+ ManagedBuildManager.removeBuildInfo(project);
+ project.close(null);
+ project.open(null);
+
+ // Check the artifact name
+ info = ManagedBuildManager.getBuildInfo(project);
+ assertNotNull(info);
+ managedProj = info.getManagedProject();
+ assertNotNull(managedProj);
+ defaultConfig = info.getDefaultConfiguration();
+ assertNotNull(defaultConfig);
+ assertEquals(name, defaultConfig.getArtifactName());
+ }
+
+ public void testThatAlwaysFails() {
+ assertTrue(false);
+ }
+
+ public void testBug43450 () throws Exception{
+ IProject project = createProject( projectName );
+
+ IFolder folder = project.getProject().getFolder( "includes" );
+ if( !folder.exists() ){
+ folder.create( false, true, null );
+ }
+
+ IFile file = project.getProject().getFile( "includes/header.h" );
+ if( !file.exists() ){
+ file.create( new ByteArrayInputStream( "class A { public : static int i; };".getBytes() ), false, null );
+ }
+
+ IScannerInfoProvider provider = CCorePlugin.getDefault().getScannerInfoProvider(project);
+ IScannerInfo info = provider.getScannerInformation( project );
+ ISourceElementRequestor callback = new NullSourceElementRequestor();
+
+ IScanner scanner = ParserFactory.createScanner( new CodeReader( "#include <header.h>\n int A::i = 1;".toCharArray() ),
+ info, ParserMode.COMPLETE_PARSE, ParserLanguage.CPP, callback, new NullLogService(), null);
+
+ IParser parser = ParserFactory.createParser( scanner, callback, ParserMode.COMPLETE_PARSE, ParserLanguage.CPP, null );
+ assertTrue( parser.parse() );
+ }
+
+}
+